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