News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

playing card compares

Started by shankle, March 31, 2018, 12:04:19 AM

Previous topic - Next topic

shankle

                  3-30-2018
             
I need to create 52 cards images in my program that I want
to compare to an on line program. On average that will mean scanning
about 50% of the image file in my program to find a match.
For Example: I have the image of the 2 of clubs in my program and
the on line program is displaying the 2 of clubs. This means I have
to scan 52 items to find a match. I'm wondering about the time this
will take as I have no control over how fast the next set of images
will be displayed in the on line program.
The image file in my program should be the same resolution as the card
image in the on line program. Any use of 3rd party programs will be to
slow. So it has to be done in my program.

1st suggestion for creating the image file in my program.
2nd suggestion for comparing the two image files speedily.

Purpose of the program is for my use only and as we age the memory problems
get tougher. Want to keep a record of the cards played for each hand.
Thanks for any suggestions.

zeddicus

Sounds like cheating.   :biggrin: adding my 2 cents.

Might be difficult due to palette differences, unless you have exact copies of the images the site is using I would think.

Edit to add:

The site itself could also cheat, imo. Meaning that no matter what the user chooses,  the site will always have the upper hand and win. Some food for thought.


Can't be much more help than that, posting from phone.

shankle

Thanks for responding Zeddicus.
In a way it is cheating. But it is only for my use.
Also the challenge of writing the program which
has caused me no end of difficulty  :(

zeddicus

I see where it would be nice coding challenge. It would be a shame though for you to put in a lot of effort if the site itself cheats.

I once opened a video poker type game in Olly,  and saw the type of cheating (on behalf of the unscrupulous game) in action,  so that is why I mentioned the possibility of the site also cheating.

zeddicus

Is this related to your thread started August 13, 2017 "My program and an online program"??    :shock:
(I don't know how to paste on this phone)

If so, you HAVE been at this for a VERY long time indeed. That is what I call persistence.

FORTRANS

Hi,

Quote from: shankle on March 31, 2018, 12:04:19 AM
The image file in my program should be the same resolution as the card
image in the on line program. Any use of 3rd party programs will be to
slow. So it has to be done in my program.

1st suggestion for creating the image file in my program.

   Sounds like a screen grabbing problem.  Can you grab images
of the cards in your on line program?  Well, you must if you
want something to compare to, correct?

Quote
2nd suggestion for comparing the two image files speedily.

   If you use the same images as the program, just eXclusive
OR the two card images.  If they are the same, you end up
with a zeroed image.  If there is some jitter in grabbing the
card images, use a minimum/maximum correlation algorithm
on the XORed images.  Count the mismatched pixels and look
for a minimum in both number and kind.

Regards,

Steve

shankle

Thanks guys for responding.
I don't feel that the site I am trying to compare the cards images is cheating in any way.
Yes this is related to that program. I have not been working on it constantly because my
wife has been very sick for about 3 months.

I am trying to grab images of the cards displayed by the on line program.
So far I have not succeeded. I would guess it has something to do with the focus of the
on line program and my program OR not able to get the correct handle of the online program.

I think after I am able to read an image from the online program, I then should build another
program to save the 52 cards images I have gotten from the on line program. Then include
them in my original program for comparison purposes.

zeddicus


Quote
Yes this is related to that program.

I noticed the similarities

Quote
I have not been working on it constantly because my
wife has been very sick for about 3 months.

I'm truly very sorry to hear that. How is she doing?

Quote
I am trying to grab images of the cards displayed by the on line program.
So far I have not succeeded. I would guess it has something to do with the focus of the
on line program and my program OR not able to get the correct handle of the online program.

Sounds feasible, but may not be easy.

Quote
I think after I am able to read an image from the online program, I then should build another
program to save the 52 cards images I have gotten from the on line program. Then include
them in my original program for comparison purposes.

Let me know how it all works out. Wish I could be more helpful. But am severely crippled by not having computer and no way of writing and compiling code.

Wish you the best of luck.

Zedd

shankle

Thanks for the encouragement Zeddicus.
Wife is recovering. Thanks.

avcaballero

If you only want image cards, you may try this link

shankle

Thank you Caballero for responding.
I must have an exact replica of the cards from the on line program, so
if I find a match I can record it as being played.

raymond

Just in case that my assumption would be wrong that you have already thought about it:

There is no need to compare the entire card. Each card usually has its denomination in two of the corners and checking a 15x20 pixel section (or maybe less) in one of those corners should be sufficient to identify it. All you would need to do is grab images of the chosen corners.

Whenever you assume something, you risk being wrong half the time.
http://www.ray.masmcode.com

shankle

Thank you Raymond for your input.
I took an image of 4 cards with FastStone capture
and did not find anything in the corners to identify
the image.

raymond

Must have been a super lazy programmer for not drawing cards resembling a real deck of cards.

Many years ago I needed cards for a program of mine. That was before the Windows era and the availability of scanners so that I had to draw my own (I also had to write my own drawing program in order to have the data in a format I could understand!). I made sure the cards would look like the usual physical ones.

Maybe you could give us a link for the site displaying those cards you intend to"duplicate". Someone may have a bright idea.
Whenever you assume something, you risk being wrong half the time.
http://www.ray.masmcode.com

dedndave

windows provides cards.dll  :P
i seem to recall someone made an INC for it several years back

otherwise, buy a nice new deck of bicycle or aviator cards and scan them in