zoukankan      html  css  js  c++  java
  • Halcon积累

    1.提取Region中面积最大的区域:

    region_feature(Conns,'area',Areas)

    select_obj (Conns, ObjectMax, sort_index(-Areas)[0] + 1)

    提取Region中面积第2大的区域

    region_feature(Conns,'area',Areas)

    select_obj (Conns, ObjectMax, sort_index(-Areas)[1] + 1)

    ...

    提取Region中面积最小的区域:

    region_feature(Conns,'area',Areas)

    select_obj (Conns, ObjectMax, sort_index(Areas)[0] + 1)

    提取Region中面积第2小的区域

    region_feature(Conns,'area',Areas)

    select_obj (Conns, ObjectMax, sort_index(Areas)[1] + 1)

     sort_index(Area,Indice)算子讲解:先将Area中各元素按升序排序,然后将排序后的每一个Area分别在原Area元组中的索引放在元组Indice 中

    Area:    420   12922   38019   58   2033
    Sort:     58      420      2033     12922  38019
    Indice:  3     0     4      1     2

    因为是升序,所以找最小不需要取反,找最大需要取反

    2.再halcon上写字的3种方式

      2.1dev_disp_text (Message, 'window', 12, 12, 'black', [], [])

      2.2set_tposition (WindowHandle, 12, 12)       write_string (WindowHandle, 'OK')

           2.3disp_message (WindowHandle, 'No Model found!', true, 25, 20, 'black', 'true')

    3.region集

      gen_empty_obj (Contour)

      for()

      {...

        concat_obj (Contour, TemContour, Contour)

      }

    4.胶路检测关键字:bead

    5.等差数列 Rows:=[5:10:50]等同于Rows:=[5, 15, 25, 35, 45]

    生成特定数量的常数 Cols:=gen_tuple_const(10, 6)等同于Cols:=[6, 6, 6, 6, 6, 6, 6, 6, 6, 6]   生成10个6

    6.   tuple_select_mask   要求两个输入的元祖长度相同

      IntTuple := [0,1,2,3,4,5]

      tuple_select_mask (IntTuple, [0,1,0,1,0,1], SelectSome1)

      SelectSome1的结果是IntTuple里面索引为1、3、5的集合

    7.二值化

      threshold (Image, Region1, 128, 255):经典二值化

      fast_threshold (Image, Region, 128, 255, 10):快速二值化,相当于经典二值化后+面积判断,太小的不要

    8.提取边界的两个算子

      edges_sub_pix (ImageReduced, Edges, 'canny', 1.7, 40, 120)  //对于canny算法:1.7越大则平滑越大,1.7越大则平滑越小,对于其他算法则相反;40和120越大,对边缘的要求越高越小对边缘的要求越低越容易提取出轮廓

      threshold_sub_pix (ImageReduced, Border1, 128)

    9.

  • 相关阅读:
    maven
    ELK
    gitlab 升级
    平安工作流程
    平安云应用场景
    nginx基于uwsgi部署Django (单机搭建)
    ansible
    nginx理论
    GIT
    docker(三)
  • 原文地址:https://www.cnblogs.com/yangmengke2018/p/11045607.html
Copyright © 2011-2022 走看看