opencv C++图像/视频旋转 90度 180度 270度
程序员文章站
2022-05-17 10:08:21
...
上代码:
#include <opencv2/opencv.hpp>
using namespace cv;
int main()
{
Mat src = imread("1.jpg",1);
Mat srcCopy= Mat(src.rows, src.cols,src.depth());
transpose(src, srcCopy);
//flip(srcCopy, srcCopy, 1); //rotate 270
flip(srcCopy, srcCopy, 0); //rotate 90
namedWindow("source Image", WINDOW_AUTOSIZE );
imshow("source Image", src);
namedWindow("Display Image", WINDOW_AUTOSIZE );
imshow("Display Image", srcCopy);
waitKey(0);
return 0;
}
Mat src = imread("1.jpg",1);
Mat srcCopy= Mat(src.rows, src.cols,src.depth());
flip(src, srcCopy, -1); //rotate 180
后面上图更直观表示//to do