本文介紹了使用 OpenCV 將圖像旋轉(zhuǎn) 90 度的最簡單方法?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
將 IplImage/cv::Mat 旋轉(zhuǎn) 90 度的最佳方法是什么(在 c/c++ 中)?我認(rèn)為一定有比使用矩陣轉(zhuǎn)換它更好的東西,但我似乎在 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 開始,生活變得更簡單了,您現(xiàn)在可以在一行代碼中旋轉(zhuǎn)圖像:
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
這篇關(guān)于使用 OpenCV 將圖像旋轉(zhuǎn) 90 度的最簡單方法?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!