在HDevelop中
dev_close_window ()
read_image (Image, 'D:/bb/tu/1.jpg')
rgb1_to_gray (Image, GrayImage)
sobel_dir (GrayImage, EdgeAmplitude, EdgeDirection, 'sum_abs', 3)
*计算边缘
*参数2:输出图像
*参数3:输出边缘方向图像
*参数4:掩码类型
*参数5:掩码大小
get_image_size (GrayImage, Width, Height)
dev_open_window(10,10,Width, Height,'black',WindowHandle)
dev_display(EdgeAmplitude)
dev_open_window(10,10,Width, Height,'black',WindowHandle1)
dev_display(EdgeDirection)
在QtCreator中
HObject ho_Image, ho_GrayImage, ho_EdgeAmplitude;
HObject ho_EdgeDirection;
HTuple hv_Width, hv_Height, hv_WindowHandle;
HTuple hv_WindowHandle1;
ReadImage(&ho_Image, "D:/bb/tu/1.jpg");
Rgb1ToGray(ho_Image, &ho_GrayImage);
SobelDir(ho_GrayImage, &ho_EdgeAmplitude, &ho_EdgeDirection, "sum_abs", 3);
//计算边缘
//参数2:输出图像
//参数3:输出边缘方向图像
//参数4:掩码类型
//参数5:掩码大小
GetImageSize(ho_GrayImage, &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_EdgeAmplitude, HDevWindowStack::GetActive());
SetWindowAttr("background_color","black");
OpenWindow(10,10,hv_Width,hv_Height,0,"visible","",&hv_WindowHandle1);
HDevWindowStack::Push(hv_WindowHandle1);
if (HDevWindowStack::IsOpen())
DispObj(ho_EdgeDirection, HDevWindowStack::GetActive());