-1

For a specific purpose I am trying to use Open CV's remap function to rotate an image by a specific angle (angle can be changed while using the function).

I have checked the open cv's documentation and example page and have come so far as to being able to rotate the image by let's say 180 degrees. The problem I still have is the angles in between.

for (int x = 0; x < src.cols; x++)
{
    for (int y = 0; x < src.rows; y++)
    {
        map_x.at<float>(y, x) = (float)(src.cols - x);
        map_y.at<float>(y, x) = (float)(src.rows - y);
    }
}

This sample code is for rotating 180 degrees.

My question again is, how achieve the rotation for any wanted angle.

Kinght 金
  • 17,681
  • 4
  • 60
  • 74
A. Cimet
  • 87
  • 7
  • read about homography transformations. After you have constructed your desited transformation, you can initialize the remap instead of using warping – Micka Mar 07 '19 at 07:42

1 Answers1

0

OpenCV already HAS this function:

Mat getRotationMatrix2D(Point2f center, double angle, double scale)

you can read more at: opencv docs