Last active
August 29, 2015 14:06
-
-
Save aledalgrande/3999e4ac00f8cf3c6f78 to your computer and use it in GitHub Desktop.
Fast 90°, -90°, 180° rotations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// rotate 90° CW: flip the transpose on Y | |
inline void rotate90CW(cv::Mat& input) | |
{ | |
cv::flip(input.t(), input, 1); | |
} | |
// rotate -90° CW: flip the transpose on X | |
inline void rotate90CCW(cv::Mat& input) | |
{ | |
cv::flip(input.t(), input, 0); | |
} | |
// rotate 180°: flip on X and Y | |
inline void rotate180(cv::Mat& input) | |
{ | |
cv::flip(input, input, -1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment