在HDevelop中
read_image (Image, 'D:/bb/tu/4.jpg')
rgb1_to_gray(Image,Image1)
*将RGB图像转换为灰度图像
threshold (Image1, Region,[80] , [90])
threshold (Image1, Region1,[206] , [228])
union2 (Region, Region1, RegionUnion)
*将两个区域合并成一个区域
*参数1和参数2:要合并的区域--可以是联合区域
*参数3:输出区域
get_image_size (Image1, Width, Height)
dev_open_window(10,100,Width, Height,'black',WindowHandle1)
dev_display(RegionUnion)
在Qt Creator中
HObject ho_Image, ho_Image1, ho_Region, ho_Region1;
HObject ho_RegionUnion;
HTuple hv_Width, hv_Height, hv_WindowHandle1;
ReadImage(&ho_Image, "D:/bb/tu/4.jpg");
Rgb1ToGray(ho_Image, &ho_Image1);
//将RGB图像转换为灰度图像
Threshold(ho_Image1, &ho_Region, 80, 90);
Threshold(ho_Image1, &ho_Region1, 206, 228);
Union2(ho_Region, ho_Region1, &ho_RegionUnion);
//将两个区域合并成一个区域
//参数1和参数2:要合并的区域-可以是联合区域
//参数3:输出区域 GetImageSize(ho_Image1, &hv_Width, &hv_Height); SetWindowAttr("background_color","black"); OpenWindow(10,100,hv_Width,hv_Height,0,"visible","",&hv_WindowHandle1); HDevWindowStack::Push(hv_WindowHandle1); if (HDevWindowStack::IsOpen()) DispObj(ho_RegionUnion, HDevWindowStack::GetActive());