D
- The type of DetectedFace
F
- the type of FacialFeature
I
- The type of Image
public class FaceSimilarityEngine<D extends DetectedFace,F extends FacialFeature,I extends Image<?,I>> extends Object
FaceSimilarityEngine
allows computation of the similarity
between faces in two images.Constructor and Description |
---|
FaceSimilarityEngine(FaceDetector<D,I> detector,
FacialFeatureExtractor<F,D> extractor,
FacialFeatureComparator<F> comparator)
Construct a new
FaceSimilarityEngine from the
specified detector, extractor and comparator. |
Modifier and Type | Method and Description |
---|---|
FacialFeatureComparator<F> |
comparator() |
static <D extends DetectedFace,F extends FacialFeature,I extends Image<?,I>> |
create(FaceDetector<D,I> detector,
FacialFeatureExtractor<F,D> extractor,
FacialFeatureComparator<F> comparator)
Create a new
FaceSimilarityEngine from the
specified detector, extractor and comparator. |
FaceDetector<D,I> |
detector() |
FacialFeatureExtractor<F,D> |
extractor() |
Map<String,Rectangle> |
getBoundingBoxes() |
Map<String,Map<String,Double>> |
getSimilarityDictionary() |
SimilarityMatrix |
getSimilarityMatrix(boolean invertIfRequired)
Get the similarity matrix computed by
performTest() . |
void |
performTest()
Compute the similarities between faces in the query and target
|
void |
setCache(boolean cache)
Set whether detections should be cached
|
void |
setQuery(I queryImage,
String queryId)
Set the query image.
|
void |
setQueryTest()
Compare the query to itself for the next test
|
void |
setTest(I testImage,
String testId)
Set the image against which the query will be compared to next
|
public FaceSimilarityEngine(FaceDetector<D,I> detector, FacialFeatureExtractor<F,D> extractor, FacialFeatureComparator<F> comparator)
FaceSimilarityEngine
from the
specified detector, extractor and comparator.detector
- The face detectorextractor
- The feature extractorcomparator
- The feature comparatorpublic FaceDetector<D,I> detector()
public FacialFeatureExtractor<F,D> extractor()
public FacialFeatureComparator<F> comparator()
public static <D extends DetectedFace,F extends FacialFeature,I extends Image<?,I>> FaceSimilarityEngine<D,F,I> create(FaceDetector<D,I> detector, FacialFeatureExtractor<F,D> extractor, FacialFeatureComparator<F> comparator)
FaceSimilarityEngine
from the
specified detector, extractor and comparator.D
- The type of DetectedFace
F
- the type of FacialFeature
I
- The type of Image
detector
- The face detectorextractor
- The feature extractorcomparator
- The feature comparatorFaceSimilarityEngine
public void setQuery(I queryImage, String queryId)
queryImage
- the query imagequeryId
- the identifier of the query imagepublic void setTest(I testImage, String testId)
testImage
- testId
- public void setQueryTest()
public void performTest()
public Map<String,Map<String,Double>> getSimilarityDictionary()
public SimilarityMatrix getSimilarityMatrix(boolean invertIfRequired)
performTest()
.invertIfRequired
- invert distances into similarities if required.public Map<String,Rectangle> getBoundingBoxes()
public void setCache(boolean cache)
cache
- enable cache if true