Pixel Shuffling using Chaotic Tinkerbell map(https://en.wikipedia.org/wiki/Tinkerbell_map) and Henon Map(https://en.wikipedia.org/wiki/H%C3%A9non_map)
13 views (last 30 days)
Show older comments
Renjith V Ravi
on 3 Feb 2017
Commented: Walter Roberson
on 5 Feb 2017
I have tried to do double shuffling of pixels in an image using Tinkerbell mal and Henon Map.The code is shown below. It is showing an error "Index exceeds matrix dimensions".Please help me in this regard
clear all
close all
clc
in_img=double(imread('cameraman.tif'));
in_img=double(in_img)/255;
subplot(221)
imshow(in_img)
x=in_img;
[m,n]=size(in_img);
%Shuffling using Tinkerbel Map
% a=0.9,b=-0.6013,c=2.0,d=0.50;
a=0.3;b=0.6000;c=2.0;d=0.27;
for i=1:m
for j=1:n
%Shuffling using Tinkerbel Map
r = [round(abs((i^2)-(j^2)+(a*i)+(b*j))),round(abs((2*i*j)+(c*i)+(d*j)))]
ggg(i,j)=in_img(r(1)+1,r(2)+1);
end
end
Tinkerbel_Shuffled=ggg;
subplot(222)
imshow(Tinkerbel_Shuffled,[])
%Shuffling using Henon map Map
[m,n]=size(in_img);
a = 1.4;b=0.3;
for i=1:m
for j=1:n
%Shuffling using Henon map Map
r = [round(abs(1-(a*(i^2))+j)),round(abs(b*i))];
ggg(i,j)=Tinkerbel_Shuffled(r(1)+1,r(2)+1);
end
end
subplot(223)
imshow(Double_Shuffled,[])
0 Comments
Accepted Answer
Geoff Hayes
on 3 Feb 2017
Renjith - the problem is with the r
r = [round(abs((i^2)-(j^2)+(a*i)+(b*j))),round(abs((2*i*j)+(c*i)+(d*j)))]
There is no guarantee that the either component of this array will be valid indices into the image
ggg(i,j)=in_img(r(1)+1,r(2)+1);
What you can do is to find the modulus m and n for the first and second component of r respectively.
r = mod([round(abs((i^2)-(j^2)+(a*i)+(b*j))),round(abs((2*i*j)+(c*i)+(d*j)))], [m,n]);
The same would need to be done for the Henon Mapping
r = mod([round(abs(1-(a*(i^2))+j)),round(abs(b*i))],[m n]);
Though I don't know how this will impact the encryption...
Try the above and see what happens!
2 Comments
More Answers (0)
See Also
Categories
Find more on Labeling, Segmentation, and Detection 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!