Skip to content
Advertisement

A copy of image array not working in python

So I am working on Image Encryption and using a chaotic map for diffusion. So I have been trying to rearrange pixels of an image and made a rearranging code. It works fine for normal arrays but when I use it on image, without any rearranging, just a simple copy, the new array doesn’t make any image, in fact np.array_equal prints false. Here is the code snipet:

JavaScript

It works just fine for other simple arrays with size(x,y,3) which is the same format image array is stored. How do I make it work?

Advertisement

Answer

Ok after searching for quite some time, and even trying cv2 for imread, i found my working solution to be : replace encryptedImage2 = np.zeros(shape=image.shape, dtype=np.uint8) with encryptedImage2 = np.copy(image)

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement