Poker-AI.org Poker AI and Botting Discussion Forum 2017-03-28T04:58:06+00:00 http://poker-ai.org/phpbb/feed.php?f=26&t=3027 2017-03-27T20:44:51+00:00 2017-03-27T20:44:51+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=3027&p=7139#p7139 <![CDATA[Re: OCR for asian network]]> It is nothing. You can not even measure this time without many itterations.
Anyway, all algoritms I thinking includes 1st step triple at least width.
And for debug sences you should triple height too. (after you had compleet working algoritm you can reduce height trippling)

Statistics: Posted by nefton — Mon Mar 27, 2017 8:44 pm


]]>
2017-03-27T18:42:02+00:00 2017-03-27T18:42:02+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=3027&p=7137#p7137 <![CDATA[Re: OCR for asian network]]> Quote:

Simplest - is to make width*3, height*3 1 chanel picture and fill it by values of r, g, b subpixels.
I tryed it - it good.


Just to mention, it is also important to recognize table information fast, it would be good less that 0.5 sec. I think that if the solution would be to increase image then it would increase the time to recognize information.

Statistics: Posted by mlatinjo — Mon Mar 27, 2017 6:42 pm


]]>
2017-03-27T03:27:49+00:00 2017-03-27T03:27:49+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=3027&p=7136#p7136 <![CDATA[Re: OCR for asian network]]> mlatinjo wrote:

How does scaling to huge image size is going to help recognize digits?


No, understanding of what happens will help mutch.
You can imagine several algoritms, based on subpixel places, and all of them will be mutch better then now.
Simplest - is to make width*3, height*3 1 chanel picture and fill it by values of r, g, b subpixels.
I tryed it - it good.
But it is not best algoritm for you. More understanding cleartype algoritm will produce mutch better algoritms.(but some more hard)

Statistics: Posted by nefton — Mon Mar 27, 2017 3:27 am


]]>
2017-03-28T04:58:06+00:00 2017-03-27T03:19:01+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=3027&p=7135#p7135 <![CDATA[Re: OCR for asian network]]> macro.jpg
small hole on the cap is to make minimum apperture I can do. (for big depht of field)
+ several macro rings M42
With this tehniques I can do 5x times more closer picture then in photo below. And more quality :roll:
This photo makes in hurry.

Statistics: Posted by nefton — Mon Mar 27, 2017 3:19 am


]]>
2017-03-27T02:41:09+00:00 2017-03-27T02:41:09+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=3027&p=7134#p7134 <![CDATA[Re: OCR for asian network]]>
How does scaling to huge image size is going to help recognize digits?

Statistics: Posted by mlatinjo — Mon Mar 27, 2017 2:41 am


]]>
2017-03-26T20:27:45+00:00 2017-03-26T20:27:45+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=3027&p=7133#p7133 <![CDATA[Re: OCR for asian network]]> !!!!
1. This color artifacts calls clear type!
2. Here is macro photo of orign.png on my monitor. It all explain.
clear_type.jpg
red lines - is border of monitor pixels.
So now I think it easy to raise qualyty of recognizing X10 times :idea: :geek:

Statistics: Posted by nefton — Sun Mar 26, 2017 8:27 pm


]]>
2017-03-26T18:19:30+00:00 2017-03-26T18:19:30+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=3027&p=7132#p7132 <![CDATA[Re: OCR for asian network]]> You can see that even in the standard table size, the digits look quite different. From that I can conclude that the digits and letters don't look different because of resize because on standard table size it also looks all different?

Statistics: Posted by mlatinjo — Sun Mar 26, 2017 6:19 pm


]]>
2017-03-26T17:32:06+00:00 2017-03-26T17:32:06+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=3027&p=7131#p7131 <![CDATA[Re: OCR for asian network]]> mlatinjo wrote:

In the attachment you can find the biggest stack size I have found.

I mean width and height of stack digits. (Screenshoot max table size you can do)

Filters... I thought the above pictures will be enough for understanding.
1st filter. I delete right edge of all digits. I see that on edge there is big hue gradient (h1-h2)
2nd filter. The same only on right edge
3rd. remain only desired hue and saturation diapason.

