The MASM Forum

Projects => Rarely Used Projects => GoAsm => Topic started by: shankle on March 31, 2018, 12:04:19 AM

Title: playing card compares
Post by: shankle on March 31, 2018, 12:04:19 AM
                  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.
Title: Re: playing card compares
Post by: zeddicus on March 31, 2018, 12:13:50 AM
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.
Title: Re: playing card compares
Post by: shankle on March 31, 2018, 12:34:31 AM
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  :(
Title: Re: playing card compares
Post by: zeddicus on March 31, 2018, 12:41:31 AM
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.
Title: Re: playing card compares
Post by: zeddicus on March 31, 2018, 12:55:13 AM
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.
Title: Re: playing card compares
Post by: FORTRANS on March 31, 2018, 02:01:27 AM
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
Title: Re: playing card compares
Post by: shankle on March 31, 2018, 07:51:20 AM
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.
Title: Re: playing card compares
Post by: zeddicus on March 31, 2018, 09:17:19 AM

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
Title: Re: playing card compares
Post by: shankle on March 31, 2018, 10:40:51 AM
Thanks for the encouragement Zeddicus.
Wife is recovering. Thanks.
Title: Re: playing card compares
Post by: avcaballero on March 31, 2018, 07:43:32 PM
If you only want image cards, you may try this link (https://upload.wikimedia.org/wikipedia/commons/d/d5/English_pattern_playing_cards_deck_PLUS.svg)
Title: Re: playing card compares
Post by: shankle on April 01, 2018, 05:38:43 AM
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.
Title: Re: playing card compares
Post by: raymond on April 02, 2018, 02:20:27 AM
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.

Title: Re: playing card compares
Post by: shankle on April 02, 2018, 04:43:38 AM
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.
Title: Re: playing card compares
Post by: raymond on April 02, 2018, 05:38:18 AM
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.
Title: Re: playing card compares
Post by: dedndave on April 04, 2018, 08:25:50 PM
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
Title: Re: playing card compares
Post by: zedd151 on April 04, 2018, 08:37:53 PM
Quote from: dedndave on April 04, 2018, 08:25:50 PM
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

No dave, apparently wants to screen cap the site, then compare to images already captured from same site. I myself can't help, no puter, posting via phone.
Title: Re: playing card compares
Post by: jj2007 on April 04, 2018, 10:42:43 PM
Quote from: dedndave on April 04, 2018, 08:25:50 PM
windows provides cards.dll  :P
i seem to recall someone made an INC for it several years back

See Playing cards (http://masm32.com/board/index.php?topic=5684.0); but it won't help because OP wants to compare against one very specific set of images.
Title: Re: playing card compares
Post by: zedd151 on April 05, 2018, 12:15:30 AM
Actually what he could do, since he already has images of the 52 cards scanned; is to identify just a few bytes that are unique to  each card. Once done, he will have a small database to work with for the comparison. Now scanning the site and parsing out the card image data is another issue.