halcon-length_xld返回xld轮廓的总长度

 

 

在HDevelop中

dev_close_window ()
read_image (Image, 'D:/bb/tu/8.jpg')
rgb1_to_gray (Image, GrayImage)
edges_sub_pix (GrayImage, Edges, 'canny', 1, 5, 10)
*亚像素边缘


length_xld (Edges, Length)
*返回xld轮廓的总长度
*参数1:xld轮廓或轮廓集
*参数2:返回长度--数组



get_image_size (GrayImage, Width, Height)
dev_open_window(10,10,Width, Height,'black',WindowHandle)
dev_display(Edges)

 

 


在QtCreator中

  HObject  ho_Image, ho_GrayImage, ho_Edges;
  HTuple  hv_Length, hv_Width, hv_Height, hv_WindowHandle;
  ReadImage(&ho_Image, "D:/bb/tu/8.jpg");
  Rgb1ToGray(ho_Image, &ho_GrayImage);
  EdgesSubPix(ho_GrayImage, &ho_Edges, "canny", 1, 5, 10);
  //亚像素边缘


  LengthXld(ho_Edges, &hv_Length);
  //返回xld轮廓的总长度
  //参数1:xld轮廓或轮廓集
  //参数2:返回长度--数组



  GetImageSize(ho_GrayImage, &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_Edges, HDevWindowStack::GetActive());

 

 

 

 

posted @ 2022-03-16 12:21  天子骄龙  阅读(1442)  评论(0)    收藏  举报