![](https://img2022.cnblogs.com/blog/1502586/202201/1502586-20220120221800438-786509633.png)
![](https://img2022.cnblogs.com/blog/1502586/202203/1502586-20220312112126851-2061058872.jpg)
在HDevelop中
dev_close_window ()
read_image (Image, 'D:/bb/tu/1.jpg')
rgb1_to_gray (Image, GrayImage)
sobel_amp (GrayImage, EdgeAmplitude, 'sum_abs', 3)
*计算边缘
*参数2:输出图像
*参数3:掩码类型
*参数4:掩码大小
get_image_size (GrayImage, Width, Height)
dev_open_window(10,10,Width, Height,'black',WindowHandle)
dev_display(EdgeAmplitude)
![](https://img2022.cnblogs.com/blog/1502586/202203/1502586-20220312112212025-1557790313.png)
在QtCreator中
HObject ho_Image, ho_GrayImage, ho_EdgeAmplitude;
HTuple hv_Width, hv_Height, hv_WindowHandle;
ReadImage(&ho_Image, "D:/bb/tu/1.jpg");
Rgb1ToGray(ho_Image, &ho_GrayImage);
SobelAmp(ho_GrayImage, &ho_EdgeAmplitude, "sum_abs", 3);
//计算边缘
//参数2:输出图像
//参数3:掩码类型
//参数4:掩码大小
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());
![](https://img2022.cnblogs.com/blog/1502586/202201/1502586-20220120221242675-908265425.png)