Pixel shuffling using henon chaotic map

I am working on the chaos based Image Encryption steps to be followed are
  1. Image of size 512*512 is divided into equal number of blocks , where total numberof blocks are 4906 with block size 8*8
  2. 2D Henon Chaotic Map is utilized to shuffle shuffle 8*8 pixels of each generated block which produces intra block shuffling
  3. blocks are shuffled
I request someone to help with the code

Respuestas (1)

Hari
Hari el 11 de Oct. de 2023
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.
% Load the default "cameraman.tif" image
image = imread('cameraman.tif');
% Display the original image
figure;
subplot(1, 2, 1);
imshow(image);
title('Original Image');
% Divide the image into blocks of size 8x8
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.
% Generate Henon chaotic map values
% Replace the parameters and initial conditions with appropriate values
a = 1.4;
b = 0.3;
x0 = 0.1;
y0 = 0.1;
n = size(blocks, 2); % Number of blocks
chaotic_map = zeros(1, n);
for i = 1:n
x = y0 + 1 - a * x0^2;
y = b * x0;
chaotic_map(i) = x;
x0 = x;
y0 = y;
end
  • You can use “randperm” function to generate random permutations. With these generated permutations you can shuffle the pixels within each of the 8x8 blocks.
% Shuffle the pixels within each block using Henon chaotic map
shuffled_blocks = zeros(size(blocks));
for i = 1:n
indices = randperm(64);
shuffled_blocks(:, i) = blocks(indices, i);
end
  • 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.
% Apply Henon chaotic map to the shuffled blocks
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.
% Reconstruct the shuffled image
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!

Categorías

Preguntada:

el 9 de Abr. de 2022

Respondida:

el 11 de Oct. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by