• halconget_contour_xld返回XLD轮廓的坐标


    在HDevelop中

    dev_close_window ()
    read_image (Image, 'D:/bb/tu/1.jpg')
    rgb1_to_gray (Image, GrayImage)
    
    edges_sub_pix (GrayImage, Edges, 'canny', 1, 5, 10)
    *亚像素边缘
    
    select_shape_xld (Edges, SelectedXLD, ['contlength','area'], 'and', [108,700],[109,800])
    
    get_contour_xld (SelectedXLD, Row, Col)
    *返回XLD轮廓的坐标
    *参数1:轮廓
    *参数2:行坐标--数组
    *参数3:列坐标--数组
    
    
    get_image_size (GrayImage, Width, Height)
    dev_open_window(10,10,Width, Height,'black',WindowHandle3)
    dev_display(SelectedXLD)


    在QtCreator中

        HObject  ho_Image, ho_GrayImage, ho_Edges, ho_SelectedXLD;
        HTuple  hv_Row, hv_Col, hv_Width, hv_Height, hv_WindowHandle3;
      ReadImage(&ho_Image, "D:/bb/tu/1.jpg");
      Rgb1ToGray(ho_Image, &ho_GrayImage);
    
      EdgesSubPix(ho_GrayImage, &ho_Edges, "canny", 1, 5, 10);
      //亚像素边缘
    
      SelectShapeXld(ho_Edges, &ho_SelectedXLD, (HTuple("contlength").Append("area")), 
          "and", (HTuple(108).Append(700)), (HTuple(109).Append(800)));
    
      GetContourXld(ho_SelectedXLD, &hv_Row, &hv_Col);
      //返回XLD轮廓的坐标
      //参数1:轮廓
      //参数2:行坐标--数组
      //参数3:列坐标--数组
    
    
      GetImageSize(ho_GrayImage, &hv_Width, &hv_Height);
      SetWindowAttr("background_color","black");
      OpenWindow(10,10,hv_Width,hv_Height,0,"visible","",&hv_WindowHandle3);
      HDevWindowStack::Push(hv_WindowHandle3);
      if (HDevWindowStack::IsOpen())
        DispObj(ho_SelectedXLD, HDevWindowStack::GetActive());

  • 相关阅读:
    性能测试分析
    常见的性能缺陷
    性能测试中TPS上不去的几种原因浅析
    Linux新增和删除环境变量
    JProfiler的详细使用介绍
    详解Tomcat的连接数和线程池
    造数据存储过程
    shell脚本解压多个jar包
    使用shell快速建立上万个文件夹
    df、du命令
  • 原文地址:https://www.cnblogs.com/liming19680104/p/16002638.html
Copyright © 2020-2023  润新知