opencv基础-flip函数:实现图像翻转
flip函数原型
void flip(InputArray src, OutputArray dst, int flipCode);
flag的值
ROTATE_90_CLOCKWISE = 0, //!<Rotate 90 degrees clockwise
ROTATE_180 = 1, //!<Rotate 180 degrees clockwise
ROTATE_90_COUNTERCLOCKWISE = 2, //!<Rotate 270 degrees clockwise
完整代码
#include <opencv2\opencv.hpp>
#include <opencv\highgui.h>
#include <iostream>
#include <algorithm>
using namespace std;
using namespace cv;
int main()
{
const string dstName = "";
Mat img = imread(dstName, 1);
cout << img.rows << endl;
Mat dst;
flip(img, dst, 0);
//namedWindow("test");
imshow("name", dst);
waitKey(0);
system("pause");
return 0;
}
涉及到的函数
Mat imread( const string& filename, int flags=1 );
void imshow(const string& winname, InputArray mat);
int waitKey(int delay = 0);