Scaling an image makes no discernable change

Viewed 54

I am using two different ways to re-size an image, but all three look exactly the same...

What am I doing wrong that no scaling occurs?

import cv2 as cv
import numpy as np

path = "resources/Shapes.png"
img = cv.imread(path)
cv.imshow("img", img)

res1 = cv.resize(img, None, fx = 2, fy = 2, interpolation = cv.INTER_CUBIC)
cv.imshow("res1", res1)

height, width = img.shape[:2]
res2 = cv.resize(img, (2 * width, 2 * height), interpolation = cv.INTER_CUBIC)
cv.imshow("res2", res2)

k = cv.waitKey(0)
1 Answers

Just putting this here for future reference:

The code above works, the issue was that imshow does not always show the true size of the image, by saving the different images, or simply examining them with res1.shape vs img.shape, you can see the true size of the image.

Related