hi,
im using tesseract on my iPhone app.

i want to stop/cancel the ocr process. is there a way to do it?
i wrote in backPressed method:
tesseract->Clear();
tesseract->End();

but when the ocr starts and i hit the back button, it crashes, cos it is 
still OCRing.

here is my iOS code:

- (void)processOcrAt:(UIImage *)image
{
    [self setTesseractImage:image];

    //char* utf8Text = tesseract->GetUTF8Text();
    //[self performSelector:@selector(ocrProcessingFinished:) 
withObject:[NSString stringWithUTF8String:utf8Text]];
    //dispatch_queue_t queue = dispatch_queue_create("com.awesome", 0);

    main = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
    dispatch_async(main, ^{
        tesseract->Recognize(NULL);
        char* utf8Text = tesseract->GetUTF8Text();
        [self performSelectorOnMainThread:@selector(ocrProcessingFinished:)
                               withObject:[NSString 
stringWithUTF8String:utf8Text]
                               waitUntilDone:NO];
        delete [] utf8Text;
    });


}

-(IBAction)backPressed:(id)sender{
    dispatch_release(main);
    tesseract->Clear();
    //tesseract->End();

    delete tesseract;
    tesseract = nil;
    delete pixels;
    [self.navigationController popViewControllerAnimated:YES];
}

-- 
You received this message because you are subscribed to the Google
Groups "tesseract-ocr" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/tesseract-ocr?hl=en

Reply via email to