在 C/C++ 中旋转图像
我需要在 C++ 中旋转图像的代码,其功能类似于 matlab 的 imrotate 函数.请推荐一个好的链接.或者如果有人可以提供 imrotate 的代码.
或者至少请解释一下算法.
这不是家庭作业.我的项目需要此代码.我们可以使用任何外部库或代码.
解决方案获取源代码.
此外,OpenCV2.0 有 许多 MATLAB 风格的函数,例如 imread
等.
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.
Its not a homework. I need this code for my project. And we can use any external library or code.
解决方案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.
The 2x3 transformation matrix mentioned in the documentation is as follows:
where θ is the angle of rotation and tx and ty is the translation along the x and y axes respectively.
You can get the source code here.
Also, OpenCV2.0 has many MATLAB-esque functions like imread
, etc.
相关文章