removeImages

Класс: invertedImageIndex

Удалите изображения из индекса изображений

Синтаксис

removeImages(imageIndex,indices)

Описание

removeImages(imageIndex,indices) удаляет изображения из imageIndex объект, которые соответствуют indices входной параметр.

Входные параметры

развернуть все

Отобразите поисковый индекс, заданный как invertedImageIndex объект.

Отобразите индексы, заданные как строка или вектор-столбец. Индексы соответствуют изображениям в imageIndex.Location.

Примеры

развернуть все

Создайте набор изображений.

dataDir  = fullfile(toolboxdir('vision'),'visiondata','imageSets','cups');
imds = imageDatastore(dataDir);

Индексируйте набор изображений.

imageIndex = indexImages(imds)
Creating an inverted image index using Bag-Of-Features.
-------------------------------------------------------

Creating Bag-Of-Features.
-------------------------

* Selecting feature point locations using the Detector method.
* Extracting SURF features from the selected feature point locations.
** detectSURFFeatures is used to detect key points for feature extraction.

* Extracting features from 6 images...done. Extracted 1708 features.

* Keeping 80 percent of the strongest features from each category.

* Balancing the number of features across all image categories to improve clustering.
** Image category 1 has the least number of strongest features: 1366.
** Using the strongest 1366 features from each of the other image categories.

* Using K-Means clustering to create a 20000 word visual vocabulary.
* Number of features          : 1366
* Number of clusters (K)      : 1366

* Initializing cluster centers...100.00%.
* Clustering...completed 1/100 iterations (~0.06 seconds/iteration)...converged in 1 iterations.

* Finished creating Bag-Of-Features


Encoding images using Bag-Of-Features.
--------------------------------------

* Encoding 6 images...done.
Finished creating the image index.
imageIndex = 
  invertedImageIndex with properties:

         ImageLocation: {6x1 cell}
            ImageWords: [6x1 vision.internal.visualWords]
         WordFrequency: [1x1366 double]
         BagOfFeatures: [1x1 bagOfFeatures]
        MatchThreshold: 0.0100
    WordFrequencyRange: [0.0100 0.9000]

imageIndex.ImageLocation
ans = 6x1 cell array
    {'/mathworks/devel/bat/BR2019bd/build/matlab/toolbox/vision/visiondata/imageSets/cups/bigMug.jpg'    }
    {'/mathworks/devel/bat/BR2019bd/build/matlab/toolbox/vision/visiondata/imageSets/cups/blueCup.jpg'   }
    {'/mathworks/devel/bat/BR2019bd/build/matlab/toolbox/vision/visiondata/imageSets/cups/handMade.jpg'  }
    {'/mathworks/devel/bat/BR2019bd/build/matlab/toolbox/vision/visiondata/imageSets/cups/holdingCup.jpg'}
    {'/mathworks/devel/bat/BR2019bd/build/matlab/toolbox/vision/visiondata/imageSets/cups/plaid.jpg'     }
    {'/mathworks/devel/bat/BR2019bd/build/matlab/toolbox/vision/visiondata/imageSets/cups/plainWhite.jpg'}

Удалите сначала и третье изображение.

removeImages(imageIndex,[1 3]);
imageIndex.ImageLocation
ans = 4x1 cell array
    {'/mathworks/devel/bat/BR2019bd/build/matlab/toolbox/vision/visiondata/imageSets/cups/blueCup.jpg'   }
    {'/mathworks/devel/bat/BR2019bd/build/matlab/toolbox/vision/visiondata/imageSets/cups/holdingCup.jpg'}
    {'/mathworks/devel/bat/BR2019bd/build/matlab/toolbox/vision/visiondata/imageSets/cups/plaid.jpg'     }
    {'/mathworks/devel/bat/BR2019bd/build/matlab/toolbox/vision/visiondata/imageSets/cups/plainWhite.jpg'}