halcon易错系列—读取区域算子read_region

halcon有些算子很容易出错,针对混编和引擎两种方式都是不容易检查出来错误,毕竟halcon IDE环境有他的特定性,比如:

一、算子说明

read_region( : Region : FileName : )

在混编中直接读取本地region,很容易读取失败,但是用halcon的IDE环境不会出现读取失败问题,究其原因,在Attention

 

Attention

The clipping based on the current image format is set via the operator set_system('clip_region',<'true'/'false'>). Consequently, if no image of suffcient size has been created before the call to read_region, set_system('clip_region','false') should be called before calling read_region to ensure that the region is not being clipped.

基于当前图像操作时,设置系统函数为:set_system('clip_region',<'true'/'false'>)

如果在调用read_region之前没有创建图像,则在调用read_region之前应调用:set_system('clip_region','false') ,以确保不剪裁区域。

 

二、测试

通过测试发现:

1、如果先使用read_image,再使用read_region,则可以正常读取region

2、如果先使用read_region,再使用read_image,则很可能读取失败,这种情况给出两个建议:

1)尽量按照方法1进行读取region

2)在混编或脚本最前面使用set_system('clip_region','false'),这个暂时没有测试,感兴趣的同学可以测试下

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章