@Override public double computeDistance(PointVectorNN pt) { return alg.computeDistance(pt.p); }
@Override public void setModel(Model model) { alg.setModel(model); }
@Override public Class<Model> getModelType() { return errorMetric.getModelType(); } }
/** * Finds members of 'shape' in 'points' using a distance test. */ protected void findMembersRigorous(FoundShape shape, List<PointVectorNN> points, List<PointVectorNN> members) { ShapeDescription desc = models.get(shape.whichShape); DistanceFromModel function = desc.modelDistance; double threshold = desc.thresholdFit; function.setModel(shape.modelParam); for (int i = 0; i < points.size(); i++) { PointVectorNN pv = points.get(i); double d = function.computeDistance(pv); if (d <= threshold) { members.add(pv); } } }
@Override public Class<Point> getPointType() { return modelError.getPointType(); }
/** * Looks for points in the data set which closely match the current best * fit model in the optimizer. * * @param dataSet The points being considered */ @SuppressWarnings({"ForLoopReplaceableByForEach"}) protected void selectMatchSet(List<Point> dataSet, double threshold, Model param) { candidatePoints.clear(); modelDistance.setModel(param); for (int i = 0; i < dataSet.size(); i++) { Point point = dataSet.get(i); double distance = modelDistance.computeDistance(point); if (distance < threshold) { matchToInput[candidatePoints.size()] = i; candidatePoints.add(point); } } }
@Override public Class<Point> getPointType() { return modelDistance.getPointType(); }
private void compareToShape(FoundShape shape) { ShapeDescription desc = models.get(shape.whichShape); desc.modelDistance.setModel(shape.modelParam); for (int i = 0; i < shape.points.size(); i++) { PointVectorNN pv = shape.points.get(i); int which = cloudToShape.data[pv.index]; if (which < 0) continue; PixelInfo info = shapePixels.get(which); info.matched = true; double d = desc.modelDistance.computeDistance(pv); info.external = Math.min(d, info.external); } }
/** * Computes the mean and standard deviation of the points from the model */ private void computeMean() { meanError = 0; int size = allPoints.size(); for (PointIndex<Point> inlier : allPoints) { Point pt = inlier.data; meanError += modelError.computeDistance(pt); } meanError /= size; }
modelError.setModel(currParam); errorAlg.computeStatistics(); centerError = errorAlg.getErrorMetric();
@Override public Class<Model> getModelType() { return modelError.getModelType(); } }
@Override public Class<Point> getPointType() { return errorMetric.getPointType(); }
/** * Exhaustively searches through the list of points contained in 'dataSet' for the set of inliers which match * the provided model. It keeps track of the mapping between the index of the inlier list and the 'dataSet' list * using the matchToInput[] array. If there is no corresponding (can't happen by default) match then -1 * should be set in matchToInput.. * * @param modelDistance Computes */ protected <Model>void selectMatchSet( List<Point> dataSet , DistanceFromModel<Model,Point> modelDistance , double threshold, Model param) { candidatePoints.clear(); modelDistance.setModel(param); for (int i = 0; i < dataSet.size(); i++) { Point point = dataSet.get(i); double distance = modelDistance.computeDistance(point); if (distance < threshold) { matchToInput[candidatePoints.size()] = i; candidatePoints.add(point); } } }
/** * Computes the mean and standard deviation of the points from the model */ private void computeMean() { meanError = 0; int size = allPoints.size(); for (PointIndex<Point> inlier : allPoints) { Point pt = inlier.data; meanError += modelError.computeDistance(pt); } meanError /= size; }
modelError.setModel(currParam); errorAlg.computeStatistics(); centerError = errorAlg.getErrorMetric();
@Override public Class<Model> getModelType() { return modelDistance.getModelType(); } }
@Override public Class<Point> getPointType() { return modelDistance.getPointType(); }
/** * Looks for points in the data set which closely match the current best * fit model in the optimizer. * * @param dataSet The points being considered */ @SuppressWarnings({"ForLoopReplaceableByForEach"}) protected void selectMatchSet(List<Point> dataSet, double threshold, Model param) { candidatePoints.clear(); modelDistance.setModel(param); for (int i = 0; i < dataSet.size(); i++) { Point point = dataSet.get(i); double distance = modelDistance.computeDistance(point); if (distance < threshold) { matchToInput[candidatePoints.size()] = i; candidatePoints.add(point); } } }
private void computeStandardDeviation() { stdError = 0; int size = allPoints.size(); for (PointIndex<Point> inlier : allPoints) { Point pt = inlier.data; double e = modelError.computeDistance(pt) - meanError; stdError += e * e; } stdError = Math.sqrt(stdError / size); } }
@Override public Class<Model> getModelType() { return modelDistance.getModelType(); } }