Advertisement
Kojima0502

resize

Nov 17th, 2013
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.67 KB | None | 0 0
  1. #include <opencv2/core/core.hpp>
  2. #include <opencv2/imgproc/imgproc.hpp>
  3. #include <opencv2/highgui/highgui.hpp>
  4.  
  5. int
  6. main(int argc, char *argv[])
  7. {  float up;
  8.     cv::Mat src_img = cv::imread(argv[1], 1);
  9.     if(src_img.empty()) return -1;
  10.    up=atof(argv[3]);
  11.    cv::Mat dst_img(src_img.rows*up, src_img.cols*up, src_img.type());
  12.  
  13.  
  14.  
  15.     // INTER_CUBIC(バイキュービック補間)でのサイズ変更
  16.     cv::resize(src_img, dst_img, dst_img.size(), cv::INTER_CUBIC);
  17.    
  18.     cv::namedWindow("resize image", CV_WINDOW_AUTOSIZE|CV_WINDOW_FREERATIO);
  19.     cv::imshow("resize image", dst_img);
  20.    
  21.     cv::imwrite(argv[2],dst_img);
  22.     cv::waitKey(0);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement