zoukankan      html  css  js  c++  java
  • halcon例程学习 一维测量之矩形边缘

    ********************************************************************
    *加载图片
    read_image (Image, 'ic_pin')
    dev_close_window ()
    dev_open_window_fit_image (Image, 0, 0, -1, -1, WindowHandle)
    dev_display (Image)
    get_image_size (Image, Width, Height)
    
    *********************************************************************
    *选择矩形区域
    
    nRow := 47
    nColoum := 485
    nPhi  := 0
    nLen1 := 420
    nLen2 := 10
    
    dev_set_color ('green')
    dev_set_draw ('margin')
    dev_set_line_width (2)
    
    gen_rectangle2 (Rectangle, nRow, nColoum, nPhi, nLen1, nLen2)
    ***********************************************************************
    
    *获取矩形测量句柄
    gen_measure_rectangle2 (nRow, nColoum, nPhi, nLen1, nLen2, Width, Height, 'nearest_neighbor', MeasureHandle)
    
    *提取垂直于矩形或环形弧的直边对
    measure_pairs (Image, MeasureHandle, 1.5, 10, 'all', 'all', RowEdgeFirst, ColumnEdgeFirst, AmplitudeFirst, RowEdgeSecond, ColumnEdgeSecond, AmplitudeSecond, IntraDistance, InterDistance)
    
    close_measure (MeasureHandle)
    
    gen_region_line (RegionLines, RowEdgeFirst, ColumnEdgeFirst, RowEdgeSecond, ColumnEdgeSecond)
    
    stop ()
    *********************************************************************
    *选择矩形区域
    
    nRow := 508
    nColoum := 200
    nPhi  := -1.57
    nLen1 := 500
    nLen2 := 10
    
    dev_set_color ('yellow')
    dev_set_draw ('margin')
    dev_set_line_width (2)
    
    gen_rectangle2 (Rectangle, nRow, nColoum, nPhi, nLen1, nLen2)
    ***********************************************************************
    
    *获取矩形测量句柄
    gen_measure_rectangle2 (nRow, nColoum, nPhi, nLen1, nLen2, Width, Height, 'nearest_neighbor', MeasureHandle)
    
    *获取测量端点
    measure_pos (Image, MeasureHandle, 1.5, 30, 'all', 'all', RowEdge, ColumnEdge, Amplitude, Distance)
    
    gen_cross_contour_xld (Cross, RowEdge, ColumnEdge, 20, 0)
    

      

  • 相关阅读:
    laravel 博客
    VSSより、指定したファイルを取得するマクロ(パス入り)
    使用SQLPlus连接Oracle实例
    SSH-Struts第四弹:Struts2学习过程中遇到的问题
    SSH-Struts第三弹:传智播客视频教程第一天上午的笔记
    Prim和Kruskal求最小生成树
    tarjan算法求强连通分量
    shutdown TCP 端口445
    Eclipse导出apk
    [模板]tarjan求强连通分量
  • 原文地址:https://www.cnblogs.com/anyechuxue/p/11269719.html
Copyright © 2011-2022 走看看