• halconsmallest_circle获取区域的最小外接圆数据


    在HDevelop中

    read_image (Image, 'D:/bb/tu/5.jpg')
    rgb1_to_gray(Image,Image1)
    threshold (Image1, Region,[75] , [90])
    
    smallest_circle (Region, Row, Column, Radius)
    *获取区域最小外接圆数据
    *参数1:输入给定区域
    *参数2:输出中心行坐标-y坐标
    *参数3:输出中心列坐标-x坐标
    *参数4:输出外接圆半径
    
    gen_circle (Circle, Row, Column, Radius)
    *创建一个圆区域
    
    get_image_size (Image1, Width, Height)
    dev_open_window(10,10,Width, Height,'black',WindowHandle)
    dev_display(Region)
    dev_open_window(10,100,Width, Height,'black',WindowHandle1)
    dev_display(Circle)


    在QtCreator中

      HObject  ho_Image, ho_Image1, ho_Region, ho_Circle;
      HTuple  hv_Row, hv_Column, hv_Radius, hv_Width;
      HTuple  hv_Height, hv_WindowHandle, hv_WindowHandle1;
      ReadImage(&ho_Image, "D:/bb/tu/5.jpg");
      Rgb1ToGray(ho_Image, &ho_Image1);
      Threshold(ho_Image1, &ho_Region, 75, 90);
    
      SmallestCircle(ho_Region, &hv_Row, &hv_Column, &hv_Radius);
      //获取区域最小外接圆数据
      //参数1:输入给定区域
      //参数2:输出中心行坐标-y坐标
      //参数3:输出中心列坐标-x坐标
      //参数4:输出外接圆半径
    
      GenCircle(&ho_Circle, hv_Row, hv_Column, hv_Radius);
      //创建一个圆区域
    
      GetImageSize(ho_Image1, &hv_Width, &hv_Height);
      SetWindowAttr("background_color","black");
      OpenWindow(10,10,hv_Width,hv_Height,0,"visible","",&hv_WindowHandle);
      HDevWindowStack::Push(hv_WindowHandle);
      if (HDevWindowStack::IsOpen())
        DispObj(ho_Region, HDevWindowStack::GetActive());
      SetWindowAttr("background_color","black");
      OpenWindow(10,100,hv_Width,hv_Height,0,"visible","",&hv_WindowHandle1);
      HDevWindowStack::Push(hv_WindowHandle1);
      if (HDevWindowStack::IsOpen())
        DispObj(ho_Circle, HDevWindowStack::GetActive());

  • 相关阅读:
    CRMEB FormBuilder
    CRMEB 异常
    Layui select
    VS 发布报错 NETSDK1152: 找到了多个具有相同相对路径的发布输出文件
    Layui 文档 官网镜像
    datetimepicker 日期显示 年视图 月视图
    SpringBoot
    RabbitMQ
    Shiro
    SpringMVC
  • 原文地址:https://www.cnblogs.com/liming19680104/p/15995037.html
Copyright © 2020-2023  润新知