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'),這個暫時沒有測試,感興趣的同學可以測試下