主题:请教:使用imwrite出现的错误。
我接触MATLAB没几天,主要是为了做图像处理。程序代码如下:
fname = [RUN_DIR,'/',Global.Image_Dir_Name,'/',Global.Image_File_Name,prefZeros(frame_counter,Global.Num_Zeros),Global.Image_Extension];
%% 这是设置保存文件目录和名称的字符串
%% 解释一下:
%% RUN_DIR = [ '/home/fergus/demos/experiments/bag_of_words' ];
%% Global.Image_Dir_Name = 'images';
%% Global.Image_File_Name = 'image_';
%%
%% function [ res ] = prefZeros( n, z )
% res = fliplr(['000000000000' int2str(n)]);
% res = fliplr(res(1:z));
%% frame_counter的初始值为1;Global.Num_Zeros = 4;
%% Global.Image_Extension = '.jpg';
%% 总之:文件保存为这样的文件中:
%% '/home/fergus/demos/experiment/bag_of_words/images/image_0001.jpg'
%% '/home/fergus/demos/experiment/bag_of_words/images/image_0002.jpg'
%% ......
imwrite(im,fname,Global.Image_Extension(2:end));%%其中,im中是图像数据
出错信息是:??? Couldn't open file for JPEG write.
Error in ==> imagesci\private\writejpg at 127
wjpg8c(data, filename, props);
Error in ==> imwrite at 325
feval(fmt_s.write, data, map, filename, paramPairs{:});
Error in ==> \home\fergus\demos\common\do_preprocessing.m at 99
imwrite(im,fname,Global.Image_Extension(2:end));
Error in ==> \home\fergus\demos\common\do_all.m at 46
do_preprocessing(config_file);
凡是会用到那个文件名的地方都出错。请高手给看看,如果还没解释清楚,我可以将整个代码发过去,只是代码太长,没法在这里放下。谢谢!
fname = [RUN_DIR,'/',Global.Image_Dir_Name,'/',Global.Image_File_Name,prefZeros(frame_counter,Global.Num_Zeros),Global.Image_Extension];
%% 这是设置保存文件目录和名称的字符串
%% 解释一下:
%% RUN_DIR = [ '/home/fergus/demos/experiments/bag_of_words' ];
%% Global.Image_Dir_Name = 'images';
%% Global.Image_File_Name = 'image_';
%%
%% function [ res ] = prefZeros( n, z )
% res = fliplr(['000000000000' int2str(n)]);
% res = fliplr(res(1:z));
%% frame_counter的初始值为1;Global.Num_Zeros = 4;
%% Global.Image_Extension = '.jpg';
%% 总之:文件保存为这样的文件中:
%% '/home/fergus/demos/experiment/bag_of_words/images/image_0001.jpg'
%% '/home/fergus/demos/experiment/bag_of_words/images/image_0002.jpg'
%% ......
imwrite(im,fname,Global.Image_Extension(2:end));%%其中,im中是图像数据
出错信息是:??? Couldn't open file for JPEG write.
Error in ==> imagesci\private\writejpg at 127
wjpg8c(data, filename, props);
Error in ==> imwrite at 325
feval(fmt_s.write, data, map, filename, paramPairs{:});
Error in ==> \home\fergus\demos\common\do_preprocessing.m at 99
imwrite(im,fname,Global.Image_Extension(2:end));
Error in ==> \home\fergus\demos\common\do_all.m at 46
do_preprocessing(config_file);
凡是会用到那个文件名的地方都出错。请高手给看看,如果还没解释清楚,我可以将整个代码发过去,只是代码太长,没法在这里放下。谢谢!