@Override public void setModel(Model model) { alg.setModel(model); }
/** * 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); } } }
/** * 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); } } }
/** * 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); } } }
/** * 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); } } }
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); } }
/** * 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); } } }
private void computeInlierSet(List<Point> dataSet, int n) { int numPts = (int)(n *inlierFrac); if( inlierFrac > 0 && numPts > sampleSize ) { inlierSet.clear(); errorMetric.setModel(bestParam); errorMetric.computeDistance(dataSet,errors); int []indexes = new int[n]; QuickSelect.selectIndex(errors,numPts, n,indexes); for( int i = 0; i < numPts; i++ ) { int origIndex = indexes[i]; inlierSet.add( dataSet.get(origIndex) ); matchToInput[i] = origIndex; } } else { inlierSet = dataSet; } }
private void computeInlierSet(List<Point> dataSet, int n) { int numPts = (int)(n *inlierFrac); if( inlierFrac > 0 && numPts > sampleSize ) { inlierSet.clear(); errorMetric.setModel(bestParam); errorMetric.computeDistance(dataSet,errors); int []indexes = new int[n]; QuickSelect.selectIndex(errors,numPts, n,indexes); for( int i = 0; i < numPts; i++ ) { int origIndex = indexes[i]; inlierSet.add( dataSet.get(origIndex) ); matchToInput[i] = origIndex; } } else { inlierSet = dataSet; } }
/** * Marks points in the point cloud as belonging to this shape for false shape detection * * @param shape */ private void setupShapeForFalse(FoundShape shape) { ShapeDescription desc = models.get(shape.whichShape); shapePixels.reset(); desc.modelDistance.setModel(shape.modelParam); for (int i = 0; i < shape.points.size(); i++) { PointVectorNN pv = shape.points.get(i); cloudToShape.data[pv.index] = i; PixelInfo info = shapePixels.grow(); info.internal = desc.modelDistance.computeDistance(shape.points.get(i)); info.external = Double.MAX_VALUE; info.matched = false; } }
modelDistance.setModel(param); marker++;
modelError.setModel(currParam); errorAlg.computeStatistics(); centerError = errorAlg.getErrorMetric();
Model m = solutions.get(i); distance.setModel(m);
Model m = solutions.get(i); distance.setModel(m);
errorMetric.setModel(candidate); errorMetric.computeDistance(_dataSet,errors);
modelError.setModel(currParam); errorAlg.computeStatistics(); centerError = errorAlg.getErrorMetric();
errorMetric.setModel(candidate); errorMetric.computeDistance(_dataSet,errors);