qwertylol Posted May 1, 2007 Share Posted May 1, 2007 I am trying to write an OCR app. It comes to me that knowing how many pixel a character has would help. the problem though, is I don't know how to count the number of pixel in a character. so, the definition ( input welcomed ) of a character's pixel is that the pixel must have a another pixel of the same color in the 8 adjecent squares. knowing that, how can the number of a character be calculated? Link to comment Share on other sites More sharing options...
evilertoaster Posted May 1, 2007 Share Posted May 1, 2007 (edited) basically that's pxielgetcolor() and to get a baseline color for the backround then compare it to the characters color pixels... Of course you need some shade variation to compensate for the shade in the backround ect, which is why OCR is a pain somtimes Edited May 1, 2007 by evilertoaster Link to comment Share on other sites More sharing options...
qwertylol Posted May 1, 2007 Author Share Posted May 1, 2007 oh, those are separate issues.one thing at a time I am just trying to find out how many pixel this character has. to find out, a script knowing how to count pixel is needed,that's the problem (OCR is fun, btw)http://robocup.org/ Link to comment Share on other sites More sharing options...
evilertoaster Posted May 1, 2007 Share Posted May 1, 2007 (edited) You can use the method i decribed, maybe you need some more detail, psuedocode is somthing like this- Func GetPixelsOfChar($top,$bottom,$left,$right,$backroundColor,$shadeVariation) for $top to $bottom for $left to $right if PixelGetColor($SomeX,$SomeY)-$backroundColor>$shadeVariation then AddPixelCount() EndIf Next Next EndFunc You loop though a certain area and count the number of pixels that are too differnt of a shade from the backround color. Edited May 1, 2007 by evilertoaster Link to comment Share on other sites More sharing options...
qwertylol Posted May 1, 2007 Author Share Posted May 1, 2007 how do I load a picture into a variable and then use pixelgetcolor to search for it? doesn't pixelgetcolor only work for pixel on the screen? Link to comment Share on other sites More sharing options...
evilertoaster Posted May 1, 2007 Share Posted May 1, 2007 correct. If you are trying to make ocr for somthing else (like a picture) you'll need functions that read pixels from the file... its a bit cirumstancial depending on what exactly you're trying to do. Is it just reading a .bmp file or a .jpeg or what? Link to comment Share on other sites More sharing options...
qwertylol Posted May 1, 2007 Author Share Posted May 1, 2007 correct. If you are trying to make ocr for somthing else (like a picture) you'll need functions that read pixels from the file... its a bit cirumstancial depending on what exactly you're trying to do. Is it just reading a .bmp file or a .jpeg or what?I am not sure which image format I use. becaues I think some of them compress stuff and that get into things.I need a format that doesn't change anything from the original screenshot.so, maybe reading from a bmp yes.that's one ocr,I need another ocr that can recognize shapes. I got the colors, but because I am trying to find out how that shape is placed, rotation, location, things, so I am not sure how I can write that one. Link to comment Share on other sites More sharing options...
evilertoaster Posted May 1, 2007 Share Posted May 1, 2007 pick a thread to work with, now you have two open about the same thing Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now