Without 1st and 2nd filters - there was bad results from 3rd filter.

But I have another idea how to recognize it. May be this red and blue edges are not noise, and we should not remove it.
They appear from worst algoritm of resizing they template digits to size that are displayed to you.
And if we can understand this algoritm of resizing - we can use this bad pixels to restore the original digits.

And even if this idea will not work - you can just store many variants of your digits (10variants x 10digits = 100 templates only (it is not terrible value))

Statistics: Posted by nefton — Sun Mar 26, 2017 5:32 pm


]]>
2017-03-26T16:24:38+00:00 2017-03-26T16:24:38+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=3027&p=7130#p7130 <![CDATA[Re: OCR for asian network]]> HontoNiBaka wrote:

What is the name of the site? Maybe you can change the fonts or so, to make it more readable?

Everytime I did OCR, I was never happy with software like Tess, I always wrote my own code. I also never use anything like NNs in my code, I usually write a ton of custom rules to detect the borders and the characters. It's usually a ton of work, but after a while the accuracy is pretty good.


The name is natural 8, asian online casino.

Statistics: Posted by mlatinjo — Sun Mar 26, 2017 4:24 pm


]]>
2017-03-26T16:23:26+00:00 2017-03-26T16:23:26+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=3027&p=7129#p7129 <![CDATA[Re: OCR for asian network]]> nefton wrote:

Cant attach more 3 files. And here is result.
(you can do all 3 filters in one sycle)

With good filters, it will be much easier to recognize ;)


Ok I can see from the result image that it should be easier to recognize digits after the proposed filters are applied. Still I don't understand how could I do it in c# because I don't understand your code?

Statistics: Posted by mlatinjo — Sun Mar 26, 2017 4:23 pm


]]>
2017-03-26T16:21:02+00:00 2017-03-26T16:21:02+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=3027&p=7128#p7128 <![CDATA[Re: OCR for asian network]]> Also by looking at your output images I see that the digits are still quite different, so how can I recognize e.g. digit 0 if it is displayed in so many different ways?
In the attachment you can find the biggest stack size I have found.

Statistics: Posted by mlatinjo — Sun Mar 26, 2017 4:21 pm


]]>
2017-03-26T12:04:33+00:00 2017-03-26T12:04:33+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=3027&p=7127#p7127 <![CDATA[Re: OCR for asian network]]> Have some idea.

Statistics: Posted by nefton — Sun Mar 26, 2017 12:04 pm


]]>
2017-03-26T01:19:32+00:00 2017-03-26T01:19:32+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=3027&p=7125#p7125 <![CDATA[Re: OCR for asian network]]> If letter you cut from stack is too width (9+ pixels)
You can try to compare all leters you have with the begin of your superwidth twice letter,
and if sucsess try the same thing on begin+sucsess_letter.width position

Statistics: Posted by nefton — Sun Mar 26, 2017 1:19 am


]]>
2017-03-26T01:23:33+00:00 2017-03-26T01:02:20+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=3027&p=7124#p7124 <![CDATA[Re: OCR for asian network]]> (you can do all 3 filters in one sycle)

With good filters, it will be much easier to recognize ;)

