0

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?

Malinko
  • 124
  • 11

1 Answers1

1

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");
Vladimir Perković
  • 1,351
  • 3
  • 12
  • 30