首页 > 代码库 > 根据ground truth在原图中分割子图

根据ground truth在原图中分割子图

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

  

根据ground truth在原图中分割子图