我从浏览器中选择了多个框架。它在视频隐写术中完美地作为我的项目的封面文件。
在封面(多帧)中嵌入文本后,我想将这些帧保存为隐秘图像,但在我的情况下,它只保存最后一张图像。
以下是代码:
[fn, pn,fi] = uigetfile('*.jpg*','Select the Cover Image','Multiselect','on');
coln=size(fn);
numberfile=coln;
for i=1:numberfile
fn(i);
entirefile=fullfile(pn,fn{i});
fid=fopen(entirefile);
fclose(fid);
end
I = imread([pn,fn{i}]);
pix=I(:);
J = reshape(pix,size(I));
%till here is working fine
%this code below it problem when I save Stego image it save only last image
[fn, pn] = uiputfile('*.png', 'Save Stego Image');
imwrite(J,[pn,'\',fn],'png');
答案 0 :(得分:0)
您可以在for
循环中应用保存操作,如下所示:
[fn, pn,fi] = uigetfile('.jpg','Select the Cover Image','Multiselect','on');
coln = size(fn, 2);
numberfile = coln;
for i = 1:numberfile
fn(i);
entirefile = fullfile(pn, fn{i});
fid = fopen(entirefile);
fclose(fid);
end
for i = 1:numberfile
I = imread([pn, fn{i}]);
pix = I(:);
J = reshape(pix, size(I));
[out_fn, out_pn] = uiputfile('*.png', 'Save Stego Image');
imwrite(J, [out_pn, '\', out_fn], 'png');
end
注意:
我换了:
[fn, pn] = uiputfile('*.png', 'Save Stego Image');`
使用:
[out_fn, out_pn] = uiputfile('*.png', 'Save Stego Image');
您希望在阅读阶段保留(而不是覆盖)fn
和pn
。