469,625 Members | 1,089 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,625 developers. It's quick & easy.

Rotate, crop and extract from image

Thekid
145 100+
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:
http://img296.imageshack.us/my.php?image=screenimageqk9.jpg
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 *
  3.  
  4. image = Image.open("image.jpg")
  5. print image_to_string(image)
  6.  
  7.  
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 *
  4.  
  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)
  12.  
  13.  
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
1 9139
Thekid
145 100+
I should also mention that the crop is an up and down rectangle so I can capture 2 chars at once similar to this:
http://img112.imageshack.us/my.php?image=screenimage2tw7.jpg
Oct 30 '08 #2

Post your reply

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

Similar topics

5 posts views Thread by Kevin Smith | last post: by
6 posts views Thread by Leo Koolsbergen | last post: by
7 posts views Thread by Showjumper | last post: by
3 posts views Thread by ACaunter | last post: by
17 posts views Thread by santel_helvis | last post: by
1 post views Thread by iwdu15 | last post: by
8 posts views Thread by Samuel Shulman | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.