• halconskeleton求区域的骨架


     区域骨架:骨架可以理解为区域的中轴

    在HDevelop中

    read_image (Image, 'D:/bb/tu/6.jpg')
    rgb1_to_gray(Image,Image1)
    
    threshold (Image1, Region,[80,87,206,195] , [90,100, 228,205])
    
    *union1 (Region, RegionUnion)
    
    skeleton (Region, Skeleton)
    *求区域的骨架
    *参数1:区域或区域集
    *参数2:输出的骨架--区域
    
    
    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(Skeleton)


    在Qt Creator中

      HObject  ho_Image, ho_Image1, ho_Region, ho_Skeleton;
      HTuple  hv_Width, hv_Height, hv_WindowHandle;
      HTuple  hv_WindowHandle1;
      ReadImage(&ho_Image, "D:/bb/tu/6.jpg");
      Rgb1ToGray(ho_Image, &ho_Image1);
    
      Threshold(ho_Image1, &ho_Region, (((HTuple(80).Append(87)).Append(206)).Append(195)), 
          (((HTuple(90).Append(100)).Append(228)).Append(205)));
    
      //union1 (Region, RegionUnion)
    
      Skeleton(ho_Region, &ho_Skeleton);
      //求区域的骨架
      //参数1:区域或区域集
      //参数2:输出的骨架--区域
    
    
      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_Skeleton, HDevWindowStack::GetActive());

  • 相关阅读:
    操作系统六文件管理
    Educational Codeforces Round 38 (Rated for Div. 2) ABCD
    51nod 1100 斜率最大
    51nod 最小方差
    51nod 1065 最小正子段和
    P1280 尼克的任务
    牛客小白月赛2
    Codeforces Round #210 (Div. 1) B 二分+dp
    江西财经大学第一届程序设计竞赛
    51nod 1596 搬货物
  • 原文地址:https://www.cnblogs.com/liming19680104/p/15987947.html
Copyright © 2020-2023  润新知