在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中
HTuple hv_WindowHandle;
HObject ho_Image, ho_Image1, ho_Region, ho_RegionFillUp;
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);