急求解!!matlab程序为什么无法运行??

I3= imread('D:\毕设图片\sos.jpg');
[m,n,p]=size(I3);
C=randi(255,m,n);
C=uint8(C);
save('C','C');
for k=1:3
tem=I3(:,:,k);
tem=bitxor(tem,C);
P(:,:,k)=tem;
end
subplot(1,3,2); imshow(P); title('加密后图');

I3 = imread('D:\毕设图片\sos.jpg');
[m,n,p] = size(I3); 
C = randint(m,n,[0 255]);
C = uint8(C);
save('C','C');    
for k = 1:p
   tem = I3(:,:,k);    
   tem=bitxor(tem,C);   
   P(:,:,k)=tem;
end
imshow(P); 
title('加密后图');

追问

还是不行,提示了这个“Undefined function 'randint' for input arguments of type 'double'.” 我的是matlab2011版的

追答C = 250*rand(m,n); 
C = uint8(C);

追问

Q = P;
Q=uint8(Q);
P=uint8(P);
for k = 1:p
tem = P(:,:,k);
tem=uint8(tem);
tem = bitxor(tem,C);
Q(:,:,k) = tem;
end
subplot(133); imshow(Q); title('减密后图')
那解密程序该怎么改呢??

追答clear all
load C;   % 调入加密矩阵
Q = P;
[m,n,p] = size(Q);    
for k = 1:p
   tem = P(:,:,k);    
   tem=bitxor(tem,C);   
   Q(:,:,k)=tem;
end
imshow(Q); 
title('解密后图');

追问

提示load使用错误怎么改?

温馨提示:答案为网友推荐,仅供参考
相似回答