Interface FeatureSceneRecognition<TD extends TupleDesc<TD>>

All Superinterfaces:
VerbosePrint
All Known Implementing Classes:
FeatureSceneRecognitionNearestNeighbor, FeatureSceneRecognitionNister2006

public interface FeatureSceneRecognition<TD extends TupleDesc<TD>> extends VerbosePrint
More specialized version of SceneRecognition where it is assumed the input is composed of image features that have been detected sparsely at different pixel coordinates. If supported, access is provided to words that features are matched up with, which implies an internal TD-IDF style descriptor. This interface is of particular interest to image feature based geometric algorithms which have to compute these features anyways and can make sure of the feature to word mapping to improve association between frames. It also allows for image features to be precomputed and stored for later retrieval. The downside is that you are stuck with an image feature based approach to recognition.
  • Method Details

    • learnModel

      void learnModel(Iterator<FeatureSceneRecognition.Features<TD>> images)
      Learns a model using the already extracted image features
    • clearDatabase

      void clearDatabase()
      Removes all images from the database. The model is not modified
    • addImage

      void addImage(String id, FeatureSceneRecognition.Features<TD> features)
      Adds a new image to the database
      Parameters:
      id - The unique ID for this image
      features - All the features in this image
    • getImageIds

      List<String> getImageIds(@Nullable @Nullable List<String> storage)
      Returns a list of image IDs in the database
      Parameters:
      storage - (Optional) Storage for the list of images. If null a new instance is created
      Returns:
      List of all the image IDs.
    • query

      boolean query(FeatureSceneRecognition.Features<TD> query, @Nullable BoofLambdas.Filter<String> filter, int limit, DogArray<SceneRecognition.Match> matches)
      Finds the best matches in the database to the query image. The filter can (optionally) be used to remove matches which are not of interest, i.e. too close in time.
      Parameters:
      query - (Input) Features in the query image
      filter - (Input) Filter results by ID. true = keep, false = reject. Null means no filter.
      limit - (Input) The maximum number of results it will return. If ≤ 0 then all matches are returned.
      matches - (Output) Set of matches found in best first order. List is always cleared
      Returns:
      true if at least one valid match was found or false if no valid matches could be found. If false that means matches is empty. This is strictly a convenience.
    • getQueryWord

      int getQueryWord(int featureIdx)
      Returns a single word which describes this image feature. If multiple words describe a feature in its internal implementation then there is some ambiguity resolving logic.
      Parameters:
      featureIdx - (Input) Index of the feature in the query.
      Returns:
      The word's ID. If no word is associated with this feature then -1 is returned.
    • getQueryWords

      void getQueryWords(int featureIdx, DogArray_I32 words)
      Used to retrieve all the words a feature is associated with. If the internal implementation is hierarchical then words it passes through on the way a leaf could go in the words list.
      Parameters:
      featureIdx - (Input) Index of the feature in the query.
      words - (Output) Storage for all the words the feature is associated with
    • lookupWord

      int lookupWord(TD description)
    • lookupWords

      void lookupWords(TD description, DogArray_I32 word)
    • getTotalWords

      int getTotalWords()
      Returns the number of unique words. it's assumed that the word ID's will occupy 0 to this value.
    • getDescriptorType

      Class<TD> getDescriptorType()
      The image data type which can be processed