标注landmark的话,人脸landmark标注工具比较多,但是想要标注其它物体的landmark点,可能就要自己动手了。labelme作为一款开源好用的多边形标注工具,博主借用labelme多边形标注的json文件,将其转化成landmark点的文件(博主这里使用的是.pts文件),这样我们就可以先标注好多边形,将多边形的顶点作为landmark点。
一个Matlab工具,使用很简单,修改下数据目录直接运行即可:
fold = 'D:/landmark/'; in_ext = '.json'; out_ext = '.pts'; files = dir([fold '*' in_ext]); for i = 1:length(files) file = files(i); json_file = fullfile(file.folder, [file.name(1:end-5) '.json']); fid = fopen(fname); raw = fread(fid,inf); str = char(raw'); fclose(fid); val = jsondecode(str); points = val.shapes.points; str = sprintf('version: 1\nn_points: %d\n{\n', size(points,1)); for j = 1:size(points,1) str_line = sprintf('%.6f %.6f\n',points(j,1),points(j,2)); str = [str str_line]; end str = [str '}']; pts_file = fullfile(file.folder, [file.name(1:end-5) '.pts']); fp = fopen(pts_file,'w'); fprintf(fp, '%s', str); fclose(fp); disp([num2str(i) '/' num2str(length(files))]); end