matlab生成xml (将SynthText数据转成XML)

    xiaoxiao2021-04-17  28

    本代码主要实现用MATLAB将数据转换成xml格式。以SynthText数据集为例。 若实际使用SynthText数据集时,务必注意其坐标位置的有效性。 clear;clc; % SynthText数据保存在gt.mat中,导入后生成imnames、charBB、wordBB、tt等数据 load('gt.mat'); for i = 1:size(imnames,2)     % 选择工作路径     img = imread(['.../',imnames{1,i}]);       [H,W,depth] = size(img);       % 取出图像名称,命名与图像同名xml文件      N1 = regexp(imnames{1,i},'/','split');     N2 = char(N1(2));     N3 = N2(1:end-4);       % 新建xml文件      annotation = com.mathworks.xml.XMLUtils.createDocument('annotation');     annotationRoot = annotation.getDocument
    转载请注明原文地址: https://ju.6miu.com/read-673349.html

    最新回复(0)