问题
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
回答1:
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.
回答2:
Reducing the resolution of the image is the very definition of damaging the content. Lossless image compression does not reduce the resolution of the image. That said 5 megapixels is still a very high resolution and more then most applications should require. The exceptions might be scientific and medical applications. I would simply ensure that you are preserving the original until you know you can work with the result and choose your image compression method carefully to reduce artifacts.
来源:https://stackoverflow.com/questions/17343469/how-to-reduce-the-resolution-of-an-image-in-opencv