halcon-gray_dilation_rect图像膨胀
作者:互联网
在HDevelop中
dev_update_off() read_image (Image, 'D:/bb/tu/1.jpg') rgb1_to_gray(Image,Image1) *将RGB图像转换为灰度图像 gray_dilation_rect (Image1, ImageMax, 5, 5) *图像膨胀-->效果:增加亮部,减少暗 *参数1:灰度值图像 *参数2:输出图像 *参数3和参数4:结构元的宽和高部 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(ImageMax)
在QtCreator中
HObject ho_Image, ho_Image1, ho_ImageMax; HTuple hv_Width, hv_Height, hv_WindowHandle; HTuple hv_WindowHandle1;
ReadImage(&ho_Image, "D:/bb/tu/1.jpg"); Rgb1ToGray(ho_Image, &ho_Image1); //将RGB图像转换为灰度图像 GrayDilationRect(ho_Image1, &ho_ImageMax, 5, 5); //图像膨胀-->效果:增加亮部,减少暗 //参数1:灰度值图像 //参数2:输出图像 //参数3和参数4:结构元的宽和高部 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_ImageMax, HDevWindowStack::GetActive());
标签:gray,hv,halcon,Width,ho,图像,Image1,Height,dilation 来源: https://www.cnblogs.com/liming19680104/p/15975911.html