Package boofcv.alg.similar
Class SimilarImagesSceneRecognition<Image extends ImageBase<Image>,TD extends TupleDesc<TD>>
java.lang.Object
boofcv.alg.similar.SimilarImagesSceneRecognition<Image,TD>
- All Implemented Interfaces:
LookUpSimilarImages
,VerbosePrint
public class SimilarImagesSceneRecognition<Image extends ImageBase<Image>,TD extends TupleDesc<TD>>
extends Object
implements LookUpSimilarImages, VerbosePrint
Identifies similar images using
FeatureSceneRecognition
. For each image which is added
a set of image features (descriptions and pixel coordinate) is found using the detector
. After all
the images have been added fixate()
is called and after sometime a fast but not 100% reliable
model which be required for looking up which images are similar. In this case similar means that they are of
the same physical scene but from a "similar" perspective. Then for each image all the "similar" images are found
and the image features are associated. Theses associated image features are tested to see if the two images
really are related using the logic specified by similarityTest
. If they are related their
pairwise information is saved for later fast retrieval.
While building there is significant cost in building the retrieval system, this is in general much faster than
considering every possible image pair and trying to match them. The main down side is that it will not be
100% reliable.-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
Describes the relationship between two imagesstatic interface
Contains logic for deciding if two images are similar or not from associated features and their image coordinates. -
Field Summary
-
Constructor Summary
ConstructorDescriptionSimilarImagesSceneRecognition
(DetectDescribePoint<Image, TD> detector, AssociateDescriptionHashSets<TD> asscociator, FeatureSceneRecognition<TD> recognizer, BoofLambdas.Factory<PackedArray<TD>> factoryPackedDesc) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a new image.void
findSimilar
(String target, BoofLambdas.Filter<String> filter, List<String> similarImages) Given an imageID, it will find list of similar images.void
fixate()
After all the images you wish to look up have been added call this function.Returns a list of all images by ID that it has in its data baseboolean
lookupAssociated
(String viewDst, DogArray<AssociatedIndex> pairs) Looks up pairs of associated features from a similar image which was returned in the most recent call toLookUpSimilarImages.findSimilar(java.lang.String, boofcv.misc.BoofLambdas.Filter<java.lang.String>, java.util.List<java.lang.String>)
.void
lookupImageWords
(String imageID, DogArray_I32 words) Looks up the word each feature belongs in for an imagevoid
lookupPixelFeats
(String target, DogArray<Point2D_F64> features) Looks up pixel observations of features in the specified view.void
setVerbose
(@Nullable PrintStream out, @Nullable Set<String> options)
-
Field Details
-
Constructor Details
-
SimilarImagesSceneRecognition
public SimilarImagesSceneRecognition(DetectDescribePoint<Image, TD> detector, AssociateDescriptionHashSets<TD> asscociator, FeatureSceneRecognition<TD> recognizer, BoofLambdas.Factory<PackedArray<TD>> factoryPackedDesc)
-
-
Method Details
-
addImage
Adds a new image. Must callfixate()
inorder for it to be retrieved later on- Parameters:
id
- Unique ID for this imageimage
- The image
-
fixate
public void fixate()After all the images you wish to look up have been added call this function. If you add more images after calling fixate you will need to call it again. -
getImageIDs
Description copied from interface:LookUpSimilarImages
Returns a list of all images by ID that it has in its data base- Specified by:
getImageIDs
in interfaceLookUpSimilarImages
-
findSimilar
public void findSimilar(String target, @Nullable BoofLambdas.Filter<String> filter, List<String> similarImages) Description copied from interface:LookUpSimilarImages
Given an imageID, it will find list of similar images. Similarity is defined from the perspective of the 'target', so viewA might think viewB is similar to it, but viewB might think viewA is not similar to it.- Specified by:
findSimilar
in interfaceLookUpSimilarImages
- Parameters:
target
- (Input) ID of target imagefilter
- (Input) Filter results by ID. true = keep, false = reject. Null means no filter.similarImages
- (Output) Storage for IDs of similar images. Cleared upon each call
-
lookupPixelFeats
Description copied from interface:LookUpSimilarImages
Looks up pixel observations of features in the specified view.- Specified by:
lookupPixelFeats
in interfaceLookUpSimilarImages
- Parameters:
target
- ID of target imagefeatures
- Storage for pixel observations. Cleared upon each call
-
lookupAssociated
Description copied from interface:LookUpSimilarImages
Looks up pairs of associated features from a similar image which was returned in the most recent call toLookUpSimilarImages.findSimilar(java.lang.String, boofcv.misc.BoofLambdas.Filter<java.lang.String>, java.util.List<java.lang.String>)
. The src will be the target in 'findSimilar' and the dst will be the requested similar image.- Specified by:
lookupAssociated
in interfaceLookUpSimilarImages
- Parameters:
viewDst
- ID of a similar image to the target when callingLookUpSimilarImages.findSimilar(java.lang.String, boofcv.misc.BoofLambdas.Filter<java.lang.String>, java.util.List<java.lang.String>)
.pairs
- Storage for associated features. Cleared upon each call- Returns:
- true if views are similar and have known associations. False if not and results should be ignored
-
lookupImageWords
Looks up the word each feature belongs in for an image -
setVerbose
public void setVerbose(@Nullable @Nullable PrintStream out, @Nullable @Nullable Set<String> options) - Specified by:
setVerbose
in interfaceVerbosePrint
-