Class LensDistortionOps
- java.lang.Object
-
- boofcv.alg.distort.LensDistortionOps
-
public class LensDistortionOps extends java.lang.ObjectOperations related to manipulating lens distortion in images
-
-
Constructor Summary
Constructors Constructor and Description LensDistortionOps()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static RectangleLength2D_F32boundBoxInside(int srcWidth, int srcHeight, PixelTransform_F32 transform)Finds the maximum area axis-aligned rectangle contained inside the transformed image which does not include any pixels outside the sources border.static RectangleLength2D_F64boundBoxInside(int srcWidth, int srcHeight, PixelTransform_F64 transform)Finds the maximum area axis-aligned rectangle contained inside the transformed image which does not include any pixels outside the sources border.static <T extends ImageBase>
ImageDistort<T,T>imageRemoveDistortion(AdjustmentType type, BorderType borderType, IntrinsicParameters param, IntrinsicParameters paramAdj, ImageType<T> imageType)Creates anImageDistortclass which will remove the lens distortion.static voidroundInside(RectangleLength2D_F32 bound)Adjust bound to ensure the entire image is contained inside, otherwise there might be single pixel wide black regionsstatic voidroundInside(RectangleLength2D_F64 bound)Adjust bound to ensure the entire image is contained inside, otherwise there might be single pixel wide black regionsstatic PointTransform_F32transform_F32(AdjustmentType type, IntrinsicParameters param, IntrinsicParameters paramAdj, boolean undistortedToDistorted)Creates aPointTransform_F32for adding and removing lens distortion.static PointTransform_F64transform_F64(AdjustmentType type, IntrinsicParameters param, IntrinsicParameters paramAdj, boolean undistortedToDistorted)Creates aPointTransform_F64for adding and removing lens distortion.static LensDistortionPinholetransformPoint(IntrinsicParameters param)Creates thelens distortionfor the specified camera parameters.
-
-
-
Method Detail
-
imageRemoveDistortion
public static <T extends ImageBase> ImageDistort<T,T> imageRemoveDistortion(AdjustmentType type, BorderType borderType, IntrinsicParameters param, IntrinsicParameters paramAdj, ImageType<T> imageType)
Creates an
ImageDistortclass which will remove the lens distortion. The user can select how the view is adjusted.If BorderType.VALUE then pixels outside the image will be filled in with a value of 0. For viewing purposes it is recommended that BorderType.VALUE be used and BorderType.EXTENDED in computer vision applications. VALUE creates harsh edges which can cause false positives when detecting features, which EXTENDED minimizes.
- Parameters:
type- The type of adjustment it will doborderType- Specifies how the image border is handled. Null means borders are ignored.param- Original intrinsic parameters.paramAdj- (output) Intrinsic parameters which reflect the undistorted image. Can be null.imageType- Type of image it will undistort- Returns:
- ImageDistort which removes lens distortion
-
transform_F32
public static PointTransform_F32 transform_F32(AdjustmentType type, IntrinsicParameters param, IntrinsicParameters paramAdj, boolean undistortedToDistorted)
Creates aPointTransform_F32for adding and removing lens distortion.- Parameters:
type- The type of adjustment it will apply to the transformparam- Intrinsic camera parameters.paramAdj- If not null, the new camera parameters for the undistorted view are stored here.undistortedToDistorted- If true then the transform's input is assumed to be pixels in the adjusted undistorted image and the output will be in distorted image, if false then the reverse transform is returned.- Returns:
- The requested transform
-
transform_F64
public static PointTransform_F64 transform_F64(AdjustmentType type, IntrinsicParameters param, IntrinsicParameters paramAdj, boolean undistortedToDistorted)
Creates aPointTransform_F64for adding and removing lens distortion.- Parameters:
type- The type of adjustment it will apply to the transformparam- Intrinsic camera parameters.paramAdj- If not null, the new camera parameters for the undistorted view are stored here.undistortedToDistorted- If true then the transform's input is assumed to be pixels in the adjusted undistorted image and the output will be in distorted image, if false then the reverse transform is returned.- Returns:
- The requested transform
-
transformPoint
public static LensDistortionPinhole transformPoint(IntrinsicParameters param)
Creates the
lens distortionfor the specified camera parameters. Call this to create transforms to and from pixel and normalized image coordinates with and without lens distortion. Automatically switches algorithm depending on the type of distortion or lack thereof.Example:
PointTransform_F64 normToPixel = LensDistortionOps.distortTransform(param).distort_F64(false,true);
Creates a transform from normalized image coordinates into pixel coordinates.
-
boundBoxInside
public static RectangleLength2D_F32 boundBoxInside(int srcWidth, int srcHeight, PixelTransform_F32 transform)
Finds the maximum area axis-aligned rectangle contained inside the transformed image which does not include any pixels outside the sources border. Assumes that the coordinates are not flipped and some other stuff too.- Parameters:
srcWidth- Width of the source imagesrcHeight- Height of the source imagetransform- Transform being applied to the image- Returns:
- Bounding box
-
boundBoxInside
public static RectangleLength2D_F64 boundBoxInside(int srcWidth, int srcHeight, PixelTransform_F64 transform)
Finds the maximum area axis-aligned rectangle contained inside the transformed image which does not include any pixels outside the sources border. Assumes that the coordinates are not flipped and some other stuff too.- Parameters:
srcWidth- Width of the source imagesrcHeight- Height of the source imagetransform- Transform being applied to the image- Returns:
- Bounding box
-
roundInside
public static void roundInside(RectangleLength2D_F32 bound)
Adjust bound to ensure the entire image is contained inside, otherwise there might be single pixel wide black regions
-
roundInside
public static void roundInside(RectangleLength2D_F64 bound)
Adjust bound to ensure the entire image is contained inside, otherwise there might be single pixel wide black regions
-
-
DataMelt 3.0 © DataMelt by jWork.ORG