#include <stdio.h>
#include <iostream>
#include <string>
#include <opencv2\opencv.hpp>
using namespace std;
using namespace cv;
int main()
{
Mat img = imread("person3.jpeg");
Mat dst;
namedWindow("原图", WINDOW_NORMAL);
imshow("原图", img);
flip(img, dst, 0);
namedWindow("沿x轴翻转", WINDOW_NORMAL);
imshow("沿x轴翻转", dst);
flip(img, dst, 1);
namedWindow("沿y轴翻转", WINDOW_NORMAL);
imshow("沿y轴翻转", dst);
flip(img, dst, -1);
namedWindow("先沿x轴,再沿y轴", WINDOW_NORMAL);
imshow("先沿x轴,再沿y轴", dst);
waitKey(0);
return 0;
}

|