Wrong in imwrite>parse_inputs (line 510),The file name must be provided.

1 次查看(过去 30 天)
I want to do color enhancement on the images by changing the line 31 from 'disp(url)' to ' url=immultiply(file,2);'in line 31,but there is an error shows
%
wrong in imwrite>parse_inputs (line 510)
The file name must be provided.
wrong in imwrite (line 418)
[data, map, filename, format, paramPairs] = parse_inputs(varargin{:});
wrong in prepare_imdb (line 34)
imwrite(imresize(file,[256,256]), url );
The complete source code is
% clear;
%you can download this file. It contains data.
load('F:\2016_person_re-ID-master\2016_person_re-ID-master/cuhk-03.mat');
imdb.meta.sets = ['train','test'];
count = 0;
label = 0;
%choose a split
testsets_num = 6; %cuhk03 has 20 different splits, and this value can be 1 ~ 20.
p = sprintf('./split%d_256_1/',testsets_num);
if(~exist(p,'dir'))
mkdir(p);
end
test = testsets{testsets_num,1};
cc = [];
for k=1:numel(detected) %camera
im = detected{k,1};
for i = 1:size(im,1) %identity
A = find(test(:,1) == k);
B = find(test(:,2) == i);
C = intersect(A,B);
if(~isempty(C))
continue;
end
label = label+1;
temp = 0;
for j=1:10 %image
file = im{i,j};
url = sprintf('F:/2016_person_re-ID-master/2016_person_re-ID-master/cuhk03-prepare-eval/split%d_256_1/%d_%d_%d.jpg',testsets_num,k,i,j);
if(~isempty(file))
disp(url);
imwrite(imresize(file,[256,256]), url );
temp = temp + 1;
count = count + 1;
%disp(count);
imdb.images.data(count) = cellstr( url );
imdb.images.label(count) = label;
end
end
cc = [cc;temp];
end
end
imdb.images.set = ones(1,count);
imdb.images.set(:,randi(count,[round(0.1*count),1])) = 2;
list = find(imdb.images.set==2);
for i=1:numel(list)
if cc(imdb.images.label(list(i)))<9
imdb.images.set(list(i))=1;
end
end
save(sprintf('cuhk_data_256_split%d_3.mat',testsets_num),'imdb','-v7.3');
I just change the line 31 ,no changes have been made elsewhere。My goal is save the images which have enhanced color in the file 'F:/2016_person_re-ID-master/2016_person_re-ID-master/cuhk03-prepare-eval/split%d_256_1'.Can you tell me what should i do?
  2 个评论
mengqiu ren
mengqiu ren 2018-10-29
NO, it do not have the information which i need in the new .mat file ,so i decide to change a method. And the information in the two file have different format,so it can not result by the method of mandatory definition.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by