View Single Post
Join Date: Nov 2008
Posts: 43
Reputation: kiddo39 is an unknown quantity at this point 
Solved Threads: 0
kiddo39 kiddo39 is offline Offline
Light Poster

counting pixels in an image(ocr)

 
0
  #1
Dec 3rd, 2008
I have a small image with a black background and red lines in it and I need to count the red pixels. I know I need PIL, but I'm not sure which method to use. Then once I have the counts I need to equate them to a character, so if the red lines in the image form a circle and have x amount of red pixels, its = '0', and if the image forms a straight line and is found to have x amount of pixels it's = 'l'.

  1. import Image
  2. #mypic.jpg is the circle
  3. im=image.open("mypic.jpg")
  4. im.getcolors(R)
  5. # if statement here

Any suggestions?
Reply With Quote