Easiest way to rotate by 90 degrees an image using OpenCV?

后端 未结 7 1078
轮回少年
轮回少年 2020-11-29 05:52

What is the best way (in c/c++) to rotate an IplImage/cv::Mat by 90 degrees? I would assume that there must be something better than transforming it using a matrix, but I ca

7条回答
  •  独厮守ぢ
    2020-11-29 06:23

    As of OpenCV3.2, life just got a bit easier, you can now rotate an image in a single line of code:

    cv::rotate(image, image, cv::ROTATE_90_CLOCKWISE);
    

    For the direction you can choose any of the following:

    ROTATE_90_CLOCKWISE
    ROTATE_180
    ROTATE_90_COUNTERCLOCKWISE
    

提交回复
热议问题