How to XOR the pixel values of image with a matrix containing decimal numbers?

1 次查看(过去 30 天)
I am performing image encryption using key values of chaotic maps. I have converted the key values from vector into a matrix. The matrix size is 32*96 and the image is of size 32*96. I have to XOR each pixel of the image with the key present in the matrix. I am using color image. Thanks in advance

回答(1 个)

Shounak Shastri
Shounak Shastri 2018-2-16
编辑:Shounak Shastri 2018-2-16
_"I am using color image."_
Lets say your input image is I.
I = imread ('image.tif');
If you check the workspace after you execute this line, you would have
size (I) = [32 96 3];
The last 3 represents the Red, Green and Blue components of the image. You can use rgb2gray to convert it into a grayscale image. If you want to xor the colour image, then you would either need more chaos coordinates or you would have to use the same coordinates three times on the three planes saperately.
_"I am performing image encryption using key values of chaotic maps."_
Now, your chaos coordinates might be floating point numbers. So you can sort them by
[a, ind] = sort (chaosCoordinates);
Once you do this, you would have the chaotic values in "a" and their indices in "ind". You can now convert the vector of indices in a matrix of the size you need. This is easier than converting the chaos coordinates to integer values.
now you can simply do bitxor to get the encrypted image.

类别

Help CenterFile Exchange 中查找有关 Encryption / Cryptography 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by