0

I've managed to get the OpenALPR library working within my app when passing a static image as per the example, but when using an image from the camera recognition is unsuccessful every time - is there something different about the image thats returned from a AVCaptureSession()?

Here's the code I'm using to get the image:

NSData* imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:sampleBuffer];
UIImage* image = [UIImage imageWithData:imageData];
cv::Mat cvImage = [self cvMatFromUIImage:image];
[self.plateScanner scanImage:cvImage onSuccess:^(NSArray * results) {
// Never suceeds
rmaddy
  • 314,917
  • 42
  • 532
  • 579
XCode Warrier
  • 765
  • 6
  • 20

1 Answers1

0

I am using below code.

self.plateScanner = [[PlateScanner alloc] init];
self.plates = [[NSMutableArray alloc] init];

cv::Mat image1  = [self cvMatFromUIImage:chosenImage];

[self.plateScanner
 scanImage:image1
 onSuccess:^(NSArray * results) {
     [self.plates addObjectsFromArray:results];
 }
 onFailure:^(NSError * error) {
     dispatch_async(dispatch_get_main_queue(), ^{
         NSLog(@"Error: %@", [error localizedDescription]);
         [self showErrorDialogWithTitle:@"Error with scan."
                                message:[NSString stringWithFormat:@"Unable to process license plate image: %@", [error localizedDescription]]];
     });
 }];

This is working fine for me. Did you alloc init "self.plateScanner" ?

Ekta Padaliya
  • 5,743
  • 3
  • 39
  • 51
  • Maybe you can help to do the same thing but with image stream? http://stackoverflow.com/questions/41997900/how-to-convert-cmsamplebuffer-to-stdvectorchar – Alexander Yakovlev Feb 03 '17 at 11:44