addImageFeatures
Description
addImageFeatures(
adds image imageIndex
,features
,imageId
)features
to imageIndex
from the
image specified by imageId
.
Examples
Define a set of images.
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'};
Create an image datastore containing the images.
imds = imageDatastore(imageFiles);
Learn the visual vocabulary of the images.
bag = bagOfFeatures(imds);
Creating Bag-Of-Features. ------------------------- * Selecting feature point locations using the Grid method. * Extracting SURF features from the selected feature point locations. ** The GridStep is [8 8] and the BlockWidth is [32 64 96 128]. * Extracting features from 15 images...done. Extracted 655092 features. * Keeping 80 percent of the strongest features from each category. * Creating a 500 word visual vocabulary. * Number of levels: 1 * Branching factor: 500 * Number of clustering steps: 1 * [Step 1/1] Clustering vocabulary level 1. * Number of features : 524074 * Number of clusters : 500 * Initializing cluster centers...100.00%. * Clustering...completed 53/100 iterations (~3.15 seconds/iteration)...converged in 53 iterations. * Finished creating Bag-Of-Features
Create an image search index.
imageIndex = invertedImageIndex(bag,'SaveFeatureLocations',false);
Load an image and extract features from it.
I = imread('coins.png');
Detect SURF points from the image.
points = detectSURFFeatures(I);
Extract image features from the SURF points.
features = extractFeatures(I,points);
Add the image features into the image index.
imageId = 1; addImageFeatures(imageIndex,features,imageId)
Input Arguments
Image search index, specified as an invertedImageIndex
object.
Feature descriptors, specified as an
M-by-N matrix or a binaryFeatures
object. Each
descriptor is of length N. To add image features to the
image index using addImageFeatures
, you must set the
SaveFeatureLocations
property of the invertedImageIndex
object to
false
.
Indexed image identifier, specified as a positive integer.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2021b
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)