可以帮我把这段Matlab程序转换成C语言吗?
molen 2007-05-05 07:50:02 如题:
function [ste_cover,len_total]=randlsbhide(input,file,output,key)
cover=imread(input);
ste_cover=cover;
ste_cover=double(set_cover);
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=1;
[row,col]=randinterval(set_cover,len_total,key);
for i=1:len_total
set_cover(row(i),col(i))=set_cover(row(i),col(i))-mod(set_cover(row(i),col(i)),2)+msg(p,1);
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(cover);title('隐藏信息的图像');
这样不好弄的话也可以直接给出用lsb算法进行信息隐藏的C程序(针对灰度的bmp格式图像)