Help with font based image recognition app

09/13/2016 17:55 Darthed#1
basically I don't know what I am supposed to do the code is not really mine so I don't know what I am looking at...I have asked in multiple forums where the problem is and most of the problems so far were either misspelling or old code from older versions of autoit so here it is
09/13/2016 22:44 elmarcia#2
Worst ocr ever seen, is this s*** working?
Maybe you should make it work another way or find any project with ocr and try from there.
Useful links: [Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
09/14/2016 00:22 Shadow992#3
Quote:
Originally Posted by elmarcia View Post
Worst ocr ever seen, is this s*** working?
Maybe you should make it work another way or find any project with ocr and try from there.
Useful links: [Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
I see you are not having any kind of experience programming OCR and similar computer vision tasks.
Even if this OCR is not perfect, it is still usable in certain cases. This code uses some kind of k nearest neighbour classifier, which has been shown in literature that this classifier works best among all others (SVMs, NNs, RandomForest, ...) if you know the exact font (like you mostly do when you are working with computer generated texts). Even if you do not know the used font it may still work as good as using convolutional neural networks.

@Darthed
It highly depends on the application you want to develop (like always in computer vision). There is no solution which works for everything and every case. This kind of general purpose AI is decades of research away from us. So you should specifiy your goals, show some example texts you want to recognize and tell us what you know.
In general this is no easy task which you can solve in 1-2 weeks if you have basically no knowledge in the computer vision subject. Therefore I suggest to use Tesseract this is some kind of general purpose OCR but of coz it is not working perfectly in every case.
09/15/2016 13:47 Darthed#4
Thanks for the replys
this is the github page of the author by the way [Only registered and activated users can see links. Click Here To Register...] I did modify it a little bit to stop it from giving errors but no luck with actually reading anything.. I think what it's supposed to do is detect text on the screen and then output it into output.txt and close the program but when I open it and hover over the text with the mouse it propts a random string of numbers and an Ok button...
09/15/2016 13:58 Shadow992#5
Quote:
Originally Posted by Darthed View Post
Thanks for the replys
this is the github page of the author by the way [Only registered and activated users can see links. Click Here To Register...] I did modify it a little bit to stop it from giving errors but no luck with actually reading anything.. I think what it's supposed to do is detect text on the screen and then output it into output.txt and close the program but when I open it and hover over the text with the mouse it propts a random string of numbers and an Ok button...

Because you do not use the same font as the author did, also the splitting of
characters may need to be done on another way. As already mentioned, if you want to use it for something different than the author did, you have to change many things. Maybe that much things that recoding it is eveneasier/better.
But because your knowledge in OCR is very limited, vour best way to go is using Tesseract or some similar ready to use OCRs. They will not work perfectly, too. But at least they will work better than this approach you presented.

Edit:
If you would provide some screenshots we may be able to help you more, otherwise this is a guessing game...
09/15/2016 15:01 Darthed#6
Quote:
Originally Posted by Shadow992 View Post
Because you do not use the same font as the author did, also the splitting of
characters may need to be done on another way. As already mentioned, if you want to use it for something different than the author did, you have to change many things. Maybe that much things that recoding it is eveneasier/better.
But because your knowledge in OCR is very limited, vour best way to go is using Tesseract or some similar ready to use OCRs. They will not work perfectly, too. But at least they will work better than this approach you presented.

Edit:
If you would provide some screenshots we may be able to help you more, otherwise this is a guessing game...
screenshots ? as in like... this one? since it waits for "WinActivate("Paint")" ....
09/15/2016 15:22 Shadow992#7
Quote:
Originally Posted by Darthed View Post
screenshots ? as in like... this one? since it waits for "WinActivate("Paint")" ....
This is something we can work with. At least now we know that you want to use it for Diablo 2.
Your script obviously does not find lines and/or characters to recognize. This can be due to invalid startX/startY coordinates or due to changed fonts, ...

Especially this looks quite "wrong" for me. I guess you did not change these coords:
PHP Code:
COORDINATES PIXEL HERE:
$Line GetLines6143318139$Pixel 
If you changed this and it still does not find any lines/characters, you have to debug it by yourself. The messagebox you see is this msgbox:
PHP Code:
MsgBox(""""$TimerDiff
So it basically only shows you how long this script ran (~3800ms = ~4s). However as you are not very used to programming, you should search for another solution or for someone who gonna code something for you. Maybe you are able to find someone on this board but I guess no.
10/06/2016 17:03 Darthed#8
Yeah thanks for the reply (yeah been busy for long time) now I actually know what the those actually lines do... I did try the app by changing the coordinates in $Line = GetLines part but it didn't really work out well it started running for way longer time(I basically put it on my default screen resolution) so the image search went completely slow mode and even if I narrowed down the coordinates to search for it was still not able to detect the text it might be because of my fonts but I am not sure if the reason is because my font in Diablo 2 is changed because I did try out custom fonts I was not sure if I successfully uninstalled it or not otherways this should definitely work with default diablo 2 fonts...

Also I am not exactly sure how to interpret the screen coordinates does this change work like this ??
Code:
$Line = GetLines( X, Y, X, Y, $Pixel )
then it should probably be like ( 0, 768, 1366,766) maybe ??

So I would really appreciate if somebody could test this script out see what is wrong with it or try to make a new similar one I really wanted to make sort of automatic cube recipe app where it would do certain actions based on the stats of an item... the hardest part I couldn't manage for me was making it speedy I wanted it to detect the characters on the screen as fast as possible and just get on with the rest of the functions...
So if somebody knowledgeable or with OCR experience revisits this it would be really awesome!