How to XOR the pixel values of image with a matrix containing decimal numbers?
2 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Shounak Shastri
on 16 Feb 2018
Edited: Shounak Shastri
on 16 Feb 2018
_"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.
1 Comment
Abubakar Abba
on 2 Aug 2021
Edited: Abubakar Abba
on 2 Aug 2021
Nice. How about decrypting it to get back the original image using bitxor after applying the bitxor as stated?
See Also
Categories
Find more on Encryption / Cryptography in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!