opencv基礎-flip函式:實現影象翻轉

NO IMAGE

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);