Halcon——獲取圓的直徑
阿新 • • 發佈:2018-12-13
read_image (Image, 'C:/Users/caiqi/Desktop/halcon計劃/測量/_4.png') get_image_size (Image, Width, Height) dev_open_window (0, 0, Width, Height, 'black', WindowHandle) set_display_font (WindowHandle, 16, 'mono', 'true', 'false') dev_set_draw ('margin') dev_display (Image) disp_continue_message (WindowHandle, 'black', 'true') stop () dev_set_colored (12) dev_set_line_width (2) dev_set_draw ('fill') fast_threshold (Image, Region, 200, 255, 20) connection (Region, ConnectedRegions) select_shape (ConnectedRegions, SelectedRegions, 'area', 'and', 150, 99999) dev_display (Image) dev_display (SelectedRegions) disp_continue_message (WindowHandle, 'black', 'true') stop () boundary (SelectedRegions, RegionBorder, 'inner_filled') dev_clear_window () dev_display (RegionBorder) disp_continue_message (WindowHandle, 'black', 'true') stop () edges_sub_pix (Image, Edges, 'canny', 1, 10, 40) fit_circle_contour_xld (Edges, 'algebraic', -1, 0, 0, 3, 2, Row, Column, Radius, StartPhi, EndPhi, PointOrder) gen_circle_contour_xld (ContCircle, Row, Column, Radius, 0, 6.28318, 'positive', 1)