Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

sir,I have done the encoding process ,I want to decode the final image share.can you help me to decode the final image share into original image?

2 vues (au cours des 30 derniers jours)
if true
clc;
clear all;
close all;
I=imread('Cameraman.tif');
[W,L]=size(I);
V=I(:)';
K=randi([0,1],1,192);
for x=1:2
a1=1;
for i=1:4
su=0;
for t=((48*i)-47):(48*i)
mull=(K(t)*2^(t-48*i+47));
su=su+mull;
end
A(i)= su/(2^48);
a1=a1*A(i);
end
rrr(x)=a1*2^48+A(x);
r(x)=mod((rrr(x)),0.4)+3.6;
cxxx(x)=a1*2^48+A(x+2);
c(x,1)=mod((cxxx(x)),1);
end
for x=1:2
for y=1:length(V)
if y==1
c(x,y)=c(x,1);
end
if (y~=1 && c(x,y-1)<0.5)
c(x,y)=0.5*r(x)*c(x,y-1);
end
if (y~=1 && c(x,y-1)>=0.5)
c(x,y)=0.5*r(x)*(1-c(x,y-1));
end
end
end
for y=1:65536
if y==1
E1(y)=V(y);
else
st=double(floor(c(1,y)*10^13));
fg=double(V(y));
gh=double(V(y-1));
du=st+fg+gh;
E1(y)=mod(du,256);
end
end
suy=0;
for y=1:length(V)
if y==length(V)
E2(y)=E1(y);
else
st1=double(floor(c(2,y)*10^13));
fg1=double(E1(y));
gh1=double(E1(y+1));
du1=st1+fg1+gh1;
E2(y)=mod(du1,256);
end
s=E2(y);
suy=suy+s;
end
nor_E2=decimalToBinaryVector(suy, 192, 'MSBFirst');
xo=xor(nor_E2,K);
ho=zeros(1,24);
kam=1;
for i=1:8:length(xo)
ho(kam)=bi2de(xo(i:i+7),'left-msb');
kam=kam+1;
end
E=[ho,E2];
k=3;
n=5;
size_of_m=(2*k-2);
for i=1:(2*k-2)
if i<=k-1
m1(i)=1;
else
m1(i)=0;
end
end
n11 = numel(m1);
k11 = sum(m1);
c = nchoosek(1:n11,k11);
[m,nu] = size(c);
out = zeros(m,n11);
mull=ones(1:nu);
out(sub2ind([m,n11],(1:m)'*mull(1:nu),c)) = 1;
s_Initial=out';
[ini_row,ini_col]=size(s_Initial);
I11=max(ceil(log2(n/(2*k-2))),0);
s_Ini1{1}=s_Initial;
if I11==0
s_exp=s_Initial;
else
for iter=1:I11
exp_row=ini_row*ini_row/2;
exp_col=ini_col*ini_col;
count=0;
ii=1;
jj=1;
for i=1:ini_col
for j=1:ini_row
if s_Ini1{iter}(j,i)==1
if (count==0)
s_exp(jj:jj+ini_row/2-1,ii:ii+ini_col-1)=s_Ini1{iter}(1:ini_row/2,:);
count=count+1;
else
s_exp(jj:jj+ini_row/2-1,ii:ii+ini_col-1)=s_Ini1{iter}(ini_row/2+1:ini_row,:);
count=0;
end
else
s_exp(jj:jj+ini_row/2-1,ii:ii+ini_col-1)=1;
end
jj=jj+ini_row/2;
end
jj=1;
ii=ii+ini_col;
end
[ini_row,ini_col]=size(s_exp);
s_Ini1{iter+1}=s_exp;
end
end
for i=1:length(s_Ini1)
[rr,cc]=size(s_Ini1{i});
for j=1:rr
[r,cu,vvv]=find(s_Ini1{i}(j,:));
onee1(i,j)=length(r);
end
end
s_share(1:n,:)=s_exp(1:n,:);
for roe=1:n
for i=1:length(s_share):length(E)
dfr{roe}(i:i+length(s_share)-1)=s_share(roe,:);
end
end
H=zeros(6,length(E));
for roe=1:n
for i=1:length(E)
if dfr{roe}(i)==1
H(roe,i)=E(i);
end
end
end
D(1)=floor(length(s_share)/256);
D(2)=mod(length(s_share),256);
size_of_B=ceil(length(s_share)/8);
if (mod(length(s_share),8)==0)
z=0;
else
z=8-(mod(length(s_share),8));
end
for i=1:n
s_cap(i,:)=[s_share(i,:),zeros(1,z)];
end
for i=1:n
for j=1:size_of_B
sumii=0;
for j1=8*j-7:8*j
sumii=sumii+(s_cap(i,j1)*2^(j1-8*j+7));
end
B{i}(j)=sumii;
end
end
for i=1:n
F{i}=[D B{i} H(i,:)];
end
for i=1:n
length_of_Fi=length(F{i});
x_of_size_of_Gi=W;
y_of_size_of_Gi=ceil(length_of_Fi/W);
conf=mod(length_of_Fi,W);
if (conf==0)
G{i}=F{i};
else
if (conf==0)
vg=0;
else
vg=W-(mod(length_of_Fi,W));
end
G{i}=[F{i},zeros(1,vg)];
end
end
for i=1:n
reshaped_G{i}=reshape(G{i},x_of_size_of_Gi,y_of_size_of_Gi);
end
final_encrypted_secured_share=reshaped_G;
end

Réponses (0)

Cette question est clôturée.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by