5.jpg
在HDevelop中
dev_update_off() read_image(Image,'D:/bb/tu/5.jpg') get_image_size (Image, Width, Height) hom_mat2d_identity (HomMat2D) *创建一个仿射变换矩阵 hom_mat2d_scale (HomMat2D, 0.5, 0.5, 0, 0, HomMat2DScale) *计算缩放变换矩阵 *参数1:输入变换矩阵 *参数2:Row方向(y方向)的缩放系数 *参数3:Column方向(x方向)的缩放系数 *参数4:缩放中心的x坐标 *参数5:缩放中心的y坐标 *参数6:输出变换矩阵 affine_trans_image (Image, ImageAffineTrans, HomMat2DScale, 'constant', 'false') *对图像应用任意仿射2D变换 dev_open_window(0,0,521,338,'black',WindowHandle) dev_display(ImageAffineTrans) get_image_size (ImageAffineTrans, Width1, Height1)
在QtCreator中
HObject ho_Image, ho_ImageAffineTrans;
HTuple hv_Width, hv_Height, hv_HomMat2D, hv_HomMat2DScale;
HTuple hv_WindowHandle, hv_Width1, hv_Height1;
ReadImage(&ho_Image, "D:/bb/tu/5.jpg"); GetImageSize(ho_Image, &hv_Width, &hv_Height); HomMat2dIdentity(&hv_HomMat2D); //创建一个仿射变换矩阵 HomMat2dScale(hv_HomMat2D, 0.5, 0.5, 0, 0, &hv_HomMat2DScale); //计算缩放变换矩阵 //参数1:输入变换矩阵 //参数2:Row方向(y方向)的缩放系数 //参数3:Column方向(x方向)的缩放系数 //参数4:缩放中心的x坐标 //参数5:缩放中心的y坐标 //参数6:输出变换矩阵 AffineTransImage(ho_Image, &ho_ImageAffineTrans, hv_HomMat2DScale, "constant", "false"); //对图像应用任意仿射2D变换 SetWindowAttr("background_color","black"); OpenWindow(0,0,521,338,0,"visible","",&hv_WindowHandle); HDevWindowStack::Push(hv_WindowHandle); if (HDevWindowStack::IsOpen()) DispObj(ho_ImageAffineTrans, HDevWindowStack::GetActive()); GetImageSize(ho_ImageAffineTrans, &hv_Width1, &hv_Height1);