According to this answer, B=A
where A
is a numpy array, B
should be pointing to the same object A
.
import cv2
import numpy as np
img = cv2.imread('rose.jpeg')
print("img.shape: ", np.shape(img))
img2 = img
img = cv2.resize(img, (250,100))
print("img.shape: ", img.shape)
print("img2.shape:", img2.shape)
Output:
img.shape: (331, 500, 3)
img.shape: (100, 250, 3)
img2.shape: (331, 500, 3)
It seems to be a very basic question, but I have been scratching my head over this. Could someone please explain what's happening behind it?