1. matlab 自带含 ground truth 数据集
%% 加载停车标志数据到内存;
data = load('stopSignsAndCars.mat', 'stopSignsAndCars');
stopSignsAndCars = data.stopSignsAndCars;
% 将 stopSignsAndCars 下的图像名,拓展为绝对路径加图像名,以方便读取
imagePath = fullfile(toolboxdir('vision'), 'visiondata');
stopSignsAndCars.imageFilename = fullfile(imagePath, stopSignsAndCars.imageFilename);
summary(stopSignsAndCars)
% 查看该数据集的主要描述信息,主要标注了 stop sign,car rear:车尾,car front:车头
stopSignsAndCarRears = stopSignsAndCars(:, {'imageFilename', 'stopSign', 'carRear'});
% 使用已给的标注信息,对其中一副图像进行标注
I = imread(stopSignsAndCarRears.imageFilename{1});
I = insertObjectAnnotation(I, 'rectangle', stopSignsAndCarRears.stopSign{1}, 'stop sign', 'linewidth', 4, 'color', 'r');
I = insertObjectAnnotation(I, 'rectangle', stopSignsAndCarRears.carRear{1}, 'car rear', 'linewidth', 4, 'color', 'g');
imshow(I)