Resize image OpenCV

后端 未结 2 1810
死守一世寂寞
死守一世寂寞 2020-12-29 02:25

If I have an image called inImg and an image named outImg how can I resize outImg so that it is 75% the size of inImg?

相关标签:
2条回答
  • 2020-12-29 03:17

    If you want 75% along each axis, you should be able to use cv::resize to do:

    cv::resize(inImg, outImg, cv::Size(), 0.75, 0.75);
    
    0 讨论(0)
  • 2020-12-29 03:25

    Use cv::resize. Following code will resize outImg to 0.75 times the dimensions of inImg with CV_INTER_LINEAR type of interpolation.

    cv::resize(outImg, outImg, cv::Size(inImg.cols * 0.75,inImg.rows * 0.75), 0, 0, CV_INTER_LINEAR);
    

    4th and 5th argument should be left 0 or not assigned to take 3rd argument as size otherwise it will scale according to 4th and 5th arguments. (OpenCV3 resize)

    0 讨论(0)
提交回复
热议问题