**
**
1.创建测量模型
2.设置测量图像大小
3.阈值处理(二值化)连通区域,特征选择
4.获取圆的中心和面积
5.生成圆,添加圆到测量模型里
6.测量并拟合几何形状
7.获取测量模型里的测量轮廓
8获取测量结果
9.显示测量结果
10.清除测量模型
**
**
1.create_metrology_model(:::MetrologyHandle)
创建一个测量的模型
2.set_metrology_model_image_size(::MetrologyHandle,width,height:)
设置测量图像的大小
3.threshold()阈值图像处理
4.Connection()将区域联通
5.select_shape()特征选择,选择出需要的图形
6.area_center(Regions:::area,row,column)
获取圆的中心面积
7.gen_circle(:circle:row,column,radium:)
生成圆(可以不用)
8.add_metrology_object_circle_measure(::MetrologyHandle,row,column,radius,measurelength1,measurelength2,measuresigma,measurethreshold,genparamname,genparamvalue:index)
添加圆到测量模型
MetrologyHandle:测量模型句柄
Row:圆心纵坐标
Column:圆心横坐标
Radius:半径
measurelength1:指定垂直于边界的测量区域一半的宽度
measurelength2:指定垂直于边界的测量区域一半的宽度
Measuresigma:高斯平滑的参数值
Measurethreshold:指定最小边界的振幅值
Genparamname:指定通用参数的名字
Genparamvalue:指定通用参数的值
Index:返回创建的测量对象在测量模型中的下标
Eg.
add_metrology_object_circle_measure (MetrologyHandle, Row, Column, Area, 100, 5, 1.5, 30, [‘measure_transition’,‘min_score’], [‘all’,0.4], Index)
9.apply_metrology_model(image::metrologyhandle:)
测量并拟合几何形状;
Image:测量的图片;
Metrologyhandle:测量模型的句柄
10.get_metrology_object_result_contour(:contour:metrologyhandle,index,instance,resolution:)
获取测量模型里的测量轮廓
Contour:返回的轮廓
Metrologyhandle:
Index:指定测量模型的下标
Instance:指定返回的测量结果实例的类型
Resolution:指定轮廓点之间的距离
Eg.
get_metrology_object_result_contour (Contour, MetrologyHandle, ‘all’, ‘all’, 1.5)
11.get_metrology_object_result(::metrologyhandle,index,instance,genparamname,genparamvalue:parameter)
获取测量结果
Metrologyhandle:测量模型的句柄
Index:指定测量对象的下标
Instance:指定返回的测量结果实例的类型
Genparamname:指定通用参数的名称
Genparamvalue:指定通用参数的值
Parameter:返回的结果
Eg.
get_metrology_object_result (MetrologyHandle, ‘all’, ‘all’, ‘result_type’, ‘radius’, Parameter)
read_image (Image, 'E:/c#/work_clip/measure1d_circle/bin/Debug/1.bmp')
get_image_size (Image, Width, Height)
dev_open_window (0, 0, Width/10, Height/10, 'black', WindowHandle)
*创建测量模型
create_metrology_model (MetrologyHandle)
*设置测量图像大小
set_metrology_model_image_size (MetrologyHandle, Width, Height)
*阈值图像处理
threshold (Image, Region, 0, 60)
*联通区域
connection (Region, ConnectedRegions)
*特征选择
select_shape (ConnectedRegions, SelectedRegions, ['area','roundness'], 'and', [227273,0.9128], [1.85993e+006,1])
*获取圆的中心的面积
area_center (SelectedRegions, Area, Row, Column)
*显示图片
dev_set_color ('green')
dev_set_draw ('margin')
dev_display (Image)
*生成圆
gen_circle (Circle, Row, Column, 324)
*添加圆到测量模型中
add_metrology_object_circle_measure (MetrologyHandle, Row, Column, 324, 100, 5, 1.5, 30, ['measure_transition','min_score'], ['all',0.4], Index)
*测量并拟合几何形状
apply_metrology_model (Image, MetrologyHandle)
*获取测量模型里的测量轮廓
get_metrology_object_result_contour (Contour, MetrologyHandle, 'all', 'all', 1.5)
*获取测量结果
get_metrology_object_result (MetrologyHandle, 'all', 'all', 'result_type', 'radius', Parameter)
dev_display (Contour)
set_tposition (WindowHandle,0, 0)
write_string (WindowHandle, Parameter)