s1 = image.shape # Image is an opencv2 image (ndarray)
w,h,d = s1
image_ = cv2.resize(image, (w*2, h*2), interpolation = cv2.INTER_CUBIC)
s2 = image_.shape
In the above, I asked for output to resize to (960,1280), but I get (1280, 960).
What's up with that?
image_ = cv2.resize(image, None, fx=2, fy=2, interpolation = cv2.INTER_CUBIC)
... works as expected. (No points for pointing this out).
Runnable example:
import cv2
def run():
cap = cv2.VideoCapture(0)
while cap.isOpened():
success, image = cap.read() # (480, 640, 3)
if not success:
print("Ignoring empty camera frame.")
continue
s1 = image.shape
w, h, d = s1
s2 = (w * 2, h * 2)
image_ = cv2.resize(image, s2, interpolation=cv2.INTER_CUBIC)
s3 = image_.shape
cv2.imshow('Camera',
image_
)
key = cv2.waitKey(5)
if key & 0xFF == 27:
break
cap.release()
if __name__ == '__main__':
run()

