tags:

views:

39

answers:

1

i am using ocr code but i am not getting any value while scanning value of cc and text are void means i cant see any output what i am doing wrong here??

- (NSString *) ocrImage: (UIImage *) uiImage
{

 //code from http://robertcarlsen.net/2009/12/06/ocr-on-iphone-demo-1043

 CGSize imageSize = [uiImage size];
 double bytes_per_line = CGImageGetBytesPerRow([uiImage CGImage]);
 double bytes_per_pixel = CGImageGetBitsPerPixel([uiImage CGImage]) / 8.0;

 CFDataRef data = CGDataProviderCopyData(CGImageGetDataProvider([uiImage CGImage]));
 const UInt8 *imageData = CFDataGetBytePtr(data);

 // this could take a while. maybe needs to happen asynchronously.
  text = tess->TesseractRect(imageData,(int)bytes_per_pixel,(int)bytes_per_line, 0, 0,(int) imageSize.height,(int) imageSize.width);

 // Do something useful with the text!
 NSLog(@"Converted text: %@",[NSString stringWithCString:text encoding:NSUTF8StringEncoding]);
 NSString *cc=[NSString stringWithCString:text ];// nothing
NSLog(@"secess %@",cc); // nothing





// const char *sqlStatement = [text UTF8String];//"SELECT * FROM wateat_tbl where name like '%love%' or desc like '%love%'";//limit 0,40
 //NSLog(@"query %c", sqlStatement);




 return [NSString stringWithCString:text encoding:NSUTF8StringEncoding];
}
A: 

You have height and width the wrong way around.

tc.