fvannee / android-cards-image-recognition

Image recognition software for playing cards
MIT License
11 stars 3 forks source link

Works with Hearts only #1

Open dabcmexpertise opened 5 years ago

dabcmexpertise commented 5 years ago

I downloaded your demo. Great Job!. All hearts cards are recognized without any mistake and within 1 second but other cards are not recognized regardless of angle and distance. Can you help me in this?

fvannee commented 5 years ago

It really depends on the training set - and also on some packs of cards I had better luck than on others. Did you use the Python code to create a training set for your cards?

dabcmexpertise commented 5 years ago

Right now it is solved by changing some parameters. Can you tell me how should I use python code to build training set of my models?.

I think the keyfunction to identify cards is this : getCardFeatureFromSubImage

and this line : boolean match_found = bestDist < requiredAccuracy * smallSize.area();

Now, If card is red heart The distance is generally lesser than the other side. But, If it is Spead, Club or Diamond, I dont know why, It becomes too large regardless of angle, distance or lighting.

As far as I know, " bestVal " is the ASCII value which is converted into a character but I do not know how it is identified from Play card.

fvannee commented 5 years ago

In the Java project, in the directory src/main/res/raw there is a set of training samples and responses. Each sample is basically a 25x25 black/white image of that feature, eg. King of hearts, and the response set would indicate that. They are loaded in the ScanCardFragment.java/switchCardSet function. They are used indeed in the getCardFeatureFromSubImage function, which calls the opencv function findNearest. This is a KNN algorithm that compares the extracted subimage from the camera to the model trained from the data set. These samples and responses can be constructed by training your own pictures with the Python code. This code will output the data files you can put in the res/raw directory. The python project can be found here: https://github.com/fvannee/python-cards-image-recognition You'll see sample pictures there I have used to train two set of cards. The python code itself is fairly straightforward, but a little bit messy. You can run it on some set or images and it'll show you the individual features in the image one by one. It's then up to you to provide the correct response and it uses that to train its model.

dabcmexpertise commented 5 years ago

Okay I downloaded your code and run using PyCharm. But still not able to generate my own models. May I ask which exact tools you used to train your models and generate samples and responses data files?

fvannee commented 5 years ago

What do you mean with that you're not able to generate your own models? Are you getting an error message? You need to adapt the Python code (the lines all the way at the bottom) to load the pictures of your own cards that you should take. Then the python code will show you the features in the images one by one and output the data files.

-Floris

On Wed, Mar 13, 2019, 07:48 dabcmexpertise notifications@github.com wrote:

Okay I downloaded your code and run using PyCharm. But still not able to generate my own models. May I ask which exact tools you used to train your models?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fvannee/android-cards-image-recognition/issues/1#issuecomment-472301058, or mute the thread https://github.com/notifications/unsubscribe-auth/ABNwxaYbRZm5502eho2B6-HMWmxgPyGEks5vWJ8-gaJpZM4baRSY .

dabcmexpertise commented 5 years ago

What do you mean with that you're not able to generate your own models? By this I mean that I stuck after running a code. I am having a small window named train.

python

I dont know how to use this but I think I am missing some tool.

Thats why I am repeating my question that do I need specific tools to train models and generate samples and responses data files?