www.gusucode.com > vision 源码程序 matlab案例代码 > vision/AddImageToImageIndexExample.m
%% Add Image to Image Index % %% % Define a set of images to search imageFiles = ... {'elephant.jpg', 'cameraman.tif', ... 'peppers.png', 'saturn.png',... 'pears.png', 'stapleRemover.jpg', ... 'football.jpg', 'mandi.tif',... 'kids.tif', 'liftingbody.png', ... 'office_5.jpg', 'gantrycrane.png',... 'moon.tif', 'circuit.tif', ... 'tape.png', 'coins.png'}; imds = imageDatastore(imageFiles); %% % Learn the visual vocabulary. bag = bagOfFeatures(imds,'PointSelection','Detector',... 'VocabularySize',1000,'Verbose',false); %% % Create an image search index. imageIndex = invertedImageIndex(bag); %% % Add images. addImages(imageIndex,imds);