/// <summary> /// Rotates the image based on the rotationDegrees parameter. /// </summary> /// <param name="mat"></param> /// <param name="rotationDegrees"></param> /// <returns>Rotated Mat</returns> public Mat Rotate(Mat mat, double rotationDegrees) { Mat matrix = Imgproc.GetRotationMatrix2D(new Point(mat.Cols() / 2, mat.Rows() / 2), rotationDegrees, 1); Mat rotated = new Mat(); Imgproc.WarpAffine(mat, rotated, matrix, mat.Size()); return(rotated); }