Resize image OpenCV

后端 未结 2 1809
死守一世寂寞
死守一世寂寞 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: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)

提交回复
热议问题