图像的几何变换是指用数学建模方法来描述图像位置大小形状等变化的方法,它通过数学建模实现对数字图像进行几何变换的处理,图像几何变换主要包括图像平移变换、比例缩放、旋转、仿射变换、透视变换和图像插值。
图a 图像变换处理前的图像
dev_close_window()
dev_open_window(0, 0, 512, 512, 'white', WindowHandle)
dev_set_color('black')
*在窗口画出region区域,闭合曲线a
draw_region(Region, WindowHandle)
*定义仿射变换矩阵
hom_mat2d_identity(HomMat2DIdentity)
*在2d齐次仿射变换中增加旋转变换,-0.3代表旋转角度,负值代表顺时针旋转,
*256、256代表基准点,此固定点不变
hom_mat2d_rotate(HomMat2DIdentity, -0.3, 256, 256, HomMat2DRotate)
*在2d齐次仿射变换中增加缩放变换,2.5、2.5代表缩放倍数
hom_mat2d_scale(HomMat2DRotate, 2.5, 2.5, 256, 256, HomMat2DScale)
*在2d齐次仿射变换中增加平移变换,32、32为行列的平移量
hom_mat2d_translate(HomMat2DScale, 32, 32, HomMat2DTranslate)
*针对region做仿射变换,region为变换前的区域