英文:
Halcon.NET region loses data / Region is cropped unintentionally
问题
我在Halcon.NET中遇到了奇怪的行为,我正在尝试理解。
我有大约100个区域,我想合并重叠的区域。
要合并这些区域,我使用Union1(),然后使用Connection()来分离不重叠的区域。
但在生成的区域中,有很多遗失的区域。经过一些故障排除,我注意到只有那些适合标准512*512图形窗口的区域会出现在结果区域中,但这是Halcon.NET,所以我没有图形窗口。
如果我使用这行代码:HOP.GenImageConst(out HO unusedImage, "byte", 1200, 1000);首先,一切都正常。生成的空图像在应用程序中没有被使用。
所以这会丢失数据:
HOperatorSet.Union1(Regions_eroded, out HO Regions_unified)
HOperatorSet.Connection(Regions_unified, out HO Regions_connected);
而这个不会:
HOperatorSet.GenImageConst(out HO unusedImage, "byte", 1200, 1000); // 创建未使用的图像
HOperatorSet.Union1(Regions_eroded, out HO Regions_unified)
HOperatorSet.Connection(Regions_unified, out HO Regions_connected);
这是一个bug吗?我做错了什么吗?还是出于某种原因应该是这样?
英文:
I encountered strange behaviour in Halcon.NET that I am trying to understand.
I have ~100 regions and I want to merge the ones that overlap.
To merge the regions I use Union1() and then Connection() to separate non-overlapping ones.
But in the resulting region there are a lot of regions missing. After some troubleshooting I noticed that only the regions that would fit in the standard 512*512 graphics window would be in the result regions, but this is Halcon.NET so I dont have a graphics window.
If I use the line: HOP.GenImageConst(out HO unusedImage, "byte", 1200, 1000); first, everything works fine. The generated empty image is not used in any way in the application.
So this loses data:
HOperatorSet.Union1(Regions_eroded, out HO Regions_unified)
HOperatorSet.Connection(Regions_unified, out HO Regions_connected);
And this doesnt:
HOperatorSet.GenImageConst(out HO unusedImage, "byte", 1200, 1000); // creating unused image
HOperatorSet.Union1(Regions_eroded, out HO Regions_unified)
HOperatorSet.Connection(Regions_unified, out HO Regions_connected);
Is this a bug, am I doing something wrong, or is this how it's supposed to be for some reason?
答案1
得分: 1
在Halcon中,用于创建区域的默认窗口大小为512x512。
要解决此问题,您可以通过以下方式简单地关闭窗口外的区域裁剪:
set_system ('clip_region', 'false')
或在C#中:
HSystem.SetSystem("clip_region", "false");
英文:
Default window size for region creation is 512x512 in Halcon.
To work around this, you can simply turn off region clipping outside of this window with:
set_system ('clip_region', 'false')
Or in C#:
HSystem.SetSystem("clip_region", "false");
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论