本文最后更新于:2023年12月5日 下午

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/


“觉得不错的话,给点打赏吧 ୧(๑•̀⌄•́๑)૭”

微信二维码

微信支付

支付宝二维码

支付宝支付

C++ 调用 Halcon 时大尺寸操作无效问题的解决方案
https://www.zywvvd.com/notes/coding/halcon/halcon-cpp-bug/halcon-cpp-bug1/
作者
Yiwei Zhang
发布于
2022年12月8日
许可协议