@Override public DoubleFV getFeatureVector(ColourDescriptor desc) { return new DoubleFV(desc.colmodel.mean); } },
/** * Convert the FV to a DoubleFV representation * @return the DoubleFV representation */ @Override public DoubleFV asDoubleFV() { return new DoubleFV(asDoubleVector()); }
@Override public void readBinary(DataInput in) throws IOException { fv = new DoubleFV(); fv.readBinary(in); }
@Override public DoubleFV normaliseFV(double p) { return asDoubleFV().normaliseFV(p); }
private void drawHistogramImage(DoubleFV histogram) { histogram = histogram.normaliseFV(); final int width = this.histogramImage.getWidth(); final int height = this.histogramImage.getHeight(); final int bw = width / histogram.length(); this.histogramImage.zero(); final MBFImageRenderer renderer = this.histogramImage.createRenderer(); final Rectangle s = new Rectangle(); s.width = bw; for (int i = 0; i < histogram.values.length; i++) { final int rectHeight = (int) (histogram.values[i] * height); final int remHeight = height - rectHeight; s.x = i * bw; s.y = remHeight; s.height = rectHeight; renderer.drawShapeFilled(s, this.mode.colourForBin(i)); } }
/** * This searches through the keypoints in klist for the closest match to key. */ protected T findMatch(T query, List<T> features) { double distsq = Double.MAX_VALUE; T minkey = null; // find closest match for (final T target : features) { final double dsq = target.getFeatureVector().asDoubleFV() .compare(query.getFeatureVector().asDoubleFV(), DoubleFVComparison.SUM_SQUARE); if (dsq < distsq) { distsq = dsq; minkey = target; } } return minkey; }
double[] d = edcv.getLastHistogram().asDoubleFV().asDoubleVector();
@Override public void readBinary(DataInput in) throws IOException { fv = new DoubleFV(); fv.readBinary(in); }
@Override public DoubleFV normaliseFV(double p) { return asDoubleFV().normaliseFV(p); }
private void drawHistogramImage(DoubleFV histogram) { histogram = histogram.normaliseFV(); final int width = this.histogramImage.getWidth(); final int height = this.histogramImage.getHeight(); final int bw = width / histogram.length(); this.histogramImage.zero(); final MBFImageRenderer renderer = this.histogramImage.createRenderer(); final Rectangle s = new Rectangle(); s.width = bw; for (int i = 0; i < histogram.values.length; i++) { final int rectHeight = (int) (histogram.values[i] * height); final int remHeight = height - rectHeight; s.x = i * bw; s.y = remHeight; s.height = rectHeight; renderer.drawShapeFilled(s, this.mode.colourForBin(i)); } }
/** * This searches through the keypoints in klist for the closest match to * key. */ protected T findMatch(T query, List<T> features) { double distsq = Double.MAX_VALUE; T minkey = null; // find closest match for (final T target : features) { final double dsq = target.getFeatureVector().asDoubleFV() .compare(query.getFeatureVector().asDoubleFV(), DoubleFVComparison.EUCLIDEAN); if (dsq < distsq) { distsq = dsq; minkey = target; } } return minkey; }
@Override public DoubleFV getFeatureVector(BasicShapeDescriptor desc) { return new DoubleFV(new double[] { desc.area }); } },
/** * Convert the FV to a DoubleFV representation * @return the DoubleFV representation */ @Override public DoubleFV asDoubleFV() { return new DoubleFV(asDoubleVector()); }
@Override public void readBinary(DataInput in) throws IOException { fv = new DoubleFV(); fv.readBinary(in); }
@Override public DoubleFV normaliseFV(double[] min, double[] max) { return asDoubleFV().normaliseFV(min, max); }
/** * This searches through the keypoints in klist for the two closest matches to * key. If the closest is less than <code>threshold</code> times distance to * second closest, then return the closest match. Otherwise, return NULL. */ protected T checkForMatch(T query, List<T> features) { double distsq1 = Double.MAX_VALUE, distsq2 = Double.MAX_VALUE; T minkey = null; // find two closest matches for (final T target : features) { final double dsq = target.getFeatureVector().asDoubleFV() .compare(query.getFeatureVector().asDoubleFV(), DoubleFVComparison.SUM_SQUARE); if (dsq < distsq1) { distsq2 = distsq1; distsq1 = dsq; minkey = target; } else if (dsq < distsq2) { distsq2 = dsq; } } // check the distance against the threshold if (10 * 10 * distsq1 < thresh * thresh * distsq2) { return minkey; } else return null; }