Search in sources :

Example 1 with ParameterisedLocationQueryTermContainer

use of org.vitrivr.cineast.core.data.query.containers.ParameterisedLocationQueryTermContainer in project cineast by vitrivr.

the class SpatialDistance method getSimilar.

/**
 * Returns similar <i>objects</i> to the feature data contained in the given segment container.
 */
@Override
public List<ScoreElement> getSimilar(SegmentContainer sc, ReadableQueryConfig qc) {
    final QueryConfig mqc = QueryConfig.clone(qc);
    if (sc instanceof ParameterisedLocationQueryTermContainer) {
        if (((ParameterisedLocationQueryTermContainer) sc).getParameter().isPresent()) {
            final String param = ((ParameterisedLocationQueryTermContainer) sc).getParameter().get();
            mqc.setCorrespondenceFunctionIfEmpty(CorrespondenceFunction.hyperbolic(parseAndEvaluateHalfSimilarityDistance(param)));
        }
    }
    return this.extractFeature(sc).map(ReadableFloatVector::toArray).map(array -> this.getSimilar(array, new ReadableQueryConfig(mqc))).orElse(Collections.emptyList());
}
Also used : ParameterisedLocationQueryTermContainer(org.vitrivr.cineast.core.data.query.containers.ParameterisedLocationQueryTermContainer) MetadataFeatureModule(org.vitrivr.cineast.core.features.abstracts.MetadataFeatureModule) CorrespondenceFunction(org.vitrivr.cineast.core.data.CorrespondenceFunction) ReadableFloatVector(org.vitrivr.cineast.core.data.ReadableFloatVector) QueryConfig(org.vitrivr.cineast.core.config.QueryConfig) ScoreElement(org.vitrivr.cineast.core.data.score.ScoreElement) MediaObjectMetadataDescriptor(org.vitrivr.cineast.core.data.entities.MediaObjectMetadataDescriptor) ReadableQueryConfig(org.vitrivr.cineast.core.config.ReadableQueryConfig) DoubleEvaluator(com.fathzer.soft.javaluator.DoubleEvaluator) LinkedHashMap(java.util.LinkedHashMap) GpsData(org.vitrivr.cineast.core.data.GpsData) List(java.util.List) Logger(org.apache.logging.log4j.Logger) ImmutableList(com.google.common.collect.ImmutableList) SegmentContainer(org.vitrivr.cineast.core.data.segments.SegmentContainer) Optional(java.util.Optional) Distance(org.vitrivr.cineast.core.config.ReadableQueryConfig.Distance) Path(java.nio.file.Path) Collections(java.util.Collections) LogManager(org.apache.logging.log4j.LogManager) Location(org.vitrivr.cineast.core.data.Location) ReadableQueryConfig(org.vitrivr.cineast.core.config.ReadableQueryConfig) QueryConfig(org.vitrivr.cineast.core.config.QueryConfig) ReadableQueryConfig(org.vitrivr.cineast.core.config.ReadableQueryConfig) ParameterisedLocationQueryTermContainer(org.vitrivr.cineast.core.data.query.containers.ParameterisedLocationQueryTermContainer) ReadableFloatVector(org.vitrivr.cineast.core.data.ReadableFloatVector)

Aggregations

DoubleEvaluator (com.fathzer.soft.javaluator.DoubleEvaluator)1 ImmutableList (com.google.common.collect.ImmutableList)1 Path (java.nio.file.Path)1 Collections (java.util.Collections)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 Optional (java.util.Optional)1 LogManager (org.apache.logging.log4j.LogManager)1 Logger (org.apache.logging.log4j.Logger)1 QueryConfig (org.vitrivr.cineast.core.config.QueryConfig)1 ReadableQueryConfig (org.vitrivr.cineast.core.config.ReadableQueryConfig)1 Distance (org.vitrivr.cineast.core.config.ReadableQueryConfig.Distance)1 CorrespondenceFunction (org.vitrivr.cineast.core.data.CorrespondenceFunction)1 GpsData (org.vitrivr.cineast.core.data.GpsData)1 Location (org.vitrivr.cineast.core.data.Location)1 ReadableFloatVector (org.vitrivr.cineast.core.data.ReadableFloatVector)1 MediaObjectMetadataDescriptor (org.vitrivr.cineast.core.data.entities.MediaObjectMetadataDescriptor)1 ParameterisedLocationQueryTermContainer (org.vitrivr.cineast.core.data.query.containers.ParameterisedLocationQueryTermContainer)1 ScoreElement (org.vitrivr.cineast.core.data.score.ScoreElement)1 SegmentContainer (org.vitrivr.cineast.core.data.segments.SegmentContainer)1