1 clear; 2 filenames = dir('E:\file'); 3 N = length(filenames); 4 j=0; 5 for i=1:N 6 [path,name,ext] = fileparts(filenames(i).name); 7 if strcmp(ext,'.jpg') == 1 8 9 imagedir = strcat('E:\王琳-04-25(new)\MindFind\MindFind\frame\',filenames(i).name); 10 name = filenames(i).name; 11 I = imread(imagedir); 12 [m,n] = size(I); 13 if m==256 && n== 384*3 14 i 15 I = imresize(I,[NaN 300]); 16 R = I(:,:,1); 17 G = I(:,:,2); 18 B = I(:,:,3); 19 [M,N] = size(R); 20 K=double(R); 21 for i=1:300 22 for j=1:300 23 if (i>50)&&(i<=50+M) 24 C(i,j) = K(i-50,j); 25 else 26 C(i,j) = 0; 27 end 28 end 29 end 30 C = uint8(C); 31 32 L=double(G); 33 for i=1:300 34 for j=1:300 35 if (i>50)&&(i<=50+M) 36 D(i,j) = L(i-50,j); 37 else 38 D(i,j) = 0; 39 end 40 end 41 end 42 D = uint8(D); 43 44 T=double(B); 45 for i=1:300 46 for j=1:300 47 if (i>50)&&(i<=50+M) 48 E(i,j) = T(i-50,j); 49 else 50 E(i,j) = 0; 51 end 52 end 53 end 54 E = uint8(E); 55 56 Inew(:,:,1) = C; 57 Inew(:,:,2) = D; 58 Inew(:,:,3) = E; 59 savename = strcat('E:\file',name); 60 imwrite(Inew,savename); 61 62 end 63 end 64 65 end