Demo entry 6354424

oc

   

Submitted by anonymous on Apr 06, 2017 at 19:04
Language: Objective-C. Code size: 1.1 kB.

G8Tesseract *tesseract = [[G8Tesseract alloc] initWithLanguage:@"chi_sim"];
    tesseract.delegate = self;
    if (charWhitelist&&charWhitelist.length>0) {
        tesseract.charWhitelist = @"0123456789X";
    }

    tesseract.image = self.processedImage;
    
    // Optional: Limit the area of the image Tesseract should recognize on to a rectangle
    tesseract.rect = [self convertToRealRect:scanRect forImage:self.processedImage];
    
    // Optional: Limit recognition time with a few seconds
    tesseract.maximumRecognitionTime = 2.0;
    
    // Start the recognition
    [tesseract recognize];
    
    // Retrieve the recognized text
    
    NSString*  recognizedText = [tesseract recognizedText];
    NSLog(@"Result:%@", [tesseract recognizedText]);

    
    if (recognizedText&&recognizedText.length>0) {
        
        NSArray *characterBoxes = [tesseract recognizedBlocksByIteratorLevel:G8PageIteratorLevelSymbol];
        NSDictionary* dict = @{@"recognizedText":[tesseract recognizedText],@"characterBoxes":characterBoxes};
        return dict;
    }

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).