Package boofcv.abst.scene.nister2006
Class FeatureSceneRecognitionNister2006<TD extends TupleDesc<TD>>
java.lang.Object
boofcv.abst.scene.nister2006.FeatureSceneRecognitionNister2006<TD>
- All Implemented Interfaces:
FeatureSceneRecognition<TD>,VerbosePrint
public class FeatureSceneRecognitionNister2006<TD extends TupleDesc<TD>>
extends Object
implements FeatureSceneRecognition<TD>
High level implementation of
RecognitionVocabularyTreeNister2006 for FeatureSceneRecognition.-
Nested Class Summary
Nested classes/interfaces inherited from interface boofcv.abst.scene.FeatureSceneRecognition
FeatureSceneRecognition.Features<TD extends TupleDesc<TD>> -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFeatureSceneRecognitionNister2006(ConfigRecognitionNister2006 config, Factory<TD> factory) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddImage(String id, FeatureSceneRecognition.Features<TD> features) Adds a new image to the databasevoidRemoves all images from the database.The image data type which can be processedgetImageIds(@Nullable List<String> storage) Returns a list of image IDs in the databaseintgetQueryWord(int featureIdx) Returns a single word which describes this image feature.voidgetQueryWords(int featureIdx, DogArray_I32 words) Used to retrieve all the words a feature is associated with.intReturns the number of unique words.voidlearnModel(Iterator<FeatureSceneRecognition.Features<TD>> images) Learns a model using the already extracted image featuresintlookupWord(TD description) voidlookupWords(TD description, DogArray_I32 word) protected voidlookupWordsFromLeafID(int leafID, DogArray_I32 word) Given the leafID lookup the other words in the tree leading to the leaf.booleanquery(FeatureSceneRecognition.Features<TD> query, BoofLambdas.Filter<String> filter, int limit, DogArray<SceneRecognition.Match> matches) Finds the best matches in the database to the query image.voidvoidsetVerbose(@Nullable PrintStream out, @Nullable Set<String> set) protected inttraverseUpGetID(int id, int maxHops) Traverses up the tree to find a parent node X hops away
-
Field Details
-
minimumForThread
public int minimumForThreadPerformance tuning. If less than this number of features a single thread algorithm will be used
-
-
Constructor Details
-
FeatureSceneRecognitionNister2006
-
-
Method Details
-
setDatabase
-
learnModel
Description copied from interface:FeatureSceneRecognitionLearns a model using the already extracted image features- Specified by:
learnModelin interfaceFeatureSceneRecognition<TD extends TupleDesc<TD>>
-
clearDatabase
public void clearDatabase()Description copied from interface:FeatureSceneRecognitionRemoves all images from the database. The model is not modified- Specified by:
clearDatabasein interfaceFeatureSceneRecognition<TD extends TupleDesc<TD>>
-
addImage
Description copied from interface:FeatureSceneRecognitionAdds a new image to the database- Specified by:
addImagein interfaceFeatureSceneRecognition<TD extends TupleDesc<TD>>- Parameters:
id- The unique ID for this imagefeatures- All the features in this image
-
getImageIds
Description copied from interface:FeatureSceneRecognitionReturns a list of image IDs in the database- Specified by:
getImageIdsin interfaceFeatureSceneRecognition<TD extends TupleDesc<TD>>- Parameters:
storage- (Optional) Storage for the list of images. If null a new instance is created- Returns:
- List of all the image IDs.
-
query
public boolean query(FeatureSceneRecognition.Features<TD> query, @Nullable BoofLambdas.Filter<String> filter, int limit, DogArray<SceneRecognition.Match> matches) Description copied from interface:FeatureSceneRecognitionFinds 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.- Specified by:
queryin interfaceFeatureSceneRecognition<TD extends TupleDesc<TD>>- Parameters:
query- (Input) Features in the query imagefilter- (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
public int getQueryWord(int featureIdx) Description copied from interface:FeatureSceneRecognitionReturns 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.- Specified by:
getQueryWordin interfaceFeatureSceneRecognition<TD extends TupleDesc<TD>>- 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
Description copied from interface:FeatureSceneRecognitionUsed 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.- Specified by:
getQueryWordsin interfaceFeatureSceneRecognition<TD extends TupleDesc<TD>>- Parameters:
featureIdx- (Input) Index of the feature in the query.words- (Output) Storage for all the words the feature is associated with
-
lookupWord
- Specified by:
lookupWordin interfaceFeatureSceneRecognition<TD extends TupleDesc<TD>>
-
lookupWords
- Specified by:
lookupWordsin interfaceFeatureSceneRecognition<TD extends TupleDesc<TD>>
-
lookupWordsFromLeafID
Given the leafID lookup the other words in the tree leading to the leaf. Words is reset on each call -
traverseUpGetID
protected int traverseUpGetID(int id, int maxHops) Traverses up the tree to find a parent node X hops away -
getTotalWords
public int getTotalWords()Description copied from interface:FeatureSceneRecognitionReturns the number of unique words. it's assumed that the word ID's will occupy 0 to this value.- Specified by:
getTotalWordsin interfaceFeatureSceneRecognition<TD extends TupleDesc<TD>>
-
getDescriptorType
Description copied from interface:FeatureSceneRecognitionThe image data type which can be processed- Specified by:
getDescriptorTypein interfaceFeatureSceneRecognition<TD extends TupleDesc<TD>>
-
setVerbose
- Specified by:
setVerbosein interfaceVerbosePrint
-