matlab中key函数,这里面那个KEY怎么定义???

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

function [ste_cover,len_total]=randlsbhide(input,file,output,key)

%读入输入的图象

input='cameraman.TIF';

file='msg.txt';

output='1.TIF';

cover=imread(input);

ste_cover=cover;

ste_cover=double(ste_cover);

%将文本文件转2进

f_id=fopen(file,'r');

[msg,len_total]=fread(f_id,'ubit1');

% 判断消息是不是大了

[m,n]=size(ste_cover);

if len_total>m*n

error('消息量过大,请更换图象');

end

%p做为消息嵌入位数计数器

p=1;

%调用随机间隔函数选其象素点

[row,col]=randinterval(ste_cover,len_total,key);

save myrowcol row col;

%生成随机数

rand('seed',key);

control=randint(1,len_total,[1,2]);

save mycontrol control;

%在LSB隐秘消息

for i=1:len_total

if control(1,i)==1

ste_cover(row(i),col(i))=ste_cover(row(i),col(i))-mod(ste_cover(row(i),col(i)),2)+msg(p,1);

else ste_cover(row(i),col(i))=ste_cover(row(i),col(i))-2*mod(floor(ste_cover(row(i),col(i))/2),2)+2*msg(p,1);

end

if p==len_total

break

end

p=p+1;

end

ste_cover=uint8(ste_cover);

imwrite(ste_cover,output);

subplot(1,2,1);imshow(cover);title('原来的图象')

subplot(1,2,2);imshow(output);title('隐藏信息的图象')

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值