整体运行的时候message变量是空的,单步运行提示有错误不知道怎么改
- read_image (Image, 'C:/Users/lenovo/Desktop/机器视觉实验/实验五/52.jpg')
- get_image_size (Image, Width, Height)
- *圆查找ROI
- CircleInitRow:=[227,231,227,227]
- CircleInitColumn:=[248,642,957,1230]
- CircleInitRadius:=[52,48,34,30]
- *创建测量句柄
- create_metrology_model (MetrologyHandle)
- *将圆形或圆弧型的测量对象(ROI)添加到测量模型
- add_metrology_object_circle_measure (MetrologyHandle, CircleInitRow, CircleInitColumn, \
- CircleInitRadius, 10, 2,1, 30, 'num_measures', 30, Index)
- set_metrology_model_image_size (MetrologyHandle, Width, Height)
- *设置测量模型中测量对象参数,像卡尺大小、边缘极性、边缘阈值等参数
- set_metrology_object_param(MetrologyHandle, Index, 'measure_transition', 'negative')
- *测量并拟合一个测量模型中所有测量对象的几何形状
- apply_metrology_model (Image, MetrologyHandle)
- *获取测量模型的测量结果
- get_metrology_object_result (MetrologyHandle, Index, 'all', 'result_type', 'all_param', Circle)
- *获取测量对象的结果轮廓,测量模型拟合出来的圆
- get_metrology_object_result_contour (Contours, MetrologyHandle, Index, 'all', 1.5)
- *获取测量模型中测量对象的测量区域和边缘点位置的坐标
- get_metrology_object_measures (Contour, MetrologyHandle, 'all', 'all', Row1, Column1)
- *渲染边缘点
- gen_cross_contour_xld (Cross, Row1, Column1, 6, 0.785398)
- Color := ['gray','cyan','green']
- dev_display (Image)
- dev_set_line_width (1)
- dev_set_color (Color[0])
- dev_display (Contour)
- dev_set_color (Color[1])
- dev_display (Cross)
- dev_set_line_width (2)
- dev_set_color (Color[2])
- dev_display (Contours)
- stop()
- *销毁测量句柄
- clear_metrology_model (MetrologyHandle)
- dev_open_window (0, 0, Width, Height, 'black', WindowHandle)
- message1 :='CenterRow:'+ Circle[0]+','+'CenterColumn:'+ Circle[1]+','+'Radious'+ Circle[2]
- message2 :='CenterRow:'+ Circle[3]+','+'CenterColumn:'+ Circle[4]+','+'Radious'+ Circle[5]
- message3 :='CenterRow:'+ Circle[6]+','+'CenterColumn:'+ Circle[7]+','+'Radious'+ Circle[8]
- message4 :='CenterRow:'+ Circle[9]+','+'CenterColumn:'+ Circle[10]+','+'Radious'+ Circle[11]
- set_display_font (WindowHandle, 20, 'sans', 'true', 'false')
- disp_message (WindowHandle,message1,'window', 0, -1, 'black', 'flase')
- disp_message (WindowHandle,message2,'window', 20, -1, 'black', 'false')
- disp_message (WindowHandle,message3,'window', 40, -1, 'black', 'false')
- disp_message (WindowHandle,message4,'window', 60, -1, 'black', 'false')
复制代码
9.20.hdev
(5.58 KB, 下载次数: 3)
|