Statistics: Posted by nefton — Sun Mar 26, 2017 1:02 am


]]>
2017-03-26T01:01:25+00:00 2017-03-26T01:01:25+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=3027&p=7123#p7123 <![CDATA[Re: OCR for asian network]]> c++ code (opencv)
Code:
cv::Mat Img = cv::imread("c:/orign.png");
   
   //filter1
   for (int row = 0; row < Img.rows; row++){
      for (int col = 0; col < Img.cols-1; col++){
         uint8_t b1 = Img.at<cv::Vec3b>(row, col)[0];
         uint8_t g1 = Img.at<cv::Vec3b>(row, col)[1];
         uint8_t r1 = Img.at<cv::Vec3b>(row, col)[2];
         uint8_t h1, s1, v1;
         RGB2HSV(r1, g1, b1, &h1, &s1, &v1);
         uint8_t b2 = Img.at<cv::Vec3b>(row, col+1)[0];
         uint8_t g2 = Img.at<cv::Vec3b>(row, col+1)[1];
         uint8_t r2 = Img.at<cv::Vec3b>(row, col+1)[2];
         uint8_t h2, s2, v2;
         RGB2HSV(r2, g2, b2, &h2, &s2, &v2);
         if ((h1 > h2)&&(h1-h2 > 15)&&(h1>100)&&(h1<125)) Img.at<cv::Vec3b>(row, col+1) = cv::Vec3b(0, 0, 0);
      }
   }
   cv::imwrite("c:/filter1.png", Img);
   //filter2
   for (int row = 0; row < Img.rows; row++){
      for (int col = 0; col < Img.cols - 1; col++){
         uint8_t b1 = Img.at<cv::Vec3b>(row, col)[0];
         uint8_t g1 = Img.at<cv::Vec3b>(row, col)[1];
         uint8_t r1 = Img.at<cv::Vec3b>(row, col)[2];
         uint8_t h1, s1, v1;
         RGB2HSV(r1, g1, b1, &h1, &s1, &v1);
         uint8_t b2 = Img.at<cv::Vec3b>(row, col + 1)[0];
         uint8_t g2 = Img.at<cv::Vec3b>(row, col + 1)[1];
         uint8_t r2 = Img.at<cv::Vec3b>(row, col + 1)[2];
         uint8_t h2, s2, v2;
         RGB2HSV(r2, g2, b2, &h2, &s2, &v2);
         if ((h1 > h2) && (h1 - h2 > 15) && (h2>100) && (h2<125)) Img.at<cv::Vec3b>(row, col) = cv::Vec3b(0, 0, 0);
      }
   }
   cv::imwrite("c:/filter2.png", Img);
   //cv::Mat Img2 = Img.clone();
   //filter3
   for (int row = 0; row < Img.rows; row++){
      for (int col = 0; col < Img.cols; col++){
         uint8_t b = Img.at<cv::Vec3b>(row, col)[0];
         uint8_t g = Img.at<cv::Vec3b>(row, col)[1];
         uint8_t r = Img.at<cv::Vec3b>(row, col)[2];
         uint8_t h, s, v;
         RGB2HSV(r, g, b, &h, &s, &v);
         bool is_good_point = false;
         if ((h>100) && (h < 125) && (s>60) && (s<120) && (v > 200)) is_good_point = true;
         
         if (!is_good_point) Img.at<cv::Vec3b>(row, col) = cv::Vec3b(0, 0, 0);
         
      }
   }
   cv::imwrite("c:/filter3.png", Img);

Statistics: Posted by nefton — Sun Mar 26, 2017 1:01 am


]]>
2017-03-25T22:42:27+00:00 2017-03-25T22:42:27+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=3027&p=7122#p7122 <![CDATA[Re: OCR for asian network]]>
Everytime I did OCR, I was never happy with software like Tess, I always wrote my own code. I also never use anything like NNs in my code, I usually write a ton of custom rules to detect the borders and the characters. It's usually a ton of work, but after a while the accuracy is pretty good.

Statistics: Posted by HontoNiBaka — Sat Mar 25, 2017 10:42 pm


]]>
2017-03-25T17:53:30+00:00 2017-03-25T17:53:30+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=3027&p=7121#p7121 <![CDATA[OCR for asian network]]>
I am trying to do ocr for asian network, it seems very complicated so far because letters, digits, cards are displayed in many different ways. I can separate digits / letters automatically and save them as templates, but the problem is that I don't know if there are limited number of templates for e.g. digit 0.
in the attachment you can find 3 different stacks, so you can see that the same digits look different. There are occasions when the same digit (e.g. 0) looks the same way, but most of the time it is different. I convert the image to binary in order to remove rgb but still there are a lot of differences. You can also see 7 different digits 0
that are convert to binary image, how it all looks very different.

I haven't tried tesseract on this, but i think that it would perform very bad because letters and digits are very often connected, no clear border.
I hope that you will recognize that there are two images in the attachment, the second one displaying 3 different stacks is very small.
Any idea how to solve this?
Thanks in advance.

Statistics: Posted by mlatinjo — Sat Mar 25, 2017 5:53 pm


]]>