跟我学机器视觉HALCON学习例程中文详解开关引脚测量

摘要:
向我学习机器视觉-HALCON学习例程中文解释-开关引脚测量本示例程序演示了测量对象的基本用法。这里,任务是确定针脚和开关之间的宽度和距离。*此例程演示如何使用测量工具测量开关的引脚宽度和间距首先,读取

跟我学机器视觉-HALCON学习例程中文详解-开关引脚测量

  • This example program demonstrates the basic usage of a measure object.

  • Here, the task is to determine the width of and the distance between the

  • pins of a switch.

*本例程演示了如何使用测量工具测量开关的引脚宽度和间距

  • First, read in the image and initialize the program.

打开图像*********

read_image (Image, 'bin_switch/bin_switch_1')

get_image_size (Image, Width, Height)

dev_close_window ()

dev_open_window_fit_image (Image, 0, 0, 640, 640, WindowHandle)

set_display_font (WindowHandle, 14, 'mono', 'true', 'false')

dev_display (Image)

*显示图片如下

  • Define the rectangular ROI within which the edges will be detected

  • and create the measure.跟我学机器视觉HALCON学习例程中文详解开关引脚测量第1张

Row := 390

Column := 380

Phi := rad(-60)

Length1 := 60

Length2 := 10

Interpolation := 'nearest_neighbor'

生成测量矩形ROI*************
gen_measure_rectangle2 (Row, Column, Phi, Length1, Length2, Width, Height, Interpolation, MeasureHandle)

*测量矩形位置尺寸如下:
跟我学机器视觉HALCON学习例程中文详解开关引脚测量第2张

  • Determine all edge pairs that have a negative transition, i.e., edge pairs

  • that enclose dark regions.

Sigma := 0.9

Threshold := 12

Transition := 'negative'

Select := 'all'

******测量边缘对

measure_pairs (Image, MeasureHandle, Sigma, Threshold, Transition, Select, RowEdgeFirst, ColumnEdgeFirst, AmplitudeFirst,
RowEdgeSecond, ColumnEdgeSecond, AmplitudeSecond, IntraDistance, InterDistance)

  • Visualize the results

dev_display (Image)

dev_set_draw ('margin')

dev_set_color ('black')

显示测量矩形ROI*****************************************

gen_rectangle2 (Rectangle, Row, Column, Phi, Length1, Length2)

显示测量的边缘对的尺寸,length1要用ROI的宽度**************************

p_disp_dimensions (RowEdgeFirst, ColumnEdgeFirst, RowEdgeSecond, ColumnEdgeSecond, IntraDistance, InterDistance, Phi, Length2, WindowHandle)

*结果如下:
跟我学机器视觉HALCON学习例程中文详解开关引脚测量第3张

  • Free the memory that has been allocated for the measure.
    close_measure (MeasureHandle)

免责声明:文章转载自《跟我学机器视觉HALCON学习例程中文详解开关引脚测量》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇修改/dev/shm的大小关于求模和求余下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

跟我学机器视觉HALCON学习例程中文详解测量圆环脚宽间距

跟我学机器视觉-HALCON学习例程中文详解-测量圆环脚宽间距 This example program demonstrates the basic usage of a circular measure object. Here, the task is to determine the width of the cogs. *首先读取图像,获取图...

机器视觉与边缘计算:听课笔记

OpenVINO工具强大,使用有一定难度,需要一定基础:Python、机器学习基本算法等  云计算 与 边缘计算 边缘计算起源于传媒领域,是指在靠近物或数据源头的一侧,采用网络、计算、存储、应用核心能力为一体的开放平台,就近提供最近端服务。 其应用程序在边缘侧发起,产生更快的网络服务响应,满足行业在实时业务、应用智能、安全与隐私保护等方面的基本需求。 边...