初识Opencv4.X----图像尺寸变换

//图像沿xy轴翻转
#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);//x轴
	namedWindow("沿x轴翻转", WINDOW_NORMAL);
	imshow("沿x轴翻转", dst);
	flip(img, dst, 1);//y轴
	namedWindow("沿y轴翻转", WINDOW_NORMAL);
	imshow("沿y轴翻转", dst);
	flip(img, dst, -1);//先沿x轴,再沿y轴
	namedWindow("先沿x轴,再沿y轴", WINDOW_NORMAL);
	imshow("先沿x轴,再沿y轴", dst);
	waitKey(0);
	return 0;
}

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_46146657/article/details/120229924