read_image (Image, 'C:/Users/22967/Desktop/晶圆找位置/0.bmp')
dev_close_window ()
dev_open_window_fit_image (Image, 0, 0, -1, -1, WindowHandle)
dev_display (Image)binary_threshold (Image, Region1, 'max_separability', 'dark', UsedThreshold)
connection (Region1, ConnectedRegions)
select_shape (ConnectedRegions, SelectedRegions1, ['area','circularity'], 'and', [1000,0.7624], [100000,1])smallest_circle (SelectedRegions1, Row3, Column3, Radius1)
gen_circle (Circle2, Row3, Column3, Radius1)while (1)dev_display (Image)dev_display (Circle2)draw_point (WindowHandle, Row4, Column4)gen_region_points (Region2, Row4, Column4)select_shape_proto (Circle2, Region2, SelectedRegions2, 'overlaps_abs', 1, 5)count_obj (SelectedRegions2, Number)if(Number>0)smallest_circle (SelectedRegions2, Row5, Column5, Radius2)MetrologyMeasuresCircle (Image, Contour, Row5, Column5, Radius2, Parameter1)endifdev_display (Image)dev_display (Circle2)draw_point (WindowHandle, Row6, Column6)gen_region_points (Region3, Row6, Column6)select_shape_proto (Circle2, Region3, SelectedRegions3, 'overlaps_abs', 1, 5)count_obj (SelectedRegions3, Number)if(Number>0)smallest_circle (SelectedRegions3, Row7, Column7, Radius3)MetrologyMeasuresCircle (Image, Contour, Row7, Column7, Radius3, Parameter2) endifdev_display (Image)dev_display (SelectedRegions2)dev_display (SelectedRegions3)distance_pp (Parameter1[0], Parameter1[1], Parameter2[0], Parameter2[1], Distance)disp_message (WindowHandle, '距离:'+Distance, 'window', 100, 100, 'black', 'true')stop ()
endwhile
MetrologyMeasuresCircle 函数
create_metrology_model (MetrologyHandle)
add_metrology_object_circle_measure (MetrologyHandle, Row, Column, Radius, Radius/10, Radius/60, 1, 20, ['measure_distance','min_score'], [Radius/30,0.2], Index1)
apply_metrology_model (Image, MetrologyHandle)
gen_empty_obj (Contours)
get_metrology_object_measures (Contours, MetrologyHandle, 'all', 'all', Row1, Column1)
get_metrology_object_result (MetrologyHandle, 'all', 'all', 'result_type', 'all_param', Parameter)
get_metrology_object_result_contour (Contour, MetrologyHandle, 'all', 'all', 1.5)
return ()
处理效果