halcon-gray_erosion_shape图像腐蚀_灰度值

1.jpg

halcon-gray_erosion_shape图像腐蚀_灰度值_02



在HDevelop中

dev_update_off()

read_image (Image, 'D:/bb/tu/1.jpg')
rgb1_to_gray(Image,Image1)
*将RGB图像转换为灰度图像

gray_erosion_shape (Image1, ImageMin, 5, 5, 'octagon')
*图像腐蚀-->效果:增加暗部,减少亮部
*参数1:灰度值图像
*参数2:输出图像
*参数3和参数4:结构元的宽和高
*参数5:结构元形状
* 'octagon' 八角形
* 'rectangle' 矩形
* 'rhombus' 棱形

get_image_size (Image1, Width, Height)
dev_open_window(10,10,Width, Height,'black',WindowHandle)
dev_display(Image1)
dev_open_window(10,100,Width, Height,'black',WindowHandle1)
dev_display(ImageMin)


halcon-gray_erosion_shape图像腐蚀_灰度图像_03




在QtCreator中

HObject  ho_Image, ho_Image1, ho_ImageMin;
HTuple hv_Width, hv_Height, hv_WindowHandle;
HTuple hv_WindowHandle1;
ReadImage(&ho_Image, "D:/bb/tu/1.jpg");
Rgb1ToGray(ho_Image, &ho_Image1);
//将RGB图像转换为灰度图像

GrayErosionShape(ho_Image1, &ho_ImageMin, 5, 5, "octagon");
//图像腐蚀-->效果:增加暗部,减少亮部
//参数1:灰度值图像
//参数2:输出图像
//参数3和参数4:结构元的宽和高
//参数5:结构元形状
// 'octagon' 八角形
// 'rectangle' 矩形
// 'rhombus' 棱形

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_Image1, 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_ImageMin, HDevWindowStack::GetActive());


halcon-gray_erosion_shape图像腐蚀_灰度值_04