halcon通过点拟合圆形,鼠标选点
生活随笔
收集整理的這篇文章主要介紹了
halcon通过点拟合圆形,鼠标选点
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
原圖
源碼
read_image (Image, '0.bmp') dev_clear_window () dev_open_window_fit_image (Image, 0, 0, -1, -1, WindowHandle) dev_display (Image)binary_threshold (Image, Region, 'max_separability', 'dark', UsedThreshold) connection (Region, ConnectedRegions) select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 100, 100000)gen_empty_obj (CircleRegion) PointNumber:=0 while (PointNumber<8)draw_point (WindowHandle, Row, Column)gen_region_points (Region1, Row, Column)select_shape_proto (SelectedRegions, Region1, SelectedRegions1, 'overlaps_abs', 1, 5)count_obj (SelectedRegions1, Number)if(Number>0)concat_obj (CircleRegion, SelectedRegions1, CircleRegion)PointNumber:=PointNumber+1endif endwhilesmallest_circle (CircleRegion, Row1, Column1, Radius)pts_to_best_circle (Circle, Row1, Column1, RowCenter, ColCenter, Radius)dev_display (Image)dev_display (Circle)pts_to_best_circle 函數
RowCenter := 0 ColCenter := 0 Radius := 0gen_empty_obj (Circle) tuple_length(Cols, Length)if (Length>2)gen_contour_polygon_xld(Contour, Rows, Cols)fit_circle_contour_xld (Contour, 'geotukey', -1, 0, 0, 3, 2, RowCenter, ColCenter, Radius, StartPhi, EndPhi, PointOrder)tuple_length(StartPhi, Length1)if(Length1<1)return()endifgen_circle_contour_xld(Circle, RowCenter, ColCenter, Radius, StartPhi, EndPhi, PointOrder, 1)endif return ()處理結果
總結
以上是生活随笔為你收集整理的halcon通过点拟合圆形,鼠标选点的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: lm opencv 算法_LM算法
- 下一篇: 从零手写VIO(三)——LM算法