I'm currently working on a Python program that involves using NumPy for image processing. However, I've encountered an issue when trying to create a deep copy of a NumPy array instead of just copying the reference.
Here's a snippet of my code, where I read in a PNG image and assign it to imageOriginal_3d:
width, height, pngData, metaData = png.Reader(file).asDirect()
planeCount = metaData['planes']
print('Image Size: ' + str(width) + 'x' + str(height) + ' Pixel')
image_2d = np.vstack(list(map(np.uint8, pngData)))
imageOriginal_3d = np.reshape(image_2d, (width, height, planeCount))
imageEdited_3d = imageOriginal_3d // TODO: CREATE DEEP COPY
My intention is to edit imageEdited_3d without affecting the values in imageOriginal_3d. However, when I modify imageEdited_3d, the changes currently also appear in imageOriginal_3d.