在HDevelop中
ma.jpg
read_image(Image,'D:/bb/tu/ma.jpg') dev_open_window(0,0,500,300,'black',WindowHandle) dev_display(Image) get_image_size (Image, Width, Height) draw_rectangle1 (WindowHandle, Row1, Column1, Row2, Column2) gen_rectangle1 (Rectangle, Row1, Column1, Row2, Column2) reduce_domain(Image,Rectangle,ImageReduced) *获取区域图像,注意:并不缩小图像的实际尺寸 *参数1:输入的图像 *参数2:输入的区域 *参数3:输出的图像,是Image中Region的那部分图像 dev_open_window(0,0,500,300,'black',WindowHandle1) dev_display(ImageReduced) get_image_size (Image, Width1, Height1)
在QtCreator中
HObject ho_Image, ho_Rectangle, ho_ImageReduced;
HTuple hv_WindowHandle, hv_Width, hv_Height;
HTuple hv_Row1, hv_Column1, hv_Row2, hv_Column2, hv_WindowHandle1;
HTuple hv_Width1, hv_Height1;
ReadImage(&ho_Image, "D:/bb/tu/ma.jpg"); SetWindowAttr("background_color","black"); OpenWindow(0,0,500,300,0,"visible","",&hv_WindowHandle); HDevWindowStack::Push(hv_WindowHandle); if (HDevWindowStack::IsOpen()) DispObj(ho_Image, HDevWindowStack::GetActive()); GetImageSize(ho_Image, &hv_Width, &hv_Height); DrawRectangle1(hv_WindowHandle, &hv_Row1, &hv_Column1, &hv_Row2, &hv_Column2); GenRectangle1(&ho_Rectangle, hv_Row1, hv_Column1, hv_Row2, hv_Column2); ReduceDomain(ho_Image, ho_Rectangle, &ho_ImageReduced); //获取区域图像,注意:并不缩小图像的实际尺寸 //参数1:输入的图像 //参数2:输入的区域 //参数3:输出的图像,是Image中Region的那部分图像 SetWindowAttr("background_color","black"); OpenWindow(0,0,500,300,0,"visible","",&hv_WindowHandle1); HDevWindowStack::Push(hv_WindowHandle1); if (HDevWindowStack::IsOpen()) DispObj(ho_ImageReduced, HDevWindowStack::GetActive()); GetImageSize(ho_Image, &hv_Width1, &hv_Height1);