当前位置:网站首页>How can matlab obtain the truncated image in trainingimagelabeler

How can matlab obtain the truncated image in trainingimagelabeler

2022-04-23 20:21:00 Install a sound 77

I use 2021b Version of matlab, The interface is as shown in the figure :

trainingImageLabeler It's a matlab Its own annotation tool , As an adaptation tool , It should have been convenient and easy to use , however trainingImageLabeler After several updates , Instead, it's more Galla cross .

The output of your image is especially good , Finally, it will only be output as mat file , Although it can also pass through readtable Read training in this way , But there is no real graph , It's still uncomfortable , How could such a function be cut off .

In fact, this acquisition method is very simple ,

l as long as load Take a look at what you saved mat file , A... Will appear in the workspace gTruth, The path information of the file and the clipped square area are inside .

load('test.mat')

  So write a script , pick up information , Then use the image imcrop Function to cut and save it .

The script is as follows :

clear all
clc
load('test.mat')

P = size(gTruth.LabelData);
P_size = P(1);

%1 Is the scope of ,2 Is the image location 
list1=[];
list2=[];
for i = 1:P_size
    react = gTruth.LabelData{i,1}{1,1};
    pic_path=gTruth.DataSource.Source(i);
    pic_path_str = cell2mat(pic_path);
    list1=[list1;react];
    list2=[list2;pic_path_str];
end

list1;
list2;

for j =1:30
    I=imread(list2(j,:));
    C=imcrop(I,list1(j,:));
    C_last=imresize(C,[227 227]);
    
    num = list2(j,:);
    num_str = num(25:end)
    imwrite(C_last,strcat('aaa/',num_str));
end

A rough script written temporarily , Hope to solve your problem .

版权声明
本文为[Install a sound 77]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210551491151.html

随机推荐