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

1 次查看(过去 30 天)
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 个评论
Jan
Jan 2018-3-8
@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.

请先登录,再进行评论。

回答(1 个)

Image Analyst
Image Analyst 2018-3-9
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.

类别

Help CenterFile Exchange 中查找有关 Read, Write, and Modify Image 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by