0

How can I get the texts presented on an image ?

Description : "I am developing one application which needs to get the text presented on an Image and show the text in an another view after putting the texts in to some frames."

EDIT : From this I'm getting some Values and also the ".png" but the characters I am getting is like ASCII value or something.

UIImage*img=[UIImage imageNamed:@"btn_reset.png"]; NSData *dataObj = UIImagePNGRepresentation(img); NSString*str= [[NSString alloc] initWithData:dataObj encoding:NSASCIIStringEncoding]; printf("Image is %s",[str UTF8String]);

Any tutorial/link/solution would be very helpful.

Thank You !

Akshay
  • 2,973
  • 6
  • 43
  • 75

3 Answers3

4

I couldn't understand the question clearly, but I think you are referring to OCR. One of the main open-source lib for this is: Tesseract

Some one has ported this lib for ios. You can get the code from: https://github.com/rcarlsen/Pocket-OCR/

Vikram.exe
  • 4,565
  • 3
  • 29
  • 40
2

you might get solution from following link: Is there any iphone Class that converts images to text format?

Community
  • 1
  • 1
DivineDesert
  • 6,924
  • 1
  • 29
  • 61
1

If you just want to print the string

UIImage*img=[UIImage imageNamed:@"btn_reset.png"];
NSData *dataObj = UIImagePNGRepresentation(img); 
NSString*str= [[NSString alloc] initWithData:dataObj encoding:NSASCIIStringEncoding];        
NSLog("Image is %@",str);

If you still dont get it change the encoding

visakh7
  • 26,380
  • 8
  • 55
  • 69