Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Reduce the Resolution of an Image in OpenCV?

Tags:

c++

image

opencv

So, I have an image from a digital scanner, its resolution is 26 Megapixel. I want to reduce the resolution of the image to 5 Megapixel.

Is it possible to reduce the resolution of an image without damaging the contents?

If yes, how to reduce it in OpenCV implementation?

Any help would be greatly appreciated. Thankyou

like image 688
anarchy99 Avatar asked Dec 09 '22 14:12

anarchy99


1 Answers

You can use cv2::resize()

resize(src, dst, Size(), factor, factor, interpolation);

here, interpolation can be selected as cv::INTER_LANCZOS4 to obtain best interpolation results.

factor is the sampling ratio and in order to transform from 26mp to 5mp you may need it to be 2.28

Downsampling always introduces some information and detail loss.

like image 154
fatihk Avatar answered Dec 11 '22 04:12

fatihk