Error using subsindex Function 'subsindex' is not defined for values of class 'struct'.

 1 clc; clear all;  close all;
 2 image_path = '/media/wangxiao/Elements/image_segment_backup/';
 3 savePath = '/media/wangxiao/Seagate/wangxiao/additional_data/';
 4 
 5 threshold  = 5000;
 6 
 7 first_files = dir(image_path);
 8 
 9 for i = 3:length(first_files)
10     sec_file_name = first_files(i).name;
11     sec_path = [image_path, sec_file_name, '/'];
12     sec_files = dir(sec_path);
13     disp(['process the: ', sec_file_name, '---', num2str(i-2), '/', num2str(length(first_files)-2),' waiting . . . ']);
14     
15     for j = 3:length(sec_files)
16         third_file_name = sec_files(j).name;
17         third_path = [sec_path, third_file_name, '/'];
18         third_files = dir(third_path);
19         disp(['     process the: ', third_file_name, '---', num2str(j-2), '/', num2str(length(sec_files)-2),'  . . . ']);
20         
21         for k = 3:length(third_files)
22             fourth_files_name = third_files(k).name;
23             fourth_path = [third_path, fourth_files_name, '/'];
24             fourth_files = dir(fourth_path);
25             disp(['         process the: ', fourth_files_name, '---', num2str(k-2), '/', num2str(length(third_files)-2),'  . . . ']);
26             
27             for ii = 3:length(fourth_files)
28                 fifth_file_name = fourth_files(ii).name;
29                 fifth_path = [fourth_path, fifth_file_name, '/'];
30                 fifth_files = dir(fifth_path);
31                 disp(['               process the: ', fifth_file_name, '---', num2str(ii-2), '/', num2str(length(fourth_files)-2),'  . . . ']);
32                 
33                 for jj = 3:length(fifth_files)
34                     six_file_name = fifth_files(jj).name;
35                     six_path = [fifth_path, six_file_name, '/'];
36                     six_files = dir([six_path, '*.jpg']);
37 %                     disp(['                   process the: ', six_file_name, '---', num2str(jj-2), '/', num2str(length(fifth_files)-2), '  . . . ']);
38                     
39                     for kk = 1:length(six_files)
40                         seven_file_name = six_files(kk).name;
41                         image = imread([six_path, seven_file_name]);
42                         
43                         imshow(image);
44                         
45                         [width, length, channel] = size(image);
46                         %   disp(sec_file_name);
47                         %   disp(third_file_name);
48                         %   disp(fourth_files_name);
49                         %   disp(fifth_file_name);
50                         %   disp(six_file_name);
51                         %   disp(seven_file_name);
52                         resolution = width * length ;
53                         
54                         if (resolution > threshold)
55                             imwrite(image, [savePath, seven_file_name]);
56                         end
57                         
58                         
59                     end
60                     
61                     
62                     
63                     
64                     
65                 end
66                 
67                 
68             end
69             
70             
71         end
72         
73     end
74     
75 end
View Code

 

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 :

 

 

 1 clc; clear all;  close all;
 2 image_path = '/media/wangxiao/Elements/image_segment_backup/';
 3 savePath = '/media/wangxiao/Seagate/wangxiao/additional_data/';
 4 
 5 threshold_self  = 5000;
 6 
 7 first_files = dir(image_path);
 8 
 9 for i = 3:size(first_files, 1)
10     sec_file_name = first_files(i).name;
11     sec_path = [image_path, sec_file_name, '/'];
12     sec_files = dir(sec_path);
13     disp(['process the: ', sec_file_name, '---', num2str(i-2), '/', num2str(length(first_files)-2),' waiting . . . ']);
14     
15     for j = 3: size(sec_files, 1)
16         third_file_name = sec_files(j).name;
17         third_path = [sec_path, third_file_name, '/'];
18         third_files = dir(third_path);
19 %         disp(['     process the: ', third_file_name, '---', num2str(j-2), '/', num2str(length(sec_files)-2),'  . . . ']);
20         
21         for k = 3: size(third_files, 1)
22             fourth_files_name = third_files(k).name;
23             fourth_path = [third_path, fourth_files_name, '/'];
24             fourth_files = dir(fourth_path);
25 %             disp(['         process the: ', fourth_files_name, '---', num2str(k-2), '/', num2str(length(third_files)-2),'  . . . ']);
26             
27             for ii = 3: size(fourth_files, 1)
28                 fifth_file_name = fourth_files(ii).name;
29                 fifth_path = [fourth_path, fifth_file_name, '/'];
30                 fifth_files = dir(fifth_path);
31 %                 disp(['               process the: ', fifth_file_name, '---', num2str(ii-2), '/', num2str(length(fourth_files)-2),'  . . . ']);
32                 
33                 for jj = 3:  size(fifth_files, 1)
34                     six_file_name = fifth_files(jj).name;
35                     six_path = [fifth_path, six_file_name, '/'];
36                     six_files = dir([six_path, '*.jpg']);
37 %                     disp(['                   process the: ', six_file_name, '---', num2str(jj-2), '/', num2str(length(fifth_files)-2), '  . . . ']);
38                     
39                     for kk = 1: size(six_files, 1)
40                         seven_file_name = six_files(kk).name;
41                         image = imread([six_path, seven_file_name]);
42                         
43 %                         imshow(image);
44                         
45                         [width, length, channel] = size(image);
46                         
47                         resolution_self = width * length ;
48                         
49                         if (resolution_self > threshold_self)
50                             imwrite(image, [savePath, seven_file_name]);
51                         end
52                         
53                         
54                     end
55                     
56                     
57                     
58                     
59                     
60                 end
61                 
62                 
63             end
64             
65             
66         end
67         
68     end
69     
70 end
View Code

 

转载于:https://www.cnblogs.com/wangxiaocvpr/p/5234219.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值