2D baker map code implementation
Show older comments
I am trying to implement the discretized baker map for the shuffling of pixels,i am not able to understand the discretized version of it clearly.and neither am i able to implement it properly on matlab it always show index out of bounds error. here is the link http://link.springer.com/chapter/10.1007/978-3-540-95972-4_16 please can somebody help. I am a beginner and this is my effort at it i know it is pathetic but still.
for i=1:row
for j=1:col
if(1<=j<row/2)
newcord1=((2*(j-1))+mod(i-1,2));
newcord2=(floor(0.5*(i-mod(i-1,2))+1));
im(i,j)=im(newcord2,newcord1);
elseif(row/2 <=j <=row)
newcord1=((2*(j-64))+mod(i,2));
newcord2=floor(0.5*(i-mod(i,2))+63);
im(i,j)=im(newcord2,newcord1);
end
end
end
5 Comments
Syahirah Rahim
on 12 Mar 2019
Hi. I also a beginner and new to MATLAB. I am trying to code on discretized baker map but I did not really understand.
Could you please tell me how this line works?
newcord1=((2*(j-1))+mod(i-1,2));
newcord2=(floor(0.5*(i-mod(i-1,2))+1));
and also
newcord1=((2*(j-64))+mod(i,2));
newcord2=floor(0.5*(i-mod(i,2))+63);
How can i divide the square size image to few verticle rectangle and implement above code?
su su maung
on 25 Sep 2020
Here is the matlab code for 2D baker map.
#################### Baker Map for 6x6 pixels ###########
A=[1:1:6;7:1:12;13:1:18;19:1:24;25:1:30;31:1:36];
tic;
N0=0;
N1=3;
N2=4;
n1=3;
n2=1;
n3=2;
for i=1:1% 9 times
for r=0:2
for s=0:5
X(r+1,s+1)=A(floor((6/n1)*(r-N0)+mod(s,(6/n1)))+1,floor((n1/6)*(s-mod(s,(6/n1)))+N0)+1);
end
end
for r=3:3
for s=0:5
X(r+1,s+1)=A(floor((6/n2)*(r-N1)+mod(s,(6/n2)))+1,floor((n2/6)*(s-mod(s,(6/n2)))+N1)+1);
end
end
for r=4:5
for s=0:5
X(r+1,s+1)=A(floor((6/n3)*(r-N2)+mod(s,(6/n3)))+1,floor((n3/6)*(s-mod(s,(6/n3)))+N2)+1);
end
end
%A=X;
end
toc
Parveiz Lone
on 28 Mar 2021
what about inverse
Zeina Abdullah
on 21 Feb 2022
Hi , please can you help me i need a chaotic interleaver code using baker map . please tell any thing can help me in my problem . @Parveiz Lone @su su maung @Syahirah Rahim @myetceteramail myetceteramail @Walter Roberson
Zeina Abdullah
on 22 Feb 2022
@su su maung if the input 8*8 how dose the code will be change
Answers (1)
Walter Roberson
on 12 Jan 2017
if(1<=j<row/2)
means
if ((1<=j)<row/2)
The first part, 1<=j, returns false (0) or true (1). That 0 or 1 is then compared to row/2.
You probably want
if 1<=j && j<row/2
Categories
Find more on Denoising and Compression 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!