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.86 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™.
GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU 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.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- 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)