zoukankan      html  css  js  c++  java
  • 开关引脚测量

    跟我学机器视觉-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.

    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)

    *测量矩形位置尺寸如下:

    • 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)

    *结果如下:

    • Free the memory that has been allocated for the measure.
      close_measure (MeasureHandle)
    作者:☆Chita☆ 出处:http://www.cnblogs.com/chita/ 本文版权归作者和博客园共有,欢迎转载
  • 相关阅读:
    Java中怎样由枚举常量的ordinal值获得枚举常量对象
    深入了解泛型
    艰苦的RAW格式数据恢复之旅
    eclipse 代码清理 代码格式化 代码凝视
    应用策略设计模式
    JavaEE SSH集成框架(两) struts2 本地加载dtd文件,action组态
    关闭表空间的热备份实例重新启动重现错误和解决
    CF 148D. Bag of mice (可能性DP)
    C++ Primer 学习笔记_45_STL实践与分析(19)--建筑常规算法
    工作的几点思考
  • 原文地址:https://www.cnblogs.com/liuzebei/p/5458664.html
Copyright © 2011-2022 走看看