本文介紹了使用 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 度的最簡單方法?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!