C++ 调用 Halcon 时大尺寸操作无效问题的解决方案
Yiwei Zhang
·
2022-12-08
·
via 又见苍岚
C++ 调用 Halcon 时偶现大尺寸的算子操作无效问题,本文记录解决方案。
问题复现
- 在 C++ 调用 Halcon 程序中,创建如下尺寸矩形
1 2 3 4 5 6 7 8 9 10 11 12
| HObject Rectangle; GenRectangle1(&Rectangle, 234, 31, 1534, 424)HTuple test; RegionFeatures(ho_roi, "width", &test); cout << test[0].D() <<endl; RegionFeatures(ho_roi, "area", &test); cout << test[0].D() << endl; RegionFeatures(ho_roi, "row1", &test); cout << test[0].D() << endl; RegionFeatures(ho_roi, "height", &test); cout << test[0].D() << endl;
|
- 正常运行时输出的都是正常的数据,出现问题时输出全为 0
问题原因
- 原因不明 ……
- 感觉的原因是由于某些操作尺寸较大,Halcon 默认画布装不下导致的 bug
解决方案
- 在代码中显示定义较大的画布大小,例如加入如下代码:
1 2
| HalconCpp::SetSystem("width", 8000); HalconCpp::SetSystem("height", 8000);
|
文章链接:
https://www.zywvvd.com/notes/coding/halcon/halcon-cpp-bug/halcon-cpp-bug1/
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。