Jump to content

how many pixel?


Recommended Posts

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

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...