OpenCvSharp 图像旋转

/// <summary>
        /// 图像旋转
        /// </summary>
        private Mat MatRotate(Mat src, float angle)
        {
            Mat dst = new Mat();
            Point2f center = new Point2f(src.Cols / 2, src.Rows / 2);
            Mat rot = Cv2.GetRotationMatrix2D(center, angle, 1);
            Size2f s2f = new Size2f(src.Size().Width, src.Size().Height);
            Rect box = new RotatedRect(new Point2f(0, 0), s2f, angle).BoundingRect();
            double xx = rot.At<double>(0, 2) + box.Width / 2 - src.Cols / 2;
            double zz = rot.At<double>(1, 2) + box.Height / 2 - src.Rows / 2;
            rot.Set(0, 2, xx);
            rot.Set(1, 2, zz);
            Cv2.WarpAffine(src, dst, rot, box.Size);
            return dst;
        }

OpenCvSharp 图像旋转;

参考地址:https://blog.csdn.net/hansLin_918/article/details/91358328

原文地址:https://www.cnblogs.com/shuaimeng/p/11883406.html