未测试,仅搬运
cv::Mat srcimg = cv::imread(src_filepath);
cv::Mat destimg = cv::imread(lowres_path);
cv::Size img_size = srcimg.size();
int img_width = img_size.width;
int img_height = img_size.height;
double percentage = 1000.0/(img_width);
double new_height = img_height * percentage;
cv::Size new_size = cv::Size(1000.0, new_height);
cv::resize(srcimg, destimg, new_size,0,0,CV_INTER_LANCZOS4);
cv::imwrite(lowres_path, destimg);
仔细看两张图片有什么区别
转自:
http://answers.opencv.org/question/94138/opencv-resize-quality/