- dev_open_window (0, 0, 600, 512, 'black', WindowHandle)
- set_display_font (WindowHandle, 16, 'mono', 'true', 'false')
- read_image(Image, 'D:/Desktop/iamge71/Snipaste_2024-07-09_19-08-46.jpg')
- rgb1_to_gray(Image, GrayImage)
- threshold(GrayImage, Region, 128, 255)
- gen_contour_region_xld(Region, Contoursc, 'border_holes')
- length_xld(Contoursc, Length)
- tuple_sort_index(Length, Indices)
- select_obj(Contoursc, InnerContour, Indices[0]+1)
- select_obj(Contoursc, OuterContour, Indices[1]+1)
- distance_contours_xld (InnerContour, OuterContour, OuterContourWithWidth, 'point_to_segment')
- get_contour_attrib_xld (OuterContourWithWidth, 'distance', FrameWidth)
- tuple_max(FrameWidth, Max)
- tuple_min(FrameWidth,Min)
- tuple_mean(FrameWidth, Mean)
- disp_image(GrayImage, WindowHandle)
- disp_message (WindowHandle, ['最大值:'+Max,'平均值:'+Mean,'最小值:'+Min], 'window', 12, 12, ['red','black','blue'], 'true')
复制代码
|