在C / C旋转图像++ [英] Rotating an image in C/C++
问题描述
我需要code旋转在C ++中的图像,功能和MATLAB的imrotate功能。
请提出一个很好的链接。或者,如果有人能提供code为imrotate。
I need code for rotating an image in C++ which functions like imrotate function of matlab. Please suggest a good link. Or if someone can provide the code for imrotate.
或者至少请解释的算法。
Or at least please explain the algorithm.
它不是一门功课。我需要这个code为我的项目。我们可以使用任何外部库或code。
Its not a homework. I need this code for my project. And we can use any external library or code.
推荐答案
<一个href=\"http://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.0/OpenCV-2.0.0a-win32.exe/download\">OpenCV2.0有几个计算机视觉和图像处理工具。具体来说<一个href=\"http://opencv.willowgarage.com/documentation/cpp/geometric_image_transformations.html?highlight=warp#warpAffine\">warpAffine (通过定义旋转矩阵),将解决你的问题,旋转图像。
OpenCV2.0 has several computer vision and image processing tools. Specifically warpAffine (by defining the rotation matrix) will solve your problem with rotating an image.
在文档中提到的2×3变换矩阵如下:
The 2x3 transformation matrix mentioned in the documentation is as follows:
其中θ是旋转的角度和T X 和T 是沿翻译的 X 的和的是分别轴。
where θ is the angle of rotation and tx and ty is the translation along the x and y axes respectively.
您可以在这里得到源$ C $ C 。
You can get the source code here.
此外,OpenCV2.0拥有的许多的MATLAB式的功能,如 imread
等
Also, OpenCV2.0 has many MATLAB-esque functions like imread
, etc.
这篇关于在C / C旋转图像++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!