Hi Tejashree,
I understand that you are working on chaos-based image encryption, and you want to perform pixel shuffling using the Henon chaotic map with block size 8x8.
To mask the image by chaos-based encryption, you can follow these steps:
- Load the image and divide the image into blocks of size 8x8 using the “im2col” function. Here I am using the default cameraman image from MATLAB for applying the encryption.
image = imread('cameraman.tif');
blocks = im2col(image, [8 8], 'distinct');
- Generate a 2D Henon chaotic map which you can use to shuffle the pixels with each blocks. Replace the initial values and parameters according to your problem specifications.
chaotic_map = zeros(1, n);
- You can use “randperm” function to generate random permutations. With these generated permutations you can shuffle the pixels within each of the 8x8 blocks.
shuffled_blocks = zeros(size(blocks));
shuffled_blocks(:, i) = blocks(indices, i);
- Apply the Henon chaotic map to the shuffled blocks. This can be done by element-wise multiplication of the shuffled blocks with the Henon chaotic map values.
shuffled_blocks = shuffled_blocks .* chaotic_map;
- Reconstruct the shuffled image using the “col2im” function. This function converts the shuffled blocks back into an image by rearranging the columns into their original positions.
shuffled_image = col2im(shuffled_blocks, [8 8], size(image), 'distinct');
By following the above steps, you can generate a shuffled image with 8x8 block size for the given image.
Here is the output observed for the default MATLAB cameraman image:
Refer to the documentation of “im2col” and “col2im” for more information regarding interconversion of images to blocks and vice versa.
Hope this helps!