开发者

Image to Text (iPhone)

开发者 https://www.devze.com 2023-03-08 11:44 出处:网络
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 th

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 !


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/


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号