public void pruneObservationsByErrorRank( double inlierFraction ) {

		Point2D_F64 observation = new Point2D_F64();
		Point2D_F64 predicted = new Point2D_F64();
		Point3D_F64 X = new Point3D_F64();

		// Create a list of observation errors
		List<Errors> errors = new ArrayList<>();
		for (int viewIndex = 0; viewIndex < observations.views.length; viewIndex++) {
			SceneObservations.View v = observations.views[viewIndex];
			SceneStructureMetric.View view = structure.views[viewIndex];

			for (int pointIndex = 0; pointIndex < v.point.size; pointIndex++) {
				int pointID = v.point.data[pointIndex];
				SceneStructureMetric.Point f = structure.points[pointID];

				// Get feature location in world
				f.get(X);
				// Get observation in image pixels
				v.get(pointIndex, observation);

				// World to View
				view.worldToView.transform(X, X);

				// predicted pixel
				SceneStructureMetric.Camera camera = structure.cameras[view.camera];
				camera.model.project(X.x, X.y, X.z, predicted);

				Errors e = new Errors();
				e.view = viewIndex;
				e.pointIndexInView = pointIndex;
				e.error = predicted.distance2(observation);
				errors.add(e);
			}
		}

		errors.sort(Comparator.comparingDouble(a -> a.error));

		// Mark observations which are to be removed. Can't remove yet since the indexes will change
		for (int i = (int) (errors.size() * inlierFraction); i < errors.size(); i++) {
			Errors e = errors.get(i);

			SceneObservations.View v = observations.views[e.view];
			v.set(e.pointIndexInView, Float.NaN, Float.NaN);
		}

		// Remove all marked features
		removeMarkedObservations();
	}
public void pruneObservationsByErrorRank ( double inlierFraction ) { Point2D_F64 observation = new Point2D_F64 ( ) ; Point2D_F64 predicted = new Point2D_F64 ( ) ; Point3D_F64 X = new Point3D_F64 ( ) ; List < Errors > errors = new ArrayList < > ( ) ; for ( int viewIndex = 0 ; viewIndex < observations . views . length ; viewIndex ++ ) { SceneObservations . View v = observations . views [ viewIndex ] ; SceneStructureMetric . View view = structure . views [ viewIndex ] ; for ( int pointIndex = 0 ; pointIndex < v . point . size ; pointIndex ++ ) { int pointID = v . point . data [ pointIndex ] ; SceneStructureMetric . Point f = structure . points [ pointID ] ; f . get ( X ) ; v . get ( pointIndex , observation ) ; view . worldToView . transform ( X , X ) ; SceneStructureMetric . Camera camera = structure . cameras [ view . camera ] ; camera . model . project ( X . x , X . y , X . z , predicted ) ; Errors e = new Errors ( ) ; e . view = viewIndex ; e . pointIndexInView = pointIndex ; e . error = predicted . distance2 ( observation ) ; errors . add ( e ) ; } } errors . sort ( Comparator . comparingDouble ( a -> a . error ) ) ; for ( int i = ( int ) ( errors . size ( ) * inlierFraction ) ; i < errors . size ( ) ; i ++ ) { Errors e = errors . get ( i ) ; SceneObservations . View v = observations . views [ e . view ] ; v . set ( e . pointIndexInView , Float . NaN , Float . NaN ) ; } removeMarkedObservations ( ) ; }
Computes reprojection error for all features. Sorts the resulting residuals by magnitude.
Prunes observations which have the largest errors first. After calling this function you should
call {@link #prunePoints(int)} and {@link #pruneViews(int)} to ensure the scene is still valid.

@param inlierFraction Fraction of observations to keep. 0 to 1. 1 = no change. 0 = everything is pruned.