gpt4 book ai didi

ios - Tesseract 崩溃了

转载 作者:行者123 更新时间:2023-11-29 12:56:49 24 4
gpt4 key购买 nike

enter image description here

我在我的 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 提出的一个老问题,我没有看到任何答案。有没有人找到根本原因和解决方案?请指教。非常感谢。

最佳答案

我希望您正在使用 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

}

关于ios - Tesseract 崩溃了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20876241/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com