ハルコンライン検出

1. Halcon で最も一般的に使用される直線検出オペレーターである add_metrology_object_line_measure は、Halcon パッケージ化されたモデルを使用して、直線だけでなく円、楕円、長方形なども検出します。残りのライン検出演算子は以下に紹介されています。
スケルトン (SelectedRegions, Skeleton)
gen_contours_skeleton_xld (Skeleton, Contours, 5, 'filter')
fit_line_contour_xld (Contours, 'tukey', -1, 0, 5, 2, RowBegin, ColBegin, RowEnd, ColEnd, Nr, Nc, Dist) gen と連携する必要があります。 _region_line (RegionLines、RowBegin、ColBegin、RowEnd、ColEnd) およびその他の演算子は直線にフィットし
ます

2. 演算子は以下の通りです

  1. バンドパスイメージ

機能: バンドパスフィルターを使用してエッジを抽出します。

  1. 線の色

機能: 色の線とその幅を検出します。

  1. ラインファセット

機能: サーフェス モデルを使用して線を検出します。

  1. 線ガウス

機能: 線とその幅を検出します。
3. ケースの説明
3.1 Bandpass_image

dev_close_window ()
dev_open_window (0, 0, 512, 512, ‘black’, WindowHandle)
dev_set_draw (‘margin’)
read_image (Image, ‘C:/Users/Dell/Desktop/2022_11_28_15_44_14_0588_id_36429.bmp’)
median_rect (Image, ImageMedian, 9, 9)
bandpass_image (ImageMedian, ImageBandpass, ‘lines’)
threshold (ImageBandpass, Regions, 21, 255)
connection (Regions, ConnectedRegions)
select_shape (ConnectedRegions, SelectedRegions, ‘area’, ‘and’, 536.53, 1000)
skeleton (SelectedRegions, Skeleton)
gen_contours_skeleton_xld (Skeleton, Contours, 5, ‘filter’)
fit_line_contour_xld (Contours, ‘tukey’, -1, 0, 5, 2, RowBegin, ColBegin, RowEnd, ColEnd, Nr, Nc, Dist)
gen_region_line (RegionLines, RowBegin, ColBegin, RowEnd, ColEnd)
元の画像
ここに画像の説明を挿入
Bandpass_image 結果の画像
ここに画像の説明を挿入
フィッティング直線
ここに画像の説明を挿入
3.2 Lines_color

read_image (Image, 'cable' + J)
dev_display (Image)
disp_message (WindowHandle, 'Color image', 'window', 12, 12, 'black', 'true')
disp_continue_message (WindowHandle, 'black', 'true')
stop ()
lines_color (Image, Lines, 3.5, 0, 12, 'true', 'false')
select_contours_xld (Lines, LongLines, 'contour_length', 450, 100000, 0, 0)
原图

ここに画像の説明を挿入
結果 図
ここに画像の説明を挿入
3.3 Lines_facet
read_image (Bk45, 'bk45')
dev_set_coloured (6)
Lines_facet (Bk45, Lines, 5, 3, 5, 'light')
元の画像
ここに画像の説明を挿入
の結果 図
ここに画像の説明を挿入
3.4 Lines_gauss
dev_update_off ()
dev_close_window ()
dev_close_window ()
*

  • 航空写真の読み取り
    read_image (Image, 'mreut4_3')
    dev_open_window_fit_image (Image, 0, 0, -1, -1, WindowHandle1)
    set_display_font (WindowHandle1, 16, 'mono', 'true', 'false') dev_display (Image)
    disp_message
    (WindowHandle1, '航空写真から道路を抽出', 'window', 12, 12, 'black', 'true') disp_ continue_message (WindowHandle1, 'black', 'true') stop
    (
    )
  • 画像をセグメント化し、ドメインの
    しきい値を減らします (Image、Region、160、255)
    reduce_domain (Image、Region、ImageReduced)
  • 道路の中心を表す線を検出
    MaxLineWidth := 5
    Contrast := 70
    Calculate_lines_gauss_parameters (MaxLineWidth, Contrast, Sigma, Low, High)
    Lines_gauss (ImageReduced, RoadCenters, Sigma, Low, High, 'light', 'true', 'bar-shape', 'true')

元の画像
ここに画像の説明を挿入

結果グラフ
ここに画像の説明を挿入

おすすめ

転載: blog.csdn.net/Douhaoyu/article/details/128206473