数字图像的旋转变换、镜像变换、错切变换以及平移变换等称为数字图像的几何变换。下文是数字图像旋转变换、镜像变换以及错切变换的基本原理的介绍以及C#代码的实现。
(1)数字图像旋转变换。
数字图像旋转变换基本原理:
数字图像旋转变换代码实现:
private void btn_Rotate_Click(object sender, EventArgs e)//旋转变换按钮
{
BmapNew = Rotate(60.0, BmapOld);
this.pictureNew.Image = BmapNew;
}
private Bitmap Rotate(double Angle,Bitmap mapOld)//旋转变换代码
{
double rad=Math.PI/180.0*Angle;
Matrix T = new Matrix(3, 3);
T.setElem(0, 0, Math.Cos(rad));
T.setElem(0, 1, -Math.Sin(rad));
T.setElem(1,0, Math.Sin(rad));