halcon知识:hough变换检出图像的直线
生活随笔
收集整理的這篇文章主要介紹了
halcon知识:hough变换检出图像的直线
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
?一、說明
用hough變換查找直線;hough的原理見文章:??圖像處理:Hough變換原理分析
此文專門介紹halcon的具體算子實現。?
二、示例代碼
* Detect lines in an image with the help of the Hough transform * and return it in HNF * read_image (Image, 'd:/images/reglist/patty.jpg') * Detect edges (amplitude) using the Sobel operator sobel_amp (Image, EdgeAmplitude, 'thin_sum_abs', 3) dev_set_color ('red') threshold (EdgeAmplitude, Region, 10, 255) hough_lines (Region, 4, 100, 5, 5, Angle, Dist) dev_set_color ('blue') * Store input lines described in HNF gen_region_hline (Regions, Angle, Dist)三、相關算子?
- ?sobel_amp (Image, EdgeAmplitude, 'thin_sum_abs', 3)
用sobel算子進行邊緣提取。
- hough_lines(RegionIn : : AngleResolution, Threshold, AngleGap, DistGap : Angle, Dist)
?????????算子 hough_lines 允許選擇區域中的線狀結構,因此不必連接線的各個點。該過程基于霍夫變換。這些線在 HNF 中返回,即按其法線向量的方向和長度。
????????參數 AngleResolution 定義了關于角度確定的精確度。它等于 1 / AngleResolution 度數。
????????參數Threshold決定了一條線的假設至少必須支持原始區域的多少點才能被接收到輸出中。
????????參數 AngleGap 和 DistGap 定義霍夫圖像中每個點的鄰域,以確定局部最大值。這些行以 HNF 形式返回。
- ?gen_region_hline (:Regions: Angle, Dist:)
根據給定的角度Angle,原點矩Dist畫出?一個一個的直線。
四、示例和效果
?結果:
?
總結
以上是生活随笔為你收集整理的halcon知识:hough变换检出图像的直线的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: pyqt5教程6:信号和事件
- 下一篇: pyqt5知识:如何接受密码输入?