mask-rcnn 批量从json文件中挑选出img.png,label.png (matlab)

clc
clear 
close all
filepath = 'E:\EL_dataset\train_data\labelme_json\';%json文件
filenames = dir(filepath);
for i = 3:length(filenames)
I = imread([filepath,filenames(i).name,'\','label.png']);%label.png或img.png
s= filenames(i).name;
pat='[0-9]*';
matches = regexp(s,pat,'match');
a = cell2mat(matches(1));
imwrite(I,['C:\Users\binyi su\Desktop\label\img\',a,'.png']);%写入路径
i-2
end

你可能感兴趣的:(图像处理)