By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,598 Members | 1,508 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,598 IT Pros & Developers. It's quick & easy.

Rotate, crop and extract from image

P: 145
Hi, I have an image similar to a clock, with numbers and letters going around in a circle. I need to extract the numbers and letters from the image and have them print out in a straight line and in order from inner circle working out. Here is an example of the image:
Since the characters in the image will be different each time I am starting with a screenshot, then I think I should probably crop at the "12 O'clock" position and extract those figures, then rotate the image about 10 degrees and do the same thing, etc until the image has rotated 360 degrees and I have all of the characters.
I did try a portion of this by cropping the top 2 chars in paint and saving the image and:

Expand|Select|Wrap|Line Numbers
  1. import Image
  2. from pytesser import *
  4. image ="image.jpg")
  5. print image_to_string(image)
That worked great but I need to rotate as well. The following code doesn't work right but it has some aspects I need:

Expand|Select|Wrap|Line Numbers
  1. import Image
  2. import ImageGrab
  3. from pytesser import *
  5.  # take screenshot 
  6. image = ImageGrab.grab()
  7.  #haven't found the exact coordinates yet for box, just an example
  8. box = (100,100,400,400) :
  9. im = image.crop(box)
  10. # rotate image 10 degrees
  11. im1 = im.rotate(10)
Well, you can see I don't know what to do from there, or how to keep cropping and rotating, I know I need a loop, just not sure how to implement it.
Oct 30 '08 #1
Share this Question
Share on Google+
1 Reply

P: 145
I should also mention that the crop is an up and down rectangle so I can capture 2 chars at once similar to this:
Oct 30 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.