Author Topic: playing card compares  (Read 416 times)

shankle

  • Member
  • ****
  • Posts: 764
playing card compares
« 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.
 

zeddicus

  • Guest
Re: playing card compares
« Reply #1 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.

shankle

  • Member
  • ****
  • Posts: 764
Re: playing card compares
« Reply #2 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  :(

zeddicus

  • Guest
Re: playing card compares
« Reply #3 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.

zeddicus

  • Guest
Re: playing card compares
« Reply #4 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.

FORTRANS

  • Member
  • ****
  • Posts: 972
Re: playing card compares
« Reply #5 on: March 31, 2018, 02:01:27 AM »
Hi,

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

  • Member
  • ****
  • Posts: 764
Re: playing card compares
« Reply #6 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.

zeddicus

  • Guest
Re: playing card compares
« Reply #7 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

shankle

  • Member
  • ****
  • Posts: 764
Re: playing card compares
« Reply #8 on: March 31, 2018, 10:40:51 AM »
Thanks for the encouragement Zeddicus.
Wife is recovering. Thanks.

caballero

  • Member
  • ****
  • Posts: 919
    • Abre Ojos Ensamblador
Re: playing card compares
« Reply #9 on: March 31, 2018, 07:43:32 PM »
If you only want image cards, you may try this link
En un lugar de la Mancha de cuyo nombre no quiero acordarme

shankle

  • Member
  • ****
  • Posts: 764
Re: playing card compares
« Reply #10 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.

raymond

  • Member
  • **
  • Posts: 193
    • Raymond's page
Re: playing card compares
« Reply #11 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.

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

shankle

  • Member
  • ****
  • Posts: 764
Re: playing card compares
« Reply #12 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.

raymond

  • Member
  • **
  • Posts: 193
    • Raymond's page
Re: playing card compares
« Reply #13 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.
Whenever you assume something, you risk being wrong half the time.
http://www.ray.masmcode.com/

dedndave

  • Member
  • *****
  • Posts: 8779
  • Still using Abacus 2.0
    • DednDave
Re: playing card compares
« Reply #14 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