1. 程式人生 > 其它 >halcon-fill_up_shape填充區域或區域集中具有給定形狀特徵的孔

halcon-fill_up_shape填充區域或區域集中具有給定形狀特徵的孔

 

 

在HDevelop中

read_image (Image, 'D:/bb/tu/5.jpg')
rgb1_to_gray(Image,Image1)

threshold (Image1, Region,[190,85,105] , [205,100, 115])

fill_up_shape (Region, RegionFillUp, 'area', 1, 10000)
*填充輸入區域或區域集中具有給定形狀特徵的那些孔
*引數1:輸入區域或區域集
*引數2:輸出區域
*引數3:形狀特徵
*       'anisometry'
*       'area'             面積
*       '
compactness' 緊密度 * 'convexity' * 'inner_circle' 內切圓 * 'outer_circle' 外切圓 * 'phi' * 'ra' * 'rb' *引數4:特徵的最小值 *引數5:特徵的最大值 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(RegionFillUp)

 

 

 


在Qt Creator中

  HObject  ho_Image, ho_Image1, ho_Region, ho_RegionFillUp;
  HTuple  hv_Width, hv_Height, hv_WindowHandle;
  HTuple  hv_WindowHandle1;
  ReadImage(&ho_Image, "D:/bb/tu/5.jpg");
  Rgb1ToGray(ho_Image, &ho_Image1);

  Threshold(ho_Image1, 
&ho_Region, ((HTuple(190).Append(85)).Append(105)), ((HTuple(205).Append(100)).Append(115))); FillUpShape(ho_Region, &ho_RegionFillUp, "area", 1, 10000); //填充輸入區域或區域集中具有給定形狀特徵的那些孔 //引數1:輸入區域或區域集 //引數2:輸出區域 //引數3:形狀特徵 // 'anisometry' // 'area' 面積 // 'compactness' 緊密度 // 'convexity' // 'inner_circle' 內切圓 // 'outer_circle' 外切圓 // 'phi' // 'ra' // 'rb' //引數4:特徵的最小值 //引數5:特徵的最大值 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_RegionFillUp, HDevWindowStack::GetActive());