add_metrology_object_circle_measure (对齐测量模型)

*读取图片
read_image (Image, 'rings_and_nuts')
dev_get_window (WindowHandle)
dev_set_draw ('margin')
*创建模板
draw_circle (WindowHandle, modelRow, modelColumn, modelRadius)
gen_circle (Circle, modelRow, modelColumn, modelRadius)
reduce_domain (Image, Circle, ImageReduced)
create_shape_model (ImageReduced, 'auto', -0.39, 0.79, 'auto', 'auto', 'use_polarity', 'auto', 'auto', ModelID)
*创建ROI
draw_circle (WindowHandle, roiRow, roiColumn, roiRadius)
*验证匹配对齐卡尺
hom_mat2d_identity (HomMat2DIdentity)
hom_mat2d_translate (HomMat2DIdentity, 64, 64, HomMat2DTranslate)
rotate_image (Image, Image, 30, 'constant')
*模板搜索
find_shape_model (Image, ModelID, -0.39, 0.79, 0.5, 1, 0.5, 'least_squares', 0, 0.9, fineRow, findColumn, findAngle, Score)
get_shape_model_contours (ModelContours, ModelID, 1)
*创建测量模型
create_metrology_model (MetrologyHandle)
*设置测量对象的图像大小
get_image_size (Image, Width, Height)
set_metrology_model_image_size (MetrologyHandle, Width, Height)
*对象参数
genParamName:=['start_phi','end_phi','measure_transition','measure_select','num_measures','min_score']
genParamValue:=[rad(0),rad(360),'negative','first',10,0.4]
*创建测量ROI
add_metrology_object_circle_measure (MetrologyHandle, roiRow, roiColumn, roiRadius, 6, 2, 1, 30, genParamName, genParamValue, Index)
set_metrology_object_param (MetrologyHandle, 'all', 'num_instances', 5)
*模板匹配对齐参数
set_metrology_model_param (MetrologyHandle, 'reference_system', [modelRow, modelColumn,0])
align_metrology_model (MetrologyHandle, fineRow, findColumn, findAngle)
*应用测量
apply_metrology_model (Image, MetrologyHandle)
*获取测量结果
get_metrology_object_result (MetrologyHandle, 0, 'all', 'result_type', 'all_param', Parameter)
get_metrology_object_measures (Contours, MetrologyHandle, 'all', 'all', Row2, Column2)
get_metrology_object_result_contour (Contour, MetrologyHandle, 0, 'all', 1.5)
*清除/销毁测量对象
clear_metrology_model (MetrologyHandle)

*添加圆型测量对象到模型*
        *add_metrology_object_circle_measure()*
        *MetrologyHandle:测量模型句柄*
        *Row:测量区域的圆心行坐标*
        *Column:测量区域的圆行列坐标*
        *Radius:测量区域的半径*
        *MeasureLength1:垂直于边界的测量区域的一半长度*
        *MeasureLength2:相切于边界的测量区域的一半长度*
        *MeasureSigma:用于平滑的高斯函数的 Sigma*
        *MeasureThreshold:最小边缘幅度阈值*
        *GenParamName:通用参数的名称*
        *GenParamValue:通用参数值*
        *Index:所创建的计量对象的索引 

运行结果(源码可以直接复制运行) 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值