1. 程式人生 > 其它 >halcon-fill_up填充區域的孔和縫(漏洞)

halcon-fill_up填充區域的孔和縫(漏洞)

在HDevelop中

2.png

dev_open_window(10,10,389,205,'black',WindowHandle)
read_image (Image, 'D:/bb/tu/2.png')
rgb1_to_gray(Image,Image1)
threshold (Image1, Region, 80,100)
fill_up (Region, RegionFillUp)
*填充區域的孔和縫(漏洞)
*引數1:輸入含孔的區域
*引數2:輸出區域
*區域的數量保持不變,鄰域的型別通過運算元set_system('neighborhood',<4/8>)設定
dev_display (RegionFillUp)

在QtCreator中

    SetWindowAttr("background_color","black");
    OpenWindow(10,10,193,143,0,"visible","",&hv_WindowHandle);

    ReadImage(&ho_Image, "D:/bb/tu/2.png");
    Rgb1ToGray(ho_Image, &ho_Image1);
    Threshold(ho_Image1, &ho_Region, 80, 100);
    //區域變成白色
    FillUp(ho_Region, &ho_RegionFillUp);
      
//填充區域的孔和縫(漏洞) //引數1:輸入含孔的區域 //引數2:輸出區域 //區域的數量保持不變,鄰域的型別通過運算元set_system('neighborhood',<4/8>)設定 DispObj(ho_RegionFillUp, hv_WindowHandle);