Halcon - 测量 - 轮廓到线的距离


Result

Explanation

唯一需要注意的点就是 distance_lc 这个算子测量的是正交位置的点矩

count_obj (UnionContours, CountObj)
tuple_length (RowBegin, CountTuple)
if (CountObj == CountTuple)
    for Index := 1 to CountObj by 1
        dev_display (ImageReduced)
        select_obj (UnionContours, ObjectSelected2, Index)
        * 测量实际轮廓与标准线的距离
        distance_lc (ObjectSelected2, RowBegin[Index-1], ColBegin[Index-1], RowEnd[Index-1], ColEnd[Index-1], DistanceMin, DistanceMax)
        * 显示测量结果
        disp_message (WindowHandle, 'Min: ' + DistanceMin + '\nMax: ' + DistanceMax, 'window', -1, -1, 'black', 'true')
        * 显示实际轮廓
        dev_set_color ('red')
        dev_display (ObjectSelected2)
        * 显示标准线
        dev_set_color ('green')
        disp_line (WindowHandle, RowBegin[Index-1], ColBegin[Index-1], RowEnd[Index-1], ColEnd[Index-1])
        * 等待2s
        wait_seconds (2)
    endfor
endif


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM