halcon-hom_mat2d_rotate计算旋转变换矩阵_旋转角度

在HDevelop中

5.jpg

halcon-hom_mat2d_rotate计算旋转变换矩阵_ide_02



dev_update_window ('off')
read_image(Image,'D:/bb/tu/5.jpg')

hom_mat2d_identity (HomMat2D)
*创建一个仿射变换矩阵

jiaodu:=30
tuple_rad (jiaodu, Rad)
*度转换为弧度


hom_mat2d_rotate (HomMat2D, Rad, 154, 158, HomMat2DRotate)
*计算旋转变换矩阵
*参数1:输入变换矩阵
*参数2:旋转角度(弧度)
*参数3:变换的不动点(x坐标)
*参数4:变换的不动点(y坐标)
*参数5:输出变换矩阵

affine_trans_image (Image, ImageAffineTrans, HomMat2DRotate, 'constant', 'false')
dev_open_window(0,0,521,338,'black',WindowHandle)
dev_display(ImageAffineTrans)


halcon-hom_mat2d_rotate计算旋转变换矩阵_旋转角度_03




在QtCreator中

HObject  ho_Image, ho_ImageAffineTrans;
HTuple hv_HomMat2D, hv_jiaodu, hv_Rad, hv_HomMat2DRotate;
HTuple hv_WindowHandle;
ReadImage(&ho_Image, "D:/bb/tu/5.jpg");

HomMat2dIdentity(&hv_HomMat2D);
//创建一个仿射变换矩阵

hv_jiaodu = 30;
TupleRad(hv_jiaodu, &hv_Rad);
//度转换为弧度


HomMat2dRotate(hv_HomMat2D, hv_Rad, 154, 158, &hv_HomMat2DRotate);
//计算旋转变换矩阵
//参数1:输入变换矩阵
//参数2:旋转角度(弧度)
//参数3:变换的不动点(x坐标)
//参数4:变换的不动点(y坐标)
//参数5:输出变换矩阵

AffineTransImage(ho_Image, &ho_ImageAffineTrans, hv_HomMat2DRotate, "constant",
"false");
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());


halcon-hom_mat2d_rotate计算旋转变换矩阵_旋转角度_04