Class MultiViewStereoOps

java.lang.Object
boofcv.alg.mvs.MultiViewStereoOps

public class MultiViewStereoOps extends Object
Useful functions when performing multi-view stereo.
  • Constructor Details

    • MultiViewStereoOps

      public MultiViewStereoOps()
  • Method Details

    • maskOutPointsInCloud

      public static void maskOutPointsInCloud(List<Point3D_F64> cloud, GrayF32 inverseDepth, Se3_F64 cloud_to_camera, Point2Transform2_F64 rectNorm_to_dispPixel, double tolerance, GrayU8 mask)

      Masks out point in a inverse depth image which appear to be too similar to what's already in a point cloud. This is done to avoid adding the same point twice

      NOTE: The reason a transform is required to go from norm to pixel for stereo, which is normally a simple equation, is that the disparity image might be a fused disparity image that includes lens distortion

      Parameters:
      cloud - (Input) set of 3D points
      inverseDepth - (Input) Disparity image.
      cloud_to_camera - (Input) Transform from point cloud to rectified stereo coordinate systems.
      rectNorm_to_dispPixel - (Input) Transform from undistorted normalized image coordinates in rectified reference frame into disparity pixels.
      tolerance - (Input) How similar the projected point and observed disparity need to be for it to be considered the same.
      mask - (Input,Output) On input it indicates which pixels are already masked out and new points are added to it for output.
    • disparityToCloud

      public static void disparityToCloud(GrayF32 disparity, DisparityParameters parameters, BoofLambdas.PixXyzConsumer_F64 consumer)
      Converts the disparity image into a point cloud. In this case we will assume that the disparity image does not include lens distortion, as is typical but not always true. Output cloud will be in camera frame and not rectified frame.
      Parameters:
      disparity - (Input) Disparity image
      parameters - (Input) Parameters which describe the meaning of values in the disparity image
    • disparityToCloud

      public static void disparityToCloud(ImageGray<?> disparity, DisparityParameters parameters, @Nullable @Nullable PixelTransform<Point2D_F64> pixelToNorm, BoofLambdas.PixXyzConsumer_F64 consumer)
      Converts the disparity image into a point cloud. Output cloud will be in camera frame and not rectified frame.
      Parameters:
      disparity - (Input) Disparity image
      parameters - (Input) Parameters which describe the meaning of values in the disparity image
      pixelToNorm - (Input) Normally this can be set to null. If not null, then it specifies how to convert pixels into normalized image coordinates. Almost always a disparity image has no lens distortion, but in the unusual situation that it does (i.e. fused disparity) then you need to pass this in.
      consumer - (Output) Passes along the rectified pixel coordinate and 3D (X,Y,Z) for each valid disparity point
    • inverseToCloud

      public static void inverseToCloud(GrayF32 inverseDepth, PixelTransform<Point2D_F64> pixelToNorm, BoofLambdas.PixXyzConsumer_F64 consumer)
      Inverse depth image to point cloud.
    • averageScore

      public static float averageScore(ImageGray<?> disparity, double disparityRange, GrayF32 score)
      Computes the average error for valid values inside a disparity image
      Parameters:
      disparity - (Input) disparity image
      disparityRange - (Input) range of disparity values. Used to identify invalid values.
      score - (Input) Disparity fit errors for all pixels
    • invalidateUsingError

      public static void invalidateUsingError(ImageGray<?> disparity, double disparityRange, GrayF32 score, float threshold)
      Marks disparity pixels as invalid if their error exceeds the threshold
      Parameters:
      disparity - (Input) disparity image
      disparityRange - (Input) range of disparity values. Used to identify invalid values.
      score - (Input) Disparity fit errors for all pixels
      threshold - Score threshold
    • invalidateBorder

      public static void invalidateBorder(int width, int height, PixelTransform<Point2D_F64> dist_to_undist, DMatrixRMaj undist_to_rect, int radius, float invalidValue, GrayF32 disparity)
      Projects the input image's border onto the rectified image and marks all pixels it touches as invalid in the disparity image. This is done to remove certain false positives along the border.
      Parameters:
      width - Input image's width
      height - Input image's height
      dist_to_undist - distorted pixel to undistorted
      undist_to_rect - undistorted to rectified images
      radius - Square region's radius
      disparity - (Output) Disparity image that's going to have pixels blocked out