Contenido principal

addImages

R2026b

Add new images to image index

Description

addImages(imageIndex,imds) adds the images in imds to imageIndex.

example

addImages(imageIndex,I,imageId) adds an image, I, to imageIndex, specified by the image identifier imageId.

addImages(___,Name=Value) specifies options using one or more name-value arguments in addition to any combination of input arguments from previous syntaxes.

Examples

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 of the image view set.

numlevels = 1;
branchingFactor = 1000;
bag = bagOfFeatures(imds,'PointSelection','Detector', ...
        'TreeProperties',[numlevels,branchingFactor],'Verbose',false);

Create an image search index.

imageIndex = invertedImageIndex(bag);

Add to the image view set images to the image search index.

addImages(imageIndex,imds);
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. The function does not ignore duplicate images.

Input image, specified as either an M-by-N-by-3 array, representing a truecolor image, or an M-by-N array, representing a 2-D grayscale image.

Indexed image identifier, specified as an positive integer.

Name-Value Arguments

collapse all

Example: UseParallel="auto"

Display progress information, specified as a logical scalar. By default, the addImages function displays progress information. To hide the display, specify this argument as false.

Since R2026b

Option to perform computations in parallel using a parallel pool of workers, specified as one of these values:

  • "off" — Run in serial on the MATLAB client.

  • "auto" — Use a parallel pool if one is open or if MATLAB can automatically create one. If a parallel pool is not available, run in serial on the MATLAB client.

  • "on" — Use a parallel pool if one is open or if MATLAB can automatically create one. If a parallel pool is not available, throw an error.

If you do not have a parallel pool open and automatic pool creation is enabled, MATLAB opens a pool using the default cluster profile. Using parallel computing requires Parallel Computing Toolbox™. For more information, see Run MATLAB Functions with Automatic Parallel Support (Parallel Computing Toolbox).

Data Types: char | string

Tips

  • 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, select Preferences. Then select Computer Vision Toolbox.

Extended Capabilities

expand all

Version History

Introduced in R2015a

expand all