122 Star 1.2K Fork 393

明月心 / PaddleOCRSharp

 / 详情

PaddleOCREngine.dll方法引用出错

已完成
创建于  
2022-09-02 15:31

当在Csharp工程中引用方法public OCRResult DetectText(string imagefile),偶尔会提示“引用外部组件错误”,定位出错行语句:int textCount = Detect(Engine, imagefile, out ptrResult)
出错情况重现,使用同步运行结束后,再使用异步委托出现机率就增大,反之也是,请问有遇到过不,有什么解决方法???

追查看来源为以下:
[DllImport("PaddleOCR.dll", CallingConvention = CallingConvention.Cdecl, SetLastError = true)]
internal static extern int Detect(IntPtr engine, string imagefile, out IntPtr result);

public OCRResult DetectText(string imagefile)
{
if (!System.IO.File.Exists(imagefile)) throw new Exception($"文件{imagefile}不存在");
IntPtr ptrResult;
int textCount = Detect(Engine, imagefile, out ptrResult);
if (textCount <= 0) return new OCRResult();
if (ptrResult == IntPtr.Zero) return new OCRResult();
OCRResult oCRResult = new OCRResult();
IntPtr ptrFree = ptrResult;
...........

评论 (1)

Rocky 创建了任务
Rocky 修改了描述
Rocky 修改了描述
Rocky 修改了描述
明月心 任务状态待办的 修改为进行中
展开全部操作日志

之前版本不支持异步调用,2.0.4版本开始支持异步、多线程调用。

明月心 任务状态进行中 修改为已完成

登录 后才可以发表评论

状态
负责人
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
参与者(2)
9997078 raoyutian 1682580822
C#
1
https://gitee.com/raoyutian/PaddleOCRSharp.git
git@gitee.com:raoyutian/PaddleOCRSharp.git
raoyutian
PaddleOCRSharp
PaddleOCRSharp

搜索帮助