Jump to content
Sign in to follow this  
qwertylol

how many pixel?

Recommended Posts

qwertylol

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?

Share this post


Link to post
Share on other sites
evilertoaster

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 by evilertoaster

Share this post


Link to post
Share on other sites
qwertylol

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/

Share this post


Link to post
Share on other sites
evilertoaster

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 by evilertoaster

Share this post


Link to post
Share on other sites
qwertylol

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´╝č

Share this post


Link to post
Share on other sites
evilertoaster

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?

Share this post


Link to post
Share on other sites
qwertylol

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.

Share this post


Link to post
Share on other sites
evilertoaster

pick a thread to work with, now you have two open about the same thing

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×