In OpenCV bound with Python, why the NumPy function can be used without it being called?

So, for example like below simple code:

import cv2
import numpy as np

image = cv2.imread(image.bmp)
imageCopy = image.copy()

In above example, I just copied the image by using one of the functions from NumPy module although I didn't write something like np.copy(), which means I didn't even call the copy() function from the NumPy module. At least, this is what I understand from my humble knowledge since I am still new to this. Why is this? Is it because OpenCV will automatically use the NumPy module if it is ever about array?

Upvotes: 1

Views: 512

Answers (1)

Bruce
Bruce

Reputation: 7132

You didn't call the np.copy function : you called the copy method of the image object that cv2.imread returned.

If you type print (dir(image)), you'll probably see the copy method that was actually called. This method might (or not) use the np.copy function for its own processing, but it's outside of your control.

Upvotes: 1

Related Questions