在HDevelop中
read_image (Image, 'D:/bb/tu/5.jpg')
rgb1_to_gray(Image,Image1)
threshold (Image1, Region,[75] , [90])
smallest_circle (Region, Row, Column, Radius)
*获取区域最小外接圆数据
*参数1:输入给定区域
*参数2:输出中心行坐标-y坐标
*参数3:输出中心列坐标-x坐标
*参数4:输出外接圆半径
gen_circle (Circle, Row, Column, Radius)
*创建一个圆区域
get_image_size (Image1, Width, Height)
dev_open_window(10,10,Width, Height,'black',WindowHandle)
dev_display(Region)
dev_open_window(10,100,Width, Height,'black',WindowHandle1)
dev_display(Circle)
在QtCreator中
HObject ho_Image, ho_Image1, ho_Region, ho_Circle;
HTuple hv_Row, hv_Column, hv_Radius, hv_Width;
HTuple hv_Height, hv_WindowHandle, hv_WindowHandle1;
ReadImage(&ho_Image, "D:/bb/tu/5.jpg");
Rgb1ToGray(ho_Image, &ho_Image1);
Threshold(ho_Image1, &ho_Region, 75, 90);
SmallestCircle(ho_Region, &hv_Row, &hv_Column, &hv_Radius);
//获取区域最小外接圆数据
//参数1:输入给定区域
//参数2:输出中心行坐标-y坐标
//参数3:输出中心列坐标-x坐标
//参数4:输出外接圆半径
GenCircle(&ho_Circle, hv_Row, hv_Column, hv_Radius);
//创建一个圆区域
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_Region, 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_Circle, HDevWindowStack::GetActive());