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
-
Constructor Summary
ConstructorDescriptionFeatureSceneRecognitionNister2006
(ConfigRecognitionNister2006 config, Factory<TD> factory) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addImage
(String id, FeatureSceneRecognition.Features<TD> features) Adds a new image to the databasevoid
Removes 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 databaseint
getQueryWord
(int featureIdx) Returns a single word which describes this image feature.void
getQueryWords
(int featureIdx, DogArray_I32 words) Used to retrieve all the words a feature is associated with.int
Returns the number of unique words.void
learnModel
(Iterator<FeatureSceneRecognition.Features<TD>> images) Learns a model using the already extracted image featuresint
lookupWord
(TD description) void
lookupWords
(TD description, DogArray_I32 word) protected void
lookupWordsFromLeafID
(int leafID, DogArray_I32 word) Given the leafID lookup the other words in the tree leading to the leaf.boolean
query
(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.void
void
setVerbose
(@Nullable PrintStream out, @Nullable Set<String> set) protected int
traverseUpGetID
(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:FeatureSceneRecognition
Learns a model using the already extracted image features- Specified by:
learnModel
in interfaceFeatureSceneRecognition<TD extends TupleDesc<TD>>
-
clearDatabase
public void clearDatabase()Description copied from interface:FeatureSceneRecognition
Removes all images from the database. The model is not modified- Specified by:
clearDatabase
in interfaceFeatureSceneRecognition<TD extends TupleDesc<TD>>
-
addImage
Description copied from interface:FeatureSceneRecognition
Adds a new image to the database- Specified by:
addImage
in interfaceFeatureSceneRecognition<TD extends TupleDesc<TD>>
- Parameters:
id
- The unique ID for this imagefeatures
- All the features in this image
-
getImageIds
Description copied from interface:FeatureSceneRecognition
Returns a list of image IDs in the database- Specified by:
getImageIds
in 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:FeatureSceneRecognition
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.- Specified by:
query
in 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:FeatureSceneRecognition
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.- Specified by:
getQueryWord
in 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:FeatureSceneRecognition
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.- Specified by:
getQueryWords
in 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:
lookupWord
in interfaceFeatureSceneRecognition<TD extends TupleDesc<TD>>
-
lookupWords
- Specified by:
lookupWords
in 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:FeatureSceneRecognition
Returns the number of unique words. it's assumed that the word ID's will occupy 0 to this value.- Specified by:
getTotalWords
in interfaceFeatureSceneRecognition<TD extends TupleDesc<TD>>
-
getDescriptorType
Description copied from interface:FeatureSceneRecognition
The image data type which can be processed- Specified by:
getDescriptorType
in interfaceFeatureSceneRecognition<TD extends TupleDesc<TD>>
-
setVerbose
- Specified by:
setVerbose
in interfaceVerbosePrint
-