How to create thumbnails using opencv-python?

I am trying to reduce the image (using anti-aliasing) using a method Python-Pillow im.thumbnail().

My code looks like this:

MAXSIZE = 1024
im.thumbnail(MAXSIZE, Image.ANTIALIAS)

Can you tell me an alternative in opencv-pythonto perform this recalibration operation?

+4
source share
1 answer

You can use cv2.resize. Documentation here: http://docs.opencv.org/modules/imgproc/doc/geometric_transformations.html#resize

In your case, if the input image im is a numpy array:

maxsize = (1024,1024) 
imRes = cv2.resize(im,maxsize,interpolation=cv2.CV_INTER_AREA)

(INTER_CUBIC, INTER_NEAREST, INTER_AREA,...), , , CV_INTER_AREA.

+5

All Articles