前言
在Halcon中经常需要矩阵对图像做各种操作,本文就来介绍如何求一个仿射变换矩阵的逆矩阵。
halcon代码
csharp
dev_open_file_dialog ('read_image', 'default', 'default', Selection)
read_image (Image, Selection)
get_image_size (Image, Width, height)
hom_mat2d_identity (HomMat2DIdentity)
hom_mat2d_rotate (HomMat2DIdentity, 45, Width/2, height/2, HomMat2DRotate)
affine_trans_image (Image, ImageAffineTrans, HomMat2DRotate, 'constant', 'false')
hom_mat2d_invert (HomMat2DRotate, HomMat2DInvert)
affine_trans_image (ImageAffineTrans, ImageAffineTrans1, HomMat2DInvert, 'constant', 'false')
运算结果
1)旋转前

2)绕着中心点逆时针旋转45度后

3)绕着中心点顺时针旋转45度后
