在前面一帖子中使用代码实现圆弧的长度测量。
当前也可以使用测量助手,会更加直观。
首先打开测量助手窗口。
在输入选项卡中打开图片C:/Users/Public/Documents/MVTec/HALCON-17.12-Progress/examples/images/zeiss1.png
使用工具栏上的绘制圆弧工具在图上绘制圆弧确认测量范围。
在边缘选项卡内微调节参数,观察图片上边缘的提取效果。
1.10 halcon上位机利用测量助手实现圆弧长度测量
可以结果选项卡查看测量结果。
也可在代码生成选项卡上,点击按钮插入代码,进行代码 编辑
- * Measure 01: Code generated by Measure 01
- * Measure 01: Prepare measurement
- AmplitudeThreshold := 5
- RoiWidthLen2 := 5
- set_system ('int_zooming', 'true')
- * Measure 01: Coordinates for circular arc Measure 01 [0]
- ArcRow_Measure_01_0 := 269.882
- ArcColumn_Measure_01_0 := 335.685
- ArcRadius_Measure_01_0 := 99.6761
- ArcAngleStart_Measure_01_0 := -0.282035
- ArcAngleExtent_Measure_01_0 := 1.85283
- * Measure 01: Create measure for circular arc Measure 01 [0]
- * Measure 01: Attention: This assumes all images have the same size!
- gen_measure_arc (ArcRow_Measure_01_0, ArcColumn_Measure_01_0, ArcRadius_Measure_01_0, ArcAngleStart_Measure_01_0, ArcAngleExtent_Measure_01_0, max2(1, min2(RoiWidthLen2, ArcRadius_Measure_01_0)), 679, 557, 'nearest_neighbor', MsrHandle_Measure_01_0)
- * Measure 01: ***************************************************************
- * Measure 01: * The code which follows is to be executed once / measurement *
- * Measure 01: ***************************************************************
- * Measure 01: Load image
- read_image (Image, 'C:/Users/Public/Documents/MVTec/HALCON-17.12-Progress/examples/images/zeiss1.png')
- * Measure 01: Execute measurements
- measure_pos (Image, MsrHandle_Measure_01_0, 0.4, AmplitudeThreshold, 'all', 'all', Row_Measure_01_0, Column_Measure_01_0, Amplitude_Measure_01_0, Distance_Measure_01_0)
- * Measure 01: Do something with the results
- * Measure 01: Clear measure when done
- close_measure (MsrHandle_Measure_01_0)
复制代码
|