• Halcon 算子 select_shape- 借助形状特征选择区域(选择轮廓)


    Halcon 算子 select_shape- 借助形状特征选择区域(选择轮廓)

    select_shape - 借助形状特征选择区域。

    原型:

    select_shape(Regions : SelectedRegions : Features, Operation, Min, Max : ) 
    

    (将连接的区域进行筛选,筛选的特征有很多,如面积长度等,可以去掉不满足条件的轮廓)

    描述:

    操作符select_shape根据形状选择区域。对于来自区域的每个输入区域,计算所指示的特征(features)。如果计算特征的每个(Operation='and')或至少一个(Operation='or')在默认限制(最小值、最大值)内,则该区域将适应输出(复制)。

    条件:Min_i <= Feature_i(Object) <= Max_i 

    功能特征的取值:

    特征 备注
    area Area of the object 对象的面积  
    row Row index of the center 中心点的行坐标  
    column Column index of the center 中心点的列坐标  
    width Width of the region 区域的宽度  
    height Height of the region 区域的高度  
    row1 Row index of upper left corner 左上角行坐标  
    column1 Column index of upper left corner 左上角列坐标  
    row2 Row index of lower right corner 右下角行坐标  
    column2 Column index of lower right corner 右下角列坐标  
    circularity Circularity 圆度 0~1
    compactness Compactness 紧密度 0~1
    contlength Total length of contour 轮廓线总长  
    convexity Convexity 凸性  
    rectangularity Rectangularity 矩形度 0~1
    ra Main radius of the equivalent ellipse 等效椭圆长轴半径长度  
    rb Secondary radius of the equivalent ellipse 等效椭圆短轴半径长度  
    phi Orientation of the equivalent ellipse 等效椭圆方向  
    anisometry Anisometry 椭圆参数,Ra/Rb长轴与短轴的比值  
    bulkiness Bulkiness 椭圆参数,蓬松度π*Ra*Rb/A  
    struct_factor Structur Factor  椭圆参数,Anisometry*Bulkiness-1  
    outer_radius Radius of smallest surrounding circle 最小外接圆半径  
    inner_radius Radius of largest inner circle 最大内接圆半径  
    inner_width Width of the largest axis-parallel rectangle that fits into the region 最大内接矩形宽度  
    inner_height Height of the largest axis-parallel rectangle that fits into the region 最大内接矩形高度  
    dist_mean Mean distance from the region border to the center 区域边界到中心的平均距离  
    dist_deviation Deviation of the distance from the region border from the center 区域边界到中心距离的偏差  
    roundness Roundness 圆度,与circularity计算方法不同  
    num_sides Number of polygon sides 多边形边数  
    connect_num Number of connection components 连通数  
    holes_num Number of holes 区域内洞数  
    area_holes Area of the holes of the object 所有洞的面积  
    max_diameter Maximum diameter of the region 最大直径  
    orientation Orientation of the region 区域方向  
    euler_number Euler number 欧拉数,即连通数和洞数的差  
    rect2_phi Orientation of the smallest surrounding rectangle 最小外接矩形的方向  
    rect2_len1 Half the length of the smallest surrounding rectangle 最小外接矩形长度的一半?? smallest_rectangle2
    rect2_len2 Half the width of the smallest surrounding rectangle 最小外接矩形宽度的一半  
    moments_m11 Geometric moments of the region 几何矩  
    moments_m20 Geometric moments of the region 几何矩  
    moments_m02 Geometric moments of the region 几何矩  
    moments_ia Geometric moments of the region 几何矩  
    moments_ib Geometric moments of the region 几何矩  
    moments_m11_invar Geometric moments of the region 几何矩  
    moments_m20_invar Geometric moments of the region 几何矩  
    moments_m02_invar Geometric moments of the region 几何矩  
    moments_phi1 Geometric moments of the region 几何矩  
    moments_phi2 Geometric moments of the region 几何矩  
    moments_m21 Geometric moments of the region 几何矩  
    moments_m12 Geometric moments of the region 几何矩  
    moments_m03 Geometric moments of the region 几何矩  
    moments_m30 Geometric moments of the region 几何矩  
    moments_m21_invar Geometric moments of the region 几何矩  
    moments_m12_invar Geometric moments of the region 几何矩  
    moments_m03_invar Geometric moments of the region 几何矩  
    moments_m30_invar Geometric moments of the region 几何矩  
    moments_i1 Geometric moments of the region 几何矩  
    moments_i2 Geometric moments of the region 几何矩  
    moments_i3 Geometric moments of the region 几何矩  
    moments_i4 Geometric moments of the region 几何矩  
    moments_psi1 Geometric moments of the region 几何矩  
    moments_psi2 Geometric moments of the region 几何矩  
    moments_psi3 Geometric moments of the region 几何矩  
    moments_psi4 Geometric moments of the region 几何矩


    参数:

    • Regions (input_object)  region-array → object     //要检查的区域
    • SelectedRegions (output_object)  region-array → object   //符合条件的区域
    • Features (input_control)  string(-array) → (string)   //要检查的形状特征
      • 默认值: 'area' 
      • 值列表: 'area', 'row', 'column', 'width', 'height', 'row1', 'column1', 'row2', 'column2', 'circularity', 'compactness', 'contlength', 'convexity', 'rectangularity', 'ra', 'rb', 'phi', 'anisometry', 'bulkiness', 'struct_factor', 'outer_radius', 'inner_radius', 'inner_width', 'inner_height', 'max_diameter', 'dist_mean', 'dist_deviation', 'roundness', 'num_sides', 'orientation', 'connect_num', 'holes_num', 'area_holes', 'euler_number', 'rect2_phi', 'rect2_len1', 'rect2_len2', 'moments_m11', 'moments_m20', 'moments_m02', 'moments_ia', 'moments_ib', 'moments_m11_invar', 'moments_m20_invar', 'moments_m02_invar', 'moments_phi1', 'moments_phi2', 'moments_m21', 'moments_m12', 'moments_m03', 'moments_m30', 'moments_m21_invar', 'moments_m12_invar', 'moments_m03_invar', 'moments_m30_invar', 'moments_i1', 'moments_i2', 'moments_i3', 'moments_i4', 'moments_psi1', 'moments_psi2', 'moments_psi3', 'moments_psi4' 
    • Operation (input_control)  string → (string)    //单个特征的链接类型
      • 默认值: 'and' 
      • 值列表: 'and', 'or' 
    • Min (input_control)  real(-array) → (real / integer / string)   //特征下限 ,最小值
      • 默认值: 150.0
      • 典型取值范围: 0.0 ≤ Min ≤ 99999.0
      • 最小增量: 0.001
      • 建议增量: 1.0 
    • Max (input_control)  real(-array) → (real / integer / string)   //特征上限,最大值
      • 默认值: 99999.0
      • 典型取值范围: 0.0 ≤ Max ≤ 99999.0
      • 最小增量: 0.001
      • 建议增量: 1.0
      • 限制: Max >= Min   //Max必须大于等于Min  ,否则报错

    示例:

    read_image(Image,'monkey')
    threshold(Image,S1,160,255)
    connection(S1,S2)
    select_shape(S2,Eyes,['area','anisometry'],'and',[500,1.0],[50000,1.7])
    disp_region(Eyes,WindowHandle) 
    

      

    创建时间:2021.01.17  更新时间:

    博客园 滔Roy https://www.cnblogs.com/guorongtao 希望内容对你所有帮助,谢谢!
  • 相关阅读:
    PC端网站微信扫码登录
    H5微信授权登录
    Taro -- Swiper的图片由小变大3d轮播效果
    vue,一路走来(17)--vue使用scss,并且全局引入公共scss样式
    vscode 黑屏及类名报错解决方案
    js的cookie写入存储与读取
    常用正则表达式
    JS获取当前时间戳的方法
    URL的截取问题
    cookie的基本用法案例
  • 原文地址:https://www.cnblogs.com/guorongtao/p/14288493.html
Copyright © 2020-2023  润新知