Skip to content

Instantly share code, notes, and snippets.

@codebudo
Created July 30, 2019 04:50
Show Gist options
  • Save codebudo/2652866589e405ed1d8f93006675c1b9 to your computer and use it in GitHub Desktop.
Save codebudo/2652866589e405ed1d8f93006675c1b9 to your computer and use it in GitHub Desktop.
OpenCV example resizing an image with CPU
#include <stdio.h>
#include <opencv2/opencv.hpp>
using namespace cv;
int main(int argc, char** argv ) {
if ( argc != 2 ) {
printf("usage: resizecpu <Image_Path>\n");
return -1;
}
Mat inImage;
Mat outImage;
inImage = imread( argv[1], 1 );
if ( !inImage.data ) {
printf("No image data \n");
return -1;
}
for(int i=0; i < 100; i++){
//resize
resize(inImage, outImage, Size(4096, 4096));
imwrite("output_cpu.jpg", outImage);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment