Package boofcv.alg.mvs
Class MultiViewStereoOps
java.lang.Object
boofcv.alg.mvs.MultiViewStereoOps
Useful functions when performing multi-view stereo.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic float
averageScore
(ImageGray<?> disparity, double disparityRange, GrayF32 score) Computes the average error for valid values inside a disparity imagestatic void
disparityToCloud
(GrayF32 disparity, DisparityParameters parameters, BoofLambdas.PixXyzConsumer_F64 consumer) Converts the disparity image into a point cloud.static void
disparityToCloud
(ImageGray<?> disparity, DisparityParameters parameters, @Nullable PixelTransform<Point2D_F64> pixelToNorm, BoofLambdas.PixXyzConsumer_F64 consumer) Converts the disparity image into a point cloud.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.static void
invalidateUsingError
(ImageGray<?> disparity, double disparityRange, GrayF32 score, float threshold) Marks disparity pixels as invalid if their error exceeds the thresholdstatic void
inverseToCloud
(GrayF32 inverseDepth, PixelTransform<Point2D_F64> pixelToNorm, BoofLambdas.PixXyzConsumer_F64 consumer) Inverse depth image to point cloud.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.
-
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 pointsinverseDepth
- (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 imageparameters
- (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 imageparameters
- (Input) Parameters which describe the meaning of values in the disparity imagepixelToNorm
- (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
Computes the average error for valid values inside a disparity image- Parameters:
disparity
- (Input) disparity imagedisparityRange
- (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 imagedisparityRange
- (Input) range of disparity values. Used to identify invalid values.score
- (Input) Disparity fit errors for all pixelsthreshold
- 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 widthheight
- Input image's heightdist_to_undist
- distorted pixel to undistortedundist_to_rect
- undistorted to rectified imagesradius
- Square region's radiusdisparity
- (Output) Disparity image that's going to have pixels blocked out
-