OpenCV resize image

image = cv2.resize(src, dsize, fx, fy, interpolation)


src    The file path in which the input image resides.
dsize    The size of the output image, which adheres to the syntax (width, height).
fx    The scale factor for the X axis.
fy    The scale factor for the Y axis.
interpolation    The technique for adding or removing pixels during the resizing process. The default is cv2.INTER_LINEAR.


Here are the values for the interpolation argument:

cv2.INTER_LINEAR The standard bilinear interpolation, ideal for enlarged images.
cv2.INTER_NEAREST The nearest neighbor interpolation, which, though fast to run, creates blocky images.
cv2.INTER_AREA The interpolation for the pixel area, which scales down images.
cv2.INTER_CUBIC The bicubic interpolation with 4×4-pixel neighborhoods, which, though slow to run, generates high-quality instances.
cv2.INTER_LANCZOS4 The Lanczos interpolation with an 8×8-pixel neighborhood, which generates images of the highest quality but is the slowest to run.
comments are disabled for this article
Popular Posts