Easiest way to rotate by 90 degrees an image using OpenCV?(使用 OpenCV 将图像旋转 90 度的最简单方法?)
问题描述
将 IplImage/cv::Mat 旋转 90 度的最佳方法是什么(在 c/c++ 中)?我认为一定有比使用矩阵转换它更好的东西,但我似乎在 API 和在线中找不到其他任何东西.
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 can't seem to find anything other than that in the API and online.
推荐答案
从 OpenCV3.2 开始,生活变得更简单了,您现在可以在一行代码中旋转图像:
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
这篇关于使用 OpenCV 将图像旋转 90 度的最简单方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 OpenCV 将图像旋转 90 度的最简单方法?


- 从父 CMakeLists.txt 覆盖 CMake 中的默认选项(...)值 2021-01-01
- 使用 __stdcall & 调用 DLLVS2013 中的 GetProcAddress() 2021-01-01
- 哪个更快:if (bool) 或 if(int)? 2022-01-01
- OpenGL 对象的 RAII 包装器 2021-01-01
- XML Schema 到 C++ 类 2022-01-01
- 将函数的返回值分配给引用 C++? 2022-01-01
- GDB 不显示函数名 2022-01-01
- 将 hdc 内容复制到位图 2022-09-04
- 如何提取 __VA_ARGS__? 2022-01-01
- DoEvents 等效于 C++? 2021-01-01