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.
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.
Amerika
- 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)