• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

halcon圆查找

武飞扬头像
爱炸薯条的小朋友
帮助2

圆查找功能
本质上圆查找功能是由于大部分时候会出现的模板匹配的精度不佳,对实际的坐标有部分偏差的情况
这时候我们可以通过建立测量矩形的形式,对预估点进行多次测量以得到较为精确的轮廓
算子除了有圆查找,还有椭圆查找,直线查找,带角度的矩形查找四种方法

*创建测量模板
create_metrology_model (MetrologyHandle)
*向计量模型中添加计量对象。
*其中需要注意的是:'circle'。
*halcon的这个算子允许对4种计量对象:'circle'(圆形)ellipse(椭圆形)line(直线)rectangle2(带角度的矩形)
*[Row3, Column3, 195]对计量模型创建特征。当我们选择圆形的时候就会需要圆的中心XY坐标和半径
*50(高斯滤波的值)
*test1计量模型识别码
add_metrology_object_generic (MetrologyHandle, 'circle', [Row3, Column3, 195], 50, 5, 5, 30, [], [], test1)
*将句柄添加在图像中
apply_metrology_model (Image1, MetrologyHandle)
*获取到计量模型的结果
*输出不同类型'used_edges'(提取边缘) 'angle_direction'(提取角度) 'result_type'(结果类型)
*'row'(获取行坐标)【输出多种不同类型的数值】(实质上可以获取到测量举行的拟合中点)
get_metrology_object_result (MetrologyHandle, 'all', 'all', 'used_edges', 'row', UsedRow)
get_metrology_object_result (MetrologyHandle, 'all', 'all', 'used_edges', 'column', UsedColumn)
*生成测量矩形
get_metrology_object_measures (Contours, MetrologyHandle, 'all', 'all', Row1, Column1)
*创建测量矩形中点
gen_cross_contour_xld (UsedEdges, UsedRow, UsedColumn, 10, Angle)
*创建圆形
get_metrology_object_result_contour (ResultContours, MetrologyHandle, 'all', 'all', 1.5)
dev_display (Image1)
dev_display (UsedEdges)
dev_display (ResultContours)
*对结果类型进行获取,获取角度,中心X值和Y值
*RadiusC1角度值,Row9行坐标,column9纵坐标
get_metrology_object_result (MetrologyHandle, test1, 'all', 'result_type', 'radius', RadiusC1)
get_metrology_object_result (MetrologyHandle, test1, 'all', 'result_type', 'row', Row9)
get_metrology_object_result (MetrologyHandle, test1, 'all', 'result_type', 'column', column9)
*创建圆形轮廓
gen_circle_contour_xld (ContCircle2, Row9, column9, RadiusC1, rad(180), rad(360), 'positive', 1)
gen_circle_contour_xld (ContCircle3, Row9, column9, RadiusC1, rad(0), rad(-180), 'positive', 1)
gen_cross_contour_xld (Cross, Row9, column9, 100, Angle)
学新通

学新通

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhgcgekk
系列文章
更多 icon
同类精品
更多 icon
继续加载