Main Content


Add new images to image index



addImages(imageIndex,imds) adds the images in imds into the imageIndex object.

addImages(imageIndex,imds,'Verbose',tf) optionally specifies whether or not to display progress information using the logical value tf. By default, the addImages function displays progress information. To hide the display, specify tf as false.


collapse all

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',...

Create an image search index.

imageIndex = invertedImageIndex(bag);

Add images.

Encoding images using Bag-Of-Features.

* Encoding 16 images...done.

Input Arguments

collapse all

Image search index, specified as an invertedImageIndex object.

Images, specified as an ImageDatastore object. imds contains new images to add to an existing index. Duplicate images are not ignored.


  • The addImages function supports parallel computing using multiple MATLAB® workers. Enable parallel computing from the Computer Vision Toolbox Preferences dialog box. To open Computer Vision Toolbox™ preferences, on the Home tab, in the Environment section, click Preferences. Then select Computer Vision Toolbox .

See Also

Introduced in R2015a