Azzera filtri
Azzera filtri

Why i didnt get the image back during decryption using this inverse code ?

4 visualizzazioni (ultimi 30 giorni)
I used the below code for image scrambling and unscrambling. But i didnt get the exact image in unscrambling. In the decrypted image the upper portion is at the bottom position, that is the hat in the lena image comes at bottom. Please help me to rectify it.
ite=1;
[rown,coln]=size(im);
for i=1:rown
for j=1:coln
itecount=1;
nrowp=i;
ncolp=j;
while(itecount<=ite)
newcord =[1 1;1 2]*[nrowp ncolp]';
nrowp=newcord(1);
ncolp=newcord(2);
itecount=itecount+1;
end
encim(i,j)=im((mod(nrowp,rown)+1),(mod(ncolp,coln)+1));
end
end
%INVERSE
figure,imshow(im)
impixelinfo
figure,imshow(uint8(encim))
impixelinfo
[rown,coln]=size(encim)
for i=1:rown
for j=1:coln
itecount=1;
nrowp=i;
ncolp=j;
while(itecount<=ite)
newcord =[2 -1;-1 1]*[nrowp-1 ncolp-1]';
nrowp=newcord(1);
ncolp=newcord(2);
itecount=itecount+1;
end
decim(i,j)=encim((mod(nrowp,rown)+1),(mod(ncolp,coln)+1));
end
end
figure,imshow(uint8(decim))
impixelinfo
  4 Commenti
Jan
Jan il 8 Mar 2018
@Sneha P S: There is no need to be sorry. But let me mention, that your code is still not formatted properly. Now there is a blank line after each line of code, some parts are recognized as code (due to the leading spaces), but some are not. Please read: Tutorial: How to format text in the forum.

Accedi per commentare.

Risposte (1)

Image Analyst
Image Analyst il 9 Mar 2018
I'm not sure what this uncommented code does. Is it the Arnold cat map? Just regular scrambling? I'm attaching demos for both. Since I don't know what your image does (due to lack of comments/explanations), I don't know how to fix it.

Community Treasure Hunt

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

Start Hunting!

Translated by