我在iOS设备上使用tesseract,它一直运行正常,直到最近才开始崩溃。我一直在测试相同的图像,在此之前我连续工作了75次。我唯一能想到的是我从iOS设备上删除了应用程序,然后通过Xcode再次运行它。
我远不是一个关于tesseract的专家,我真的可以使用一些关于下一步该做什么的建议,因为我不能再阅读图像,所以我放弃浪费的所有时间都会令人失望。谢谢
这是此方法中的tesseract文件
时出现的崩溃错误- (BOOL)recognize
{
int returnCode = _tesseract->Recognize(NULL);// here is where the arrow points on the crash
return (returnCode == 0) ? YES : NO;
}
这是Alex G的一个老问题,我没有看到任何答案。 有没有人找到根本原因和解决方案?请指教。非常感谢。
答案 0 :(得分:1)
我希望您使用AVCaptureSession
连续拍照并在进行一些图像处理后传递给tesseract。
所以在将UIImage传递给tesseract进行识别之前,你应该检查一下:
CGSize size = [image size];//your image
int width = size.width;
int height = size.height;
if (width < 100 || height < 50) {//UIImage must contain some some size
//Consider as invalid image
return;
}
//This condition is not mandatory.
uint32_t* _pixels = (uint32_t *) malloc(width * height * sizeof(uint32_t));
if (!_pixels) {
return;
//Consider as invalid image
}