#include <iostream>
#include <opencv2/opencv.hpp>
#include <string>

using namespace std;
using namespace cv;

string fname[] = {"a.png","angel.png","bill.png",
"car.png", "lena.png","tiffany.png"};

void R(Mat& im) {
	int h = im.rows;
	int w = im.cols;
	double scale = 512.0*512.0 / (h*w);
	scale = sqrt(scale);
	Size sz(int(w*scale), int(h*scale));
	resize(im, im, sz);
}

void display() {
	for (int i = 0; i < 6; i++) {
		Mat im = imread(fname[i]);
		R(im);
		imshow("display", im);
		waitKey(1000);
	}
}

int main()
try
{
	cout << "先resize\n";
	display();
	return 0;
}
catch (exception& e) {
	cerr << e.what();
	return 1;
}
附件列表