public class PerspectiveOps
extends java.lang.Object
| Constructor and Description |
|---|
PerspectiveOps() |
| Modifier and Type | Method and Description |
|---|---|
static boofcv.struct.distort.PointTransform_F32 |
adjustIntrinsic_F32(boofcv.struct.distort.PointTransform_F32 distortPixel,
boolean forwardTran,
IntrinsicParameters parameters,
org.ejml.data.DenseMatrix64F adjustMatrix,
IntrinsicParameters adjustedParam)
Creates a new
PointTransform_F32 which is the same as applying a homography transform
and another arbitrary transform. |
static org.ejml.data.DenseMatrix64F |
calibrationMatrix(double fx,
double fy,
double skew,
double xc,
double yc)
Given the intrinsic parameters create a calibration matrix
|
static org.ejml.data.DenseMatrix64F |
calibrationMatrix(IntrinsicParameters param,
org.ejml.data.DenseMatrix64F K)
Given the intrinsic parameters create a calibration matrix
|
static georegression.struct.point.Point2D_F64 |
convertNormToPixel(org.ejml.data.DenseMatrix64F K,
georegression.struct.point.Point2D_F64 norm,
georegression.struct.point.Point2D_F64 pixel)
Convenient function for converting from normalized image coordinates to the original image pixel coordinate.
|
static georegression.struct.point.Point2D_F64 |
convertNormToPixel(IntrinsicParameters param,
double x,
double y,
georegression.struct.point.Point2D_F64 pixel)
Convenient function for converting from normalized image coordinates to the original image pixel coordinate.
|
static georegression.struct.point.Point2D_F64 |
convertNormToPixel(IntrinsicParameters param,
georegression.struct.point.Point2D_F64 norm,
georegression.struct.point.Point2D_F64 pixel)
Convenient function for converting from normalized image coordinates to the original image pixel coordinate.
|
static georegression.struct.point.Point2D_F64 |
convertPixelToNorm(org.ejml.data.DenseMatrix64F K,
georegression.struct.point.Point2D_F64 pixel,
georegression.struct.point.Point2D_F64 norm)
Convenient function for converting from original image pixel coordinate to normalized< image coordinates.
|
static georegression.struct.point.Point2D_F64 |
convertPixelToNorm(IntrinsicParameters param,
georegression.struct.point.Point2D_F64 pixel,
georegression.struct.point.Point2D_F64 norm)
Convenient function for converting from original image pixel coordinate to normalized< image coordinates.
|
static org.ejml.data.DenseMatrix64F |
createCameraMatrix(org.ejml.data.DenseMatrix64F R,
georegression.struct.point.Vector3D_F64 T,
org.ejml.data.DenseMatrix64F K,
org.ejml.data.DenseMatrix64F ret)
Create a 3x4 camera matrix.
|
static IntrinsicParameters |
matrixToParam(org.ejml.data.DenseMatrix64F K,
int width,
int height,
boolean flipY,
IntrinsicParameters param)
Converts a calibration matrix into intrinsic parameters
|
static georegression.struct.point.Point2D_F64 |
renderPixel(org.ejml.data.DenseMatrix64F worldToCamera,
georegression.struct.point.Point3D_F64 X)
Computes the image coordinate of a point given its 3D location and the camera matrix.
|
static georegression.struct.point.Point2D_F64 |
renderPixel(georegression.struct.se.Se3_F64 worldToCamera,
org.ejml.data.DenseMatrix64F K,
georegression.struct.point.Point3D_F64 X)
Renders a point in world coordinates into the image plane in pixels or normalized image
coordinates.
|
static void |
scaleIntrinsic(IntrinsicParameters param,
double scale)
Multiplies each element of the intrinsic parameters by the provided scale factor.
|
static void |
splitAssociated(java.util.List<AssociatedPair> pairs,
java.util.List<georegression.struct.point.Point2D_F64> view1,
java.util.List<georegression.struct.point.Point2D_F64> view2)
Takes a list of
AssociatedPair as input and breaks it up into two lists for each view. |
static void |
splitAssociated(java.util.List<AssociatedTriple> pairs,
java.util.List<georegression.struct.point.Point2D_F64> view1,
java.util.List<georegression.struct.point.Point2D_F64> view2,
java.util.List<georegression.struct.point.Point2D_F64> view3)
Takes a list of
AssociatedTriple as input and breaks it up into three lists for each view. |
public static void scaleIntrinsic(IntrinsicParameters param, double scale)
param - Intrinsic parametersscale - Scale factor that input image is being scaled by.public static boofcv.struct.distort.PointTransform_F32 adjustIntrinsic_F32(boofcv.struct.distort.PointTransform_F32 distortPixel,
boolean forwardTran,
IntrinsicParameters parameters,
org.ejml.data.DenseMatrix64F adjustMatrix,
IntrinsicParameters adjustedParam)
Creates a new PointTransform_F32 which is the same as applying a homography transform
and another arbitrary transform. A typical application is removing lens distortion. The order that each
transform is applied depends on if the arbitrary transform is forward or reverse transform. A new set of
camera parameters is computed to account for the adjustment.
When removing camera distortion, the undistorted image is likely to have a different shape not entirely enclosed by the original image. This can be compensated for by transforming the undistorted image using a homography transform. Typically this will translate and scale the undistorted image. The end result is a new virtual camera which has the adjusted intrinsic camera parameters.
The returned transform:
λx = A*K*[R|T]X
where A is the homography.
distortPixel - Transform that distorts the pixels in an image.forwardTran - If true then the distortion expects undistorted pixels as input, false means it
expects distorted pixels as input.parameters - Original intrinsic camera parametersadjustMatrix - Invertible homographyadjustedParam - The new intrinsic calibration matrix.public static org.ejml.data.DenseMatrix64F calibrationMatrix(double fx,
double fy,
double skew,
double xc,
double yc)
fx - Focal length x-axis in pixelsfy - Focal length y-axis in pixelsskew - skew in pixelsxc - camera center x-axis in pixelsyc - center center y-axis in pixelspublic static org.ejml.data.DenseMatrix64F calibrationMatrix(IntrinsicParameters param, org.ejml.data.DenseMatrix64F K)
param - Intrinsic parameters structure that is to be converted into a matrixK - Storage for calibration matrix, must be 3x3. If null then a new matrix is declaredpublic static IntrinsicParameters matrixToParam(org.ejml.data.DenseMatrix64F K, int width, int height, boolean flipY, IntrinsicParameters param)
K - Camera calibration matrix.width - Image width in pixelsheight - Image height in pixelsflipY - When calibrated was the y-axis adjusted with: y = (height - y - 1)param - Where the intrinsic parameter are written to. If null then a new instance is declared.public static georegression.struct.point.Point2D_F64 convertNormToPixel(IntrinsicParameters param, double x, double y, georegression.struct.point.Point2D_F64 pixel)
Convenient function for converting from normalized image coordinates to the original image pixel coordinate.
If speed is a concern then NormalizedToPixel_F64 should be used instead.
NOTE: Lens distortion handled!
param - Intrinsic camera parametersx - X-coordinate of normalized.y - Y-coordinate of normalized.pixel - Optional storage for output. If null a new instance will be declared.public static georegression.struct.point.Point2D_F64 convertNormToPixel(IntrinsicParameters param, georegression.struct.point.Point2D_F64 norm, georegression.struct.point.Point2D_F64 pixel)
Convenient function for converting from normalized image coordinates to the original image pixel coordinate.
If speed is a concern then NormalizedToPixel_F64 should be used instead.
NOTE: Lens distortion handled!
NOTE: norm and pixel can be the same instance.param - Intrinsic camera parametersnorm - Normalized image coordinate.pixel - Optional storage for output. If null a new instance will be declared.public static georegression.struct.point.Point2D_F64 convertNormToPixel(org.ejml.data.DenseMatrix64F K,
georegression.struct.point.Point2D_F64 norm,
georegression.struct.point.Point2D_F64 pixel)
Convenient function for converting from normalized image coordinates to the original image pixel coordinate.
If speed is a concern then NormalizedToPixel_F64 should be used instead.
NOTE: Lens distortion handled!
NOTE: norm and pixel can be the same instance.K - Intrinsic camera calibration matrixnorm - Normalized image coordinate.pixel - Optional storage for output. If null a new instance will be declared.public static georegression.struct.point.Point2D_F64 convertPixelToNorm(IntrinsicParameters param, georegression.struct.point.Point2D_F64 pixel, georegression.struct.point.Point2D_F64 norm)
Convenient function for converting from original image pixel coordinate to normalized< image coordinates.
If speed is a concern then PixelToNormalized_F64 should be used instead.
NOTE: Lens distortion is not removed!
NOTE: norm and pixel can be the same instance.param - Intrinsic camera parameterspixel - Pixel coordinatenorm - Optional storage for output. If null a new instance will be declared.public static georegression.struct.point.Point2D_F64 convertPixelToNorm(org.ejml.data.DenseMatrix64F K,
georegression.struct.point.Point2D_F64 pixel,
georegression.struct.point.Point2D_F64 norm)
Convenient function for converting from original image pixel coordinate to normalized< image coordinates.
If speed is a concern then PixelToNormalized_F64 should be used instead.
K - Intrinsic camera calibration matrixpixel - Pixel coordinate.norm - Optional storage for output. If null a new instance will be declared.public static georegression.struct.point.Point2D_F64 renderPixel(georegression.struct.se.Se3_F64 worldToCamera,
org.ejml.data.DenseMatrix64F K,
georegression.struct.point.Point3D_F64 X)
worldToCamera - Transform from world to camera frameK - Optional. Intrinsic camera calibration matrix. If null then normalized image coordinates are returned.X - 3D Point in world reference frame..public static georegression.struct.point.Point2D_F64 renderPixel(org.ejml.data.DenseMatrix64F worldToCamera,
georegression.struct.point.Point3D_F64 X)
worldToCamera - 3x4 camera matrix for transforming a 3D point from world to image coordinates.X - 3D Point in world reference frame..public static void splitAssociated(java.util.List<AssociatedPair> pairs, java.util.List<georegression.struct.point.Point2D_F64> view1, java.util.List<georegression.struct.point.Point2D_F64> view2)
AssociatedPair as input and breaks it up into two lists for each view.pairs - Input: List of associated pairs.view1 - Output: List of observations from view 1view2 - Output: List of observations from view 2public static void splitAssociated(java.util.List<AssociatedTriple> pairs, java.util.List<georegression.struct.point.Point2D_F64> view1, java.util.List<georegression.struct.point.Point2D_F64> view2, java.util.List<georegression.struct.point.Point2D_F64> view3)
AssociatedTriple as input and breaks it up into three lists for each view.pairs - Input: List of associated triples.view1 - Output: List of observations from view 1view2 - Output: List of observations from view 2view3 - Output: List of observations from view 3public static org.ejml.data.DenseMatrix64F createCameraMatrix(org.ejml.data.DenseMatrix64F R,
georegression.struct.point.Vector3D_F64 T,
org.ejml.data.DenseMatrix64F K,
org.ejml.data.DenseMatrix64F ret)
R - Rotation matrix. 3x3T - Translation vector.K - Optional camera calibration matrix 3x3.ret - Storage for camera calibration matrix. If null a new instance will be created.