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
Nested ClassesModifier and TypeClassDescriptionprotected static classDescribes the relationship between two imagesstatic interfaceContains logic for deciding if two images are similar or not from associated features and their image coordinates. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSimilarImagesSceneRecognition(DetectDescribePoint<Image, TD> detector, AssociateDescriptionHashSets<TD> asscociator, FeatureSceneRecognition<TD> recognizer, BoofLambdas.Factory<PackedArray<TD>> factoryPackedDesc) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a new image.voidfindSimilar(String target, BoofLambdas.Filter<String> filter, List<String> similarImages) Given an imageID, it will find list of similar images.voidfixate()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 basebooleanlookupAssociated(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>).voidlookupImageWords(String imageID, DogArray_I32 words) Looks up the word each feature belongs in for an imagevoidlookupPixelFeats(String target, DogArray<Point2D_F64> features) Looks up pixel observations of features in the specified view.voidsetVerbose(@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:LookUpSimilarImagesReturns a list of all images by ID that it has in its data base- Specified by:
getImageIDsin interfaceLookUpSimilarImages
-
findSimilar
public void findSimilar(String target, @Nullable BoofLambdas.Filter<String> filter, List<String> similarImages) Description copied from interface:LookUpSimilarImagesGiven 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:
findSimilarin 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:LookUpSimilarImagesLooks up pixel observations of features in the specified view.- Specified by:
lookupPixelFeatsin interfaceLookUpSimilarImages- Parameters:
target- ID of target imagefeatures- Storage for pixel observations. Cleared upon each call
-
lookupAssociated
Description copied from interface:LookUpSimilarImagesLooks 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:
lookupAssociatedin 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:
setVerbosein interfaceVerbosePrint
-