halcon 1D测量

  1. 一维测量基本流程

halcon 1D测量_第1张图片

  1. 基本算子
  • 提取垂直于矩形的直边
read_image (Image, 'fuse')
get_image_size (Image, Width, Height)
draw_rectangle2 (3600, Row, Column, Phi, Length1, Length2)
dev_set_draw ('margin')
gen_rectangle2 (Rectangle, Row, Column, Phi, Length1, Length2)
*产生测量ROI对象句柄
*参数说明
*Row:矩形ROI中心y坐标
*Column:矩形ROI中心x坐标
*Phi:矩形ROI角度
*Length1:矩形ROI长半轴长
*Length2:矩形ROI短半轴长
*Width:测量图像宽
*Height :测量图像高
*Interpolation :插值类型
*MeasureHandle:测量句柄
gen_measure_rectangle2 (Row, Column, Phi, Length1, Length2, Width, Height, 'nearest_neighbor', MeasureHandle)
*提取直边缘
*参数说明
*Image:所测量图像
*MeasureHandle:测量句柄
*Sigma:高斯平滑标准差
*Threshold :最小边缘幅度
*Transition:找点方式。'all', 'negative', 'positive'
*Select:选择的端点。'all', 'first', 'last'
*RowEdge :输出边缘中心y坐标
*ColumnEdge:输出边缘中心x坐标
*Amplitude:输出边缘幅度
*Distance:输出边缘中心之间距离
measure_pos (Image, MeasureHandle, 1, 30, 'all', 'all', RowEdge, ColumnEdge, Amplitude, Distance)
gen_cross_contour_xld (Cross, RowEdge, ColumnEdge, 6, Phi)
measure_pairs (Image, MeasureHandle, 1, 30, 'negative', 'all', RowEdgeFirst, ColumnEdgeFirst, AmplitudeFirst, RowEdgeSecond, ColumnEdgeSecond, AmplitudeSecond, IntraDistance, InterDistance)
gen_cross_contour_xld (Cross1, RowEdgeFirst, ColumnEdgeFirst, 16, rad(45))
gen_cross_contour_xld (Cross2, RowEdgeSecond, ColumnEdgeSecond, 16, rad(20))

输出结果
halcon 1D测量_第2张图片

  • 提取垂直于环形圆弧的直边缘
read_image (Zeiss1, 'zeiss1')
*频率域滤波增加高频使图像增强
emphasize (Zeiss1, Zeiss1, 7, 7, 1)
get_image_size (Zeiss1, Width, Height)
draw_circle (3600, Row, Column, Radius)
gen_circle_contour_xld (ContCircle, Row, Column, Radius, 0, rad(180), 'positive', 1)
*产生环形ROI对象句柄
gen_measure_arc (Row, Column, Radius, 0, rad(180), 10, Width, Height, 'nearest_neighbor', MeasureHandle)
*提取垂直于环形圆弧直边缘
measure_pos (Zeiss1, MeasureHandle, 1,15, 'all', 'all', RowEdge, ColumnEdge, Amplitude, Distance)
*显示测量边缘中心坐标结果
gen_cross_contour_xld (Cross, RowEdge, ColumnEdge, 6, 0.785398)

输出结果
halcon 1D测量_第3张图片

你可能感兴趣的:(halcon)