pixel scrambling of image
1 次查看(过去 30 天)
显示 更早的评论
I have done image scrambling by exchanging pixels using following method: 1. pn sequence is generated 2.For every bit value 1 in the PN sequence, the corresponding index in the image is exchanged with its diagonal counterpart using equation I(i,j)=p*I(j,i)+p′ * I (i, j) , Otherwise the image pixel is kept same. now i want to reverse the process and want to unscrambled the image to obtain original image. but not getting how to do it? plz help me. here is part of code:
clc;
clear all;
close all;
originalImage=imread('cameraman.tif')
I=mat2gray(originalImage);
figure;
imshow(I);
[m n c]=size(I);
myseed=0;
rng(myseed); % rng seeds the random number generator
seq1 = round(rand(size(I)));
for i=1:m
for j=1:n
s= seq1(i,j)
if s==1
k=~s
I(i,j)=(s*I(j,i))+(k*I(i,j));
end
end
end
figure,imshow(I);
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!