本文整理汇总了Java中net.semanticmetadata.lire.utils.MetricsUtils.distL1方法的典型用法代码示例。如果您正苦于以下问题:Java MetricsUtils.distL1方法的具体用法?Java MetricsUtils.distL1怎么用?Java MetricsUtils.distL1使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.semanticmetadata.lire.utils.MetricsUtils
的用法示例。
在下文中一共展示了MetricsUtils.distL1方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDistance
import net.semanticmetadata.lire.utils.MetricsUtils; //导入方法依赖的package包/类
public float getDistance(LireFeature vd) {
// Check if instance of the right class ...
if (!(vd instanceof SimpleColorHistogram))
throw new UnsupportedOperationException("Wrong descriptor.");
// casting ...
SimpleColorHistogram ch = (SimpleColorHistogram) vd;
// check if parameters are fitting ...
if ((ch.histogram.length != histogram.length) || (ch.histogramType != histogramType))
throw new UnsupportedOperationException("Histogram lengths or color spaces do not match");
// do the comparison ...
double sum = 0;
if (distFunc == DistanceFunction.JSD)
return (float) MetricsUtils.jsd(histogram, ch.histogram);
else if (distFunc == DistanceFunction.TANIMOTO)
return (float) MetricsUtils.tanimoto(histogram, ch.histogram);
else if (distFunc == DistanceFunction.L1)
return (float) MetricsUtils.distL1(histogram, ch.histogram);
else
return (float) MetricsUtils.distL2(histogram, ch.histogram);
}
示例2: getDistance
import net.semanticmetadata.lire.utils.MetricsUtils; //导入方法依赖的package包/类
public float getDistance(LireFeature feature) {
// chi^2 distance ... as mentioned in the paper.
// double distance = 0;
// double lower;
// for (int i = 0; i < histogram.length; i++) {
// lower = histogram[i] + ((BinaryPatternsPyramid) feature).histogram[i];
// if (lower > 0)
// distance += (histogram[i] - ((BinaryPatternsPyramid) feature).histogram[i]) * (histogram[i] - ((BinaryPatternsPyramid) feature).histogram[i]) / lower;
// }
// return (float) distance;
return (float) MetricsUtils.distL1(histogram, ((BinaryPatternsPyramid) feature).histogram);
}
示例3: getDistance
import net.semanticmetadata.lire.utils.MetricsUtils; //导入方法依赖的package包/类
public float getDistance(LireFeature feature) {
// chi^2 distance ... as mentioned in the paper.
// double distance = 0;
// double lower;
// for (int i = 0; i < histogram.length; i++) {
// lower = histogram[i] + ((PHOG) feature).histogram[i];
// if (lower > 0)
// distance += (histogram[i] - ((PHOG) feature).histogram[i]) * (histogram[i] - ((PHOG) feature).histogram[i]) / lower;
// }
// return (float) distance;
return (float) MetricsUtils.distL1(histogram, ((PHOG) feature).histogram);
}
示例4: getDistance
import net.semanticmetadata.lire.utils.MetricsUtils; //导入方法依赖的package包/类
@Override
public float getDistance(LireFeature feature) {
// it is assumed that the histograms are of equal length.
assert(feature.getDoubleHistogram().length == data.length);
return (float) MetricsUtils.distL1(feature.getDoubleHistogram(), data);
}
示例5: getDistance
import net.semanticmetadata.lire.utils.MetricsUtils; //导入方法依赖的package包/类
public float getDistance(LireFeature feature) {
return (float) MetricsUtils.distL1(histogram, ((LuminanceLayout) feature).histogram);
}
示例6: getDistance
import net.semanticmetadata.lire.utils.MetricsUtils; //导入方法依赖的package包/类
@Override
public float getDistance(LireFeature feature) {
if (!(feature instanceof SPLBP)) return -1;
return (float) MetricsUtils.distL1(histogram, feature.getDoubleHistogram());
}
示例7: getDistance
import net.semanticmetadata.lire.utils.MetricsUtils; //导入方法依赖的package包/类
@Override
public float getDistance(LireFeature feature) {
return (float) MetricsUtils.distL1(histogram, feature.getDoubleHistogram());
}