【发布时间】:2012-10-12 12:33:53
【问题描述】:
我正在对图像文件集进行一些批处理,这要求文件应在文件名末尾附加一个“_corrected”字符串保存,例如“IMG_001.tif”应在处理后保存为'IMG_001_corrected.jpg'。
这是我的代码:
FileList = dir('srgb8bit/*.tif');
N = size(FileList,1);
for k = 1:N
% get the file name:
filename = FileList(k).name;
I = imread(filename);
Icorr = CorrectedRetinexFM(I,8);
** Here should go the save command**
最好能够选择不同的目录来保存它们。这怎么可能?
非常感谢您的帮助!
【问题讨论】:
-
您读取图像的代码不起作用,因为 file.name 字段仅包含文件的名称,而不包含文件的路径。你需要
filename = ['srgb8bit/' FileList(k).name];。你可以用同样的方法创建你想要保存的文件。
标签: image matlab batch-file save