base_path = ‘D:\image\people‘; bb = importdata(‘output.txt‘); output_img = cell(99); for i = 1:100%length(temp_img) nz = strcat(‘%0‘,num2str(4),‘d‘); temp_id = sprintf(nz,i); id = strcat(temp_id,‘.jpg‘); img_path = fullfile(base_path,id); temp_img = imread(img_path); output_img = temp_img(bb.data(i,2):bb.data(i,4),bb.data(i,1):bb.data(i,3),:); filename = strcat(‘D:\image\output\‘,temp_id,‘.jpg‘); imwrite(output_img,filename); end
时间: 2024-10-25 15:13:28