clc; clear all; close all;
image_path = '/media/wangxiao/Elements/image_segment_backup/';
savePath = '/media/wangxiao/Seagate/wangxiao/additional_data/'; threshold = ; first_files = dir(image_path); for i = :length(first_files)
sec_file_name = first_files(i).name;
sec_path = [image_path, sec_file_name, '/'];
sec_files = dir(sec_path);
disp(['process the: ', sec_file_name, '---', num2str(i-), '/', num2str(length(first_files)-),' waiting . . . ']); for j = :length(sec_files)
third_file_name = sec_files(j).name;
third_path = [sec_path, third_file_name, '/'];
third_files = dir(third_path);
disp([' process the: ', third_file_name, '---', num2str(j-), '/', num2str(length(sec_files)-),' . . . ']); for k = :length(third_files)
fourth_files_name = third_files(k).name;
fourth_path = [third_path, fourth_files_name, '/'];
fourth_files = dir(fourth_path);
disp([' process the: ', fourth_files_name, '---', num2str(k-), '/', num2str(length(third_files)-),' . . . ']); for ii = :length(fourth_files)
fifth_file_name = fourth_files(ii).name;
fifth_path = [fourth_path, fifth_file_name, '/'];
fifth_files = dir(fifth_path);
disp([' process the: ', fifth_file_name, '---', num2str(ii-), '/', num2str(length(fourth_files)-),' . . . ']); for jj = :length(fifth_files)
six_file_name = fifth_files(jj).name;
six_path = [fifth_path, six_file_name, '/'];
six_files = dir([six_path, '*.jpg']);
% disp([' process the: ', six_file_name, '---', num2str(jj-), '/', num2str(length(fifth_files)-), ' . . . ']); for kk = :length(six_files)
seven_file_name = six_files(kk).name;
image = imread([six_path, seven_file_name]); imshow(image); [width, length, channel] = size(image);
% disp(sec_file_name);
% disp(third_file_name);
% disp(fourth_files_name);
% disp(fifth_file_name);
% disp(six_file_name);
% disp(seven_file_name);
resolution = width * length ; if (resolution > threshold)
imwrite(image, [savePath, seven_file_name]);
end end end end end end end
Error using subsindex
Function 'subsindex' is not defined for values of class 'struct'.
Error in pre_deal_additional_data (line 39)
for kk = 1:length(six_files)
----------------------------------------------------------------------
----------------------------------------------------------------------
fuck the error and the answer is :
clc; clear all; close all;
image_path = '/media/wangxiao/Elements/image_segment_backup/';
savePath = '/media/wangxiao/Seagate/wangxiao/additional_data/'; threshold_self = ; first_files = dir(image_path); for i = :size(first_files, )
sec_file_name = first_files(i).name;
sec_path = [image_path, sec_file_name, '/'];
sec_files = dir(sec_path);
disp(['process the: ', sec_file_name, '---', num2str(i-), '/', num2str(length(first_files)-),' waiting . . . ']); for j = : size(sec_files, )
third_file_name = sec_files(j).name;
third_path = [sec_path, third_file_name, '/'];
third_files = dir(third_path);
% disp([' process the: ', third_file_name, '---', num2str(j-), '/', num2str(length(sec_files)-),' . . . ']); for k = : size(third_files, )
fourth_files_name = third_files(k).name;
fourth_path = [third_path, fourth_files_name, '/'];
fourth_files = dir(fourth_path);
% disp([' process the: ', fourth_files_name, '---', num2str(k-), '/', num2str(length(third_files)-),' . . . ']); for ii = : size(fourth_files, )
fifth_file_name = fourth_files(ii).name;
fifth_path = [fourth_path, fifth_file_name, '/'];
fifth_files = dir(fifth_path);
% disp([' process the: ', fifth_file_name, '---', num2str(ii-), '/', num2str(length(fourth_files)-),' . . . ']); for jj = : size(fifth_files, )
six_file_name = fifth_files(jj).name;
six_path = [fifth_path, six_file_name, '/'];
six_files = dir([six_path, '*.jpg']);
% disp([' process the: ', six_file_name, '---', num2str(jj-), '/', num2str(length(fifth_files)-), ' . . . ']); for kk = : size(six_files, )
seven_file_name = six_files(kk).name;
image = imread([six_path, seven_file_name]); % imshow(image); [width, length, channel] = size(image); resolution_self = width * length ; if (resolution_self > threshold_self)
imwrite(image, [savePath, seven_file_name]);
end end end end end end end