Class PerspectiveOps
- java.lang.Object
-
- boofcv.alg.geo.PerspectiveOps
-
public class PerspectiveOps extends java.lang.ObjectFunctions related to perspective geometry and intrinsic camera calibration.
-
-
Constructor Summary
Constructors Constructor Description PerspectiveOps()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <C extends CameraPinhole>
CadjustIntrinsic(C parameters, org.ejml.data.DMatrixRMaj adjustMatrix, C adjustedParam)Recomputes theCameraPinholeBrowngiven an adjustment matrix.static <C extends CameraPinhole>
CadjustIntrinsic(C parameters, org.ejml.data.FMatrixRMaj adjustMatrix, C adjustedParam)Recomputes theCameraPinholeBrowngiven an adjustment matrix.static CameraPinholeapproximatePinhole(boofcv.struct.distort.Point2Transform2_F64 p2n, int width, int height)Approximates a pinhole camera using the distoriton modelstatic doublecomputeHFov(CameraPinhole intrinsic)static doublecomputeVFov(CameraPinhole intrinsic)static georegression.struct.point.Point2D_F64convertNormToPixel(CameraModel 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_F32convertNormToPixel(CameraModel param, float x, float y, georegression.struct.point.Point2D_F32 pixel)Convenient function for converting from normalized image coordinates to the original image pixel coordinate.static georegression.struct.point.Point2D_F64convertNormToPixel(CameraModel 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_F64convertNormToPixel(CameraPinhole param, double x, double y, georegression.struct.point.Point2D_F64 pixel)static georegression.struct.point.Point2D_F64convertNormToPixel(org.ejml.data.DMatrixRMaj 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_F32convertPixelToNorm(CameraModel param, georegression.struct.point.Point2D_F32 pixel, georegression.struct.point.Point2D_F32 norm)Convenient function for converting from distorted image pixel coordinate to undistorted normalized image coordinates.static georegression.struct.point.Point2D_F64convertPixelToNorm(CameraModel param, georegression.struct.point.Point2D_F64 pixel, georegression.struct.point.Point2D_F64 norm)Convenient function for converting from distorted image pixel coordinate to undistorted normalized image coordinates.static georegression.struct.point.Point2D_F64convertPixelToNorm(CameraPinhole intrinsic, double x, double y, georegression.struct.point.Point2D_F64 norm)static georegression.struct.point.Point2D_F64convertPixelToNorm(org.ejml.data.DMatrixRMaj 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_F32convertPixelToNorm(org.ejml.data.FMatrixRMaj K, georegression.struct.point.Point2D_F32 pixel, georegression.struct.point.Point2D_F32 norm)Convenient function for converting from original image pixel coordinate to normalized< image coordinates.static org.ejml.data.DMatrixRMajconvertToMatrix(georegression.struct.se.Se3_F64 m, org.ejml.data.DMatrixRMaj A)Converts the SE3 into a 3x4 matrix.static org.ejml.data.DMatrixRMajcreateCameraMatrix(org.ejml.data.DMatrixRMaj R, georegression.struct.point.Vector3D_F64 T, org.ejml.data.DMatrixRMaj K, org.ejml.data.DMatrixRMaj ret)Create a 3x4 camera matrix.static CameraPinholeBrowncreateIntrinsic(int width, int height, double hfov)Creates a set of intrinsic parameters, without distortion, for a camera with the specified characteristics.static CameraPinholecreateIntrinsic(int width, int height, double hfov, double vfov)Creates a set of intrinsic parameters, without distortion, for a camera with the specified characteristicsstatic WorldToCameraToPixelcreateWorldToPixel(LensDistortionNarrowFOV distortion, georegression.struct.se.Se3_F64 worldToCamera)Creates a transform from world coordinates into pixel coordinates.static WorldToCameraToPixelcreateWorldToPixel(CameraPinholeBrown intrinsic, georegression.struct.se.Se3_F64 worldToCamera)Creates a transform from world coordinates into pixel coordinates.static CameraPinholeestimatePinhole(boofcv.struct.distort.Point2Transform2_F64 pixelToNorm, int width, int height)Given the transform from pixels to normalized image coordinates, create an approximate pinhole model for this camera.static voidextractColumn(org.ejml.data.DMatrixRMaj P, int col, georegression.struct.GeoTuple3D_F64 a)Extracts a column from the camera matrix and puts it into the geometric 3-tuple.static voidhomogenousTo3dPositiveZ(georegression.struct.point.Point4D_F64 p4, double farAway, double tol, georegression.struct.point.Point3D_F64 p3)Converts a 3D homogenous coordinate into a non-homogenous coordinate.static voidinplaceAdjustCameraMatrix(double sx, double sy, double tx, double ty, org.ejml.data.DMatrixRMaj P)Multiplies A*P, where A = [sx 0 tx; 0 sy ty; 0 0 1]static voidinsertColumn(org.ejml.data.DMatrixRMaj P, int col, georegression.struct.GeoTuple3D_F64 a)Inserts 3-tuple into the camera matrix's columnsstatic doubleinvariantAffine(georegression.struct.point.Point2D_F64 p1, georegression.struct.point.Point2D_F64 p2, georegression.struct.point.Point2D_F64 p3, georegression.struct.point.Point2D_F64 p4)Computes an invariant under affine distortion using 4 coplanar points.static doubleinvariantCrossLine(georegression.struct.point.Point2D_F64 a0, georegression.struct.point.Point2D_F64 a1, georegression.struct.point.Point2D_F64 a2, georegression.struct.point.Point2D_F64 a3)Computes the cross-ratio between 4 points that lie along a line.static doubleinvariantCrossLine(georegression.struct.point.Point3D_F64 a0, georegression.struct.point.Point3D_F64 a1, georegression.struct.point.Point3D_F64 a2, georegression.struct.point.Point3D_F64 a3)Computes the cross-ratio between 4 points that lie along a line.static doubleinvariantCrossRatio(georegression.struct.point.Point2D_F64 p1, georegression.struct.point.Point2D_F64 p2, georegression.struct.point.Point2D_F64 p3, georegression.struct.point.Point2D_F64 p4, georegression.struct.point.Point2D_F64 p5)Computes the cross-ratio (invariant for projective transform) using 5 coplanar points.static voidinvertPinhole(org.ejml.data.DMatrix3x3 K, org.ejml.data.DMatrix3x3 Kinv)Analytic matrix inversion to 3x3 camera calibration matrix.static <C extends CameraPinhole>
CmatrixToPinhole(org.ejml.data.DMatrixRMaj K, int width, int height, C output)Converts a calibration matrix into intrinsic parametersstatic <C extends CameraPinhole>
CmatrixToPinhole(org.ejml.data.FMatrixRMaj K, int width, int height, C output)Converts a calibration matrix into intrinsic parametersstatic voidmultTranA(org.ejml.data.DMatrix3x3 A, org.ejml.data.DMatrix3x3 B, org.ejml.data.DMatrix3x3 C, org.ejml.data.DMatrix3x3 output)Computes: D = AT*B*Cstatic voidmultTranA(org.ejml.data.DMatrixRMaj A, org.ejml.data.DMatrixRMaj B, org.ejml.data.DMatrixRMaj C, org.ejml.data.DMatrixRMaj output)Computes: D = AT*B*Cstatic voidmultTranC(org.ejml.data.DMatrix3x3 A, org.ejml.data.DMatrix3x3 B, org.ejml.data.DMatrix3x3 C, org.ejml.data.DMatrix3x3 output)Computes: D = A*B*CTstatic voidmultTranC(org.ejml.data.DMatrixRMaj A, org.ejml.data.DMatrixRMaj B, org.ejml.data.DMatrixRMaj C, org.ejml.data.DMatrixRMaj output)Computes: D = A*B*CTstatic org.ejml.data.DMatrixRMajpinholeToMatrix(double fx, double fy, double skew, double cx, double cy)Given the intrinsic parameters create a calibration matrixstatic voidpinholeToMatrix(double fx, double fy, double skew, double cx, double cy, org.ejml.data.DMatrix3x3 K)static org.ejml.data.FMatrixRMajpinholeToMatrix(float fx, float fy, float skew, float xc, float yc)Given the intrinsic parameters create a calibration matrixstatic org.ejml.data.DMatrix3x3pinholeToMatrix(CameraPinhole param, org.ejml.data.DMatrix3x3 K)Given the intrinsic parameters create a calibration matrixstatic org.ejml.data.DMatrixRMajpinholeToMatrix(CameraPinhole param, org.ejml.data.DMatrixRMaj K)Given the intrinsic parameters create a calibration matrixstatic org.ejml.data.FMatrixRMajpinholeToMatrix(CameraPinhole param, org.ejml.data.FMatrixRMaj K)Given the intrinsic parameters create a calibration matrixstatic voidprojectionCombine(org.ejml.data.DMatrixRMaj M, georegression.struct.point.Vector3D_F64 T, org.ejml.data.DMatrixRMaj P)P = [M|T]static voidprojectionSplit(org.ejml.data.DMatrixRMaj P, org.ejml.data.DMatrix3x3 M, org.ejml.data.DMatrix3 T)Splits the projection matrix into a 3x3 matrix and 3x1 vector.static voidprojectionSplit(org.ejml.data.DMatrixRMaj P, org.ejml.data.DMatrixRMaj M, georegression.struct.point.Vector3D_F64 T)Splits the projection matrix into a 3x3 matrix and 3x1 vector.static georegression.struct.point.Point2D_F64renderPixel(CameraPinhole intrinsic, georegression.struct.point.Point3D_F64 X, georegression.struct.point.Point2D_F64 pixel)Renders a point in camera coordinates into the image plane in pixels.static georegression.struct.point.Point2D_F64renderPixel(georegression.struct.se.Se3_F64 worldToCamera, CameraPinhole K, georegression.struct.point.Point3D_F64 X, georegression.struct.point.Point2D_F64 pixel)static georegression.struct.point.Point2D_F64renderPixel(georegression.struct.se.Se3_F64 worldToCamera, georegression.struct.point.Point3D_F64 X, georegression.struct.point.Point2D_F64 pixel)static georegression.struct.point.Point2D_F64renderPixel(georegression.struct.se.Se3_F64 worldToCamera, org.ejml.data.DMatrixRMaj K, georegression.struct.point.Point3D_F64 X, georegression.struct.point.Point2D_F64 pixel)Renders a point in world coordinates into the image plane in pixels or normalized image coordinates.static georegression.struct.point.Point2D_F64renderPixel(org.ejml.data.DMatrixRMaj 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_F64renderPixel(org.ejml.data.DMatrixRMaj worldToCamera, georegression.struct.point.Point3D_F64 X, georegression.struct.point.Point2D_F64 pixel)static georegression.struct.point.Point3D_F64renderPixel(org.ejml.data.DMatrixRMaj worldToCamera, georegression.struct.point.Point3D_F64 X, georegression.struct.point.Point3D_F64 pixel)static georegression.struct.point.Point2D_F64renderPixel(org.ejml.data.DMatrixRMaj cameraMatrix, georegression.struct.point.Point4D_F64 X, georegression.struct.point.Point2D_F64 x)Render a pixel in homogeneous coordinates from a 3x4 camera matrix and a 2D point.static georegression.struct.point.Point3D_F64renderPixel(org.ejml.data.DMatrixRMaj cameraMatrix, georegression.struct.point.Point4D_F64 X, georegression.struct.point.Point3D_F64 x)Render a pixel in homogeneous coordinates from a 3x4 camera matrix and a 3D homogeneous point.static voidscaleIntrinsic(CameraPinhole param, double scale)Multiplies each element of the intrinsic parameters by the provided scale factor.static voidsplitAssociated(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 ofAssociatedPairas input and breaks it up into two lists for each view.static voidsplitAssociated(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 ofAssociatedTripleas input and breaks it up into three lists for each view.
-
-
-
Method Detail
-
approximatePinhole
public static CameraPinhole approximatePinhole(boofcv.struct.distort.Point2Transform2_F64 p2n, int width, int height)
Approximates a pinhole camera using the distoriton model- Parameters:
p2n- Distorted pixel to undistorted normalized image coordinates- Returns:
-
createIntrinsic
public static CameraPinhole createIntrinsic(int width, int height, double hfov, double vfov)
Creates a set of intrinsic parameters, without distortion, for a camera with the specified characteristics- Parameters:
width- Image widthheight- Image heighthfov- Horizontal FOV in degreesvfov- Vertical FOV in degrees- Returns:
- guess camera parameters
-
createIntrinsic
public static CameraPinholeBrown createIntrinsic(int width, int height, double hfov)
Creates a set of intrinsic parameters, without distortion, for a camera with the specified characteristics. The focal length is assumed to be the same for x and y.- Parameters:
width- Image widthheight- Image heighthfov- Horizontal FOV in degrees- Returns:
- guess camera parameters
-
scaleIntrinsic
public static void scaleIntrinsic(CameraPinhole param, double scale)
Multiplies each element of the intrinsic parameters by the provided scale factor. Useful if the image has been rescaled.- Parameters:
param- Intrinsic parametersscale- Scale factor that input image is being scaled by.
-
adjustIntrinsic
public static <C extends CameraPinhole> C adjustIntrinsic(C parameters, org.ejml.data.DMatrixRMaj adjustMatrix, C adjustedParam)
Recomputes the
KA = A*KCameraPinholeBrowngiven an adjustment matrix.
Where KA is the returned adjusted intrinsic matrix, A is the adjustment matrix and K is the original intrinsic calibration matrix.NOTE: Distortion parameters are ignored in the provided
CameraPinholeBrownclass.- Parameters:
parameters- (Input) Original intrinsic parameters. Not modified.adjustMatrix- (Input) Adjustment matrix. Not modified.adjustedParam- (Output) Optional storage for adjusted intrinsic parameters. Can be null.- Returns:
- Adjusted intrinsic parameters.
-
adjustIntrinsic
public static <C extends CameraPinhole> C adjustIntrinsic(C parameters, org.ejml.data.FMatrixRMaj adjustMatrix, C adjustedParam)
Recomputes the
KA = A*KCameraPinholeBrowngiven an adjustment matrix.
Where KA is the returned adjusted intrinsic matrix, A is the adjustment matrix and K is the original intrinsic calibration matrix.NOTE: Distortion parameters are ignored in the provided
CameraPinholeBrownclass.- Parameters:
parameters- (Input) Original intrinsic parameters. Not modified.adjustMatrix- (Input) Adjustment matrix. Not modified.adjustedParam- (Output) Optional storage for adjusted intrinsic parameters. Can be null.- Returns:
- Adjusted intrinsic parameters.
-
pinholeToMatrix
public static org.ejml.data.DMatrixRMaj pinholeToMatrix(double fx, double fy, double skew, double cx, double cy)Given the intrinsic parameters create a calibration matrix- Parameters:
fx- Focal length x-axis in pixelsfy- Focal length y-axis in pixelsskew- skew in pixelscx- camera center x-axis in pixelscy- center center y-axis in pixels- Returns:
- Calibration matrix 3x3
-
pinholeToMatrix
public static void pinholeToMatrix(double fx, double fy, double skew, double cx, double cy, org.ejml.data.DMatrix3x3 K)
-
invertPinhole
public static void invertPinhole(org.ejml.data.DMatrix3x3 K, org.ejml.data.DMatrix3x3 Kinv)Analytic matrix inversion to 3x3 camera calibration matrix. Input and output can be the same matrix. Zeros are not set.- Parameters:
K- (Input) Calibration matrixKinv- (Output) inverse.
-
pinholeToMatrix
public static org.ejml.data.FMatrixRMaj pinholeToMatrix(float fx, float fy, float skew, float xc, float yc)Given the intrinsic parameters create a calibration matrix- Parameters:
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 pixels- Returns:
- Calibration matrix 3x3
-
pinholeToMatrix
public static org.ejml.data.DMatrixRMaj pinholeToMatrix(CameraPinhole param, org.ejml.data.DMatrixRMaj K)
Given the intrinsic parameters create a calibration matrix- Parameters:
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 declared- Returns:
- Calibration matrix 3x3
-
pinholeToMatrix
public static org.ejml.data.FMatrixRMaj pinholeToMatrix(CameraPinhole param, org.ejml.data.FMatrixRMaj K)
Given the intrinsic parameters create a calibration matrix- Parameters:
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 declared- Returns:
- Calibration matrix 3x3
-
pinholeToMatrix
public static org.ejml.data.DMatrix3x3 pinholeToMatrix(CameraPinhole param, org.ejml.data.DMatrix3x3 K)
Given the intrinsic parameters create a calibration matrix- Parameters:
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 declared- Returns:
- Calibration matrix 3x3
-
matrixToPinhole
public static <C extends CameraPinhole> C matrixToPinhole(org.ejml.data.DMatrixRMaj K, int width, int height, C output)
Converts a calibration matrix into intrinsic parameters- Parameters:
K- Camera calibration matrix.width- Image width in pixelsheight- Image height in pixelsoutput- (Output) Where the intrinsic parameter are written to. If null then a new instance is declared.- Returns:
- camera parameters
-
matrixToPinhole
public static <C extends CameraPinhole> C matrixToPinhole(org.ejml.data.FMatrixRMaj K, int width, int height, C output)
Converts a calibration matrix into intrinsic parameters- Parameters:
K- Camera calibration matrix.width- Image width in pixelsheight- Image height in pixelsoutput- (Output) Where the intrinsic parameter are written to. If null then a new instance is declared.- Returns:
- camera parameters
-
estimatePinhole
public static CameraPinhole estimatePinhole(boofcv.struct.distort.Point2Transform2_F64 pixelToNorm, int width, int height)
Given the transform from pixels to normalized image coordinates, create an approximate pinhole model for this camera. Assumes (cx,cy) is the image center and that there is no skew.- Parameters:
pixelToNorm- Pixel coordinates into normalized image coordinateswidth- Input image's widthheight- Input image's height- Returns:
- Approximate pinhole camera
-
convertNormToPixel
public static georegression.struct.point.Point2D_F64 convertNormToPixel(CameraModel 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
PinholeNtoP_F64should be used instead.- Parameters:
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.- Returns:
- pixel image coordinate
-
convertNormToPixel
public static georegression.struct.point.Point2D_F64 convertNormToPixel(CameraPinhole param, double x, double y, georegression.struct.point.Point2D_F64 pixel)
-
convertNormToPixel
public static georegression.struct.point.Point2D_F32 convertNormToPixel(CameraModel param, float x, float y, georegression.struct.point.Point2D_F32 pixel)
Convenient function for converting from normalized image coordinates to the original image pixel coordinate. If speed is a concern then
PinholeNtoP_F64should be used instead.- Parameters:
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.- Returns:
- pixel image coordinate
-
convertNormToPixel
public static georegression.struct.point.Point2D_F64 convertNormToPixel(CameraModel 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
NOTE: norm and pixel can be the same instance.PinholeNtoP_F64should be used instead.- Parameters:
param- Intrinsic camera parametersnorm- Normalized image coordinate.pixel- Optional storage for output. If null a new instance will be declared.- Returns:
- pixel image coordinate
-
convertNormToPixel
public static georegression.struct.point.Point2D_F64 convertNormToPixel(org.ejml.data.DMatrixRMaj 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
NOTE: norm and pixel can be the same instance.PinholeNtoP_F64should be used instead.- Parameters:
K- Intrinsic camera calibration matrixnorm- Normalized image coordinate.pixel- Optional storage for output. If null a new instance will be declared.- Returns:
- pixel image coordinate
-
convertPixelToNorm
public static georegression.struct.point.Point2D_F64 convertPixelToNorm(CameraModel param, georegression.struct.point.Point2D_F64 pixel, georegression.struct.point.Point2D_F64 norm)
Convenient function for converting from distorted image pixel coordinate to undistorted normalized image coordinates. If speed is a concern then
NOTE: norm and pixel can be the same instance.PinholePtoN_F64should be used instead.- Parameters:
param- Intrinsic camera parameterspixel- Pixel coordinatenorm- Optional storage for output. If null a new instance will be declared.- Returns:
- normalized image coordinate
-
convertPixelToNorm
public static georegression.struct.point.Point2D_F32 convertPixelToNorm(CameraModel param, georegression.struct.point.Point2D_F32 pixel, georegression.struct.point.Point2D_F32 norm)
Convenient function for converting from distorted image pixel coordinate to undistorted normalized image coordinates. If speed is a concern then
NOTE: norm and pixel can be the same instance.PinholePtoN_F32should be used instead.- Parameters:
param- Intrinsic camera parameterspixel- Pixel coordinatenorm- Optional storage for output. If null a new instance will be declared.- Returns:
- normalized image coordinate
-
convertPixelToNorm
public static georegression.struct.point.Point2D_F64 convertPixelToNorm(org.ejml.data.DMatrixRMaj 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
NOTE: norm and pixel can be the same instance.PinholePtoN_F64should be used instead.- Parameters:
K- Intrinsic camera calibration matrixpixel- Pixel coordinate.norm- Optional storage for output. If null a new instance will be declared.- Returns:
- normalized image coordinate
-
convertPixelToNorm
public static georegression.struct.point.Point2D_F32 convertPixelToNorm(org.ejml.data.FMatrixRMaj K, georegression.struct.point.Point2D_F32 pixel, georegression.struct.point.Point2D_F32 norm)Convenient function for converting from original image pixel coordinate to normalized< image coordinates. If speed is a concern then
NOTE: norm and pixel can be the same instance.PinholePtoN_F64should be used instead.- Parameters:
K- Intrinsic camera calibration matrixpixel- Pixel coordinate.norm- Optional storage for output. If null a new instance will be declared.- Returns:
- normalized image coordinate
-
convertPixelToNorm
public static georegression.struct.point.Point2D_F64 convertPixelToNorm(CameraPinhole intrinsic, double x, double y, georegression.struct.point.Point2D_F64 norm)
-
renderPixel
public static georegression.struct.point.Point2D_F64 renderPixel(georegression.struct.se.Se3_F64 worldToCamera, org.ejml.data.DMatrixRMaj K, georegression.struct.point.Point3D_F64 X, georegression.struct.point.Point2D_F64 pixel)Renders a point in world coordinates into the image plane in pixels or normalized image coordinates.- Parameters:
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..pixel- (Output) storage for the rendered pixel- Returns:
- 2D Render point on image plane or null if it's behind the camera
-
renderPixel
public static georegression.struct.point.Point2D_F64 renderPixel(georegression.struct.se.Se3_F64 worldToCamera, CameraPinhole K, georegression.struct.point.Point3D_F64 X, georegression.struct.point.Point2D_F64 pixel)
-
renderPixel
public static georegression.struct.point.Point2D_F64 renderPixel(georegression.struct.se.Se3_F64 worldToCamera, georegression.struct.point.Point3D_F64 X, georegression.struct.point.Point2D_F64 pixel)
-
renderPixel
public static georegression.struct.point.Point2D_F64 renderPixel(CameraPinhole intrinsic, georegression.struct.point.Point3D_F64 X, georegression.struct.point.Point2D_F64 pixel)
Renders a point in camera coordinates into the image plane in pixels. Does not check to see if the point is behind the camera or not- Parameters:
intrinsic- Intrinsic camera parameters.X- 3D Point in camera reference frame..pixel- (Output) Storage for output pixel. Can be null- Returns:
- 2D Render point on image plane
-
renderPixel
public static georegression.struct.point.Point2D_F64 renderPixel(org.ejml.data.DMatrixRMaj worldToCamera, georegression.struct.point.Point3D_F64 X)Computes the image coordinate of a point given its 3D location and the camera matrix.- Parameters:
worldToCamera- 3x4 camera matrix for transforming a 3D point from world to image coordinates.X- 3D Point in world reference frame..- Returns:
- 2D Render point on image plane.
-
renderPixel
public static georegression.struct.point.Point2D_F64 renderPixel(org.ejml.data.DMatrixRMaj worldToCamera, georegression.struct.point.Point3D_F64 X, @Nullable georegression.struct.point.Point2D_F64 pixel)
-
renderPixel
public static georegression.struct.point.Point3D_F64 renderPixel(org.ejml.data.DMatrixRMaj worldToCamera, georegression.struct.point.Point3D_F64 X, @Nullable georegression.struct.point.Point3D_F64 pixel)
-
renderPixel
public static georegression.struct.point.Point3D_F64 renderPixel(org.ejml.data.DMatrixRMaj cameraMatrix, georegression.struct.point.Point4D_F64 X, @Nullable georegression.struct.point.Point3D_F64 x)Render a pixel in homogeneous coordinates from a 3x4 camera matrix and a 3D homogeneous point.- Parameters:
cameraMatrix- (Input) 3x4 camera matrixX- (Input) 3D point in homogeneous coordinatesx- (Output) Rendered 2D point in homogeneous coordinates- Returns:
- Rendered 2D point in homogeneous coordinates
-
renderPixel
public static georegression.struct.point.Point2D_F64 renderPixel(org.ejml.data.DMatrixRMaj cameraMatrix, georegression.struct.point.Point4D_F64 X, @Nullable georegression.struct.point.Point2D_F64 x)Render a pixel in homogeneous coordinates from a 3x4 camera matrix and a 2D point.- Parameters:
cameraMatrix- (Input) 3x4 camera matrixX- (Input) 3D point in homogeneous coordinatesx- (Output) Rendered 2D point coordinates- Returns:
- Rendered 2D point coordinates
-
splitAssociated
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)
Takes a list ofAssociatedPairas input and breaks it up into two lists for each view.- Parameters:
pairs- Input: List of associated pairs.view1- Output: List of observations from view 1view2- Output: List of observations from view 2
-
splitAssociated
public 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 ofAssociatedTripleas input and breaks it up into three lists for each view.- Parameters:
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 3
-
createCameraMatrix
public static org.ejml.data.DMatrixRMaj createCameraMatrix(org.ejml.data.DMatrixRMaj R, georegression.struct.point.Vector3D_F64 T, @Nullable org.ejml.data.DMatrixRMaj K, @Nullable org.ejml.data.DMatrixRMaj ret)Create a 3x4 camera matrix. For calibrated camera P = [R|T]. For uncalibrated camera it is P = K*[R|T].- Parameters:
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.- Returns:
- Camera calibration matrix.
-
projectionSplit
public static void projectionSplit(org.ejml.data.DMatrixRMaj P, org.ejml.data.DMatrixRMaj M, georegression.struct.point.Vector3D_F64 T)Splits the projection matrix into a 3x3 matrix and 3x1 vector.- Parameters:
P- (Input) 3x4 projection matirxM- (Output) M = P(:,0:2)T- (Output) T = P(:,3)
-
projectionSplit
public static void projectionSplit(org.ejml.data.DMatrixRMaj P, org.ejml.data.DMatrix3x3 M, org.ejml.data.DMatrix3 T)Splits the projection matrix into a 3x3 matrix and 3x1 vector.- Parameters:
P- (Input) 3x4 projection matirxM- (Output) M = P(:,0:2)T- (Output) T = P(:,3)
-
projectionCombine
public static void projectionCombine(org.ejml.data.DMatrixRMaj M, georegression.struct.point.Vector3D_F64 T, org.ejml.data.DMatrixRMaj P)P = [M|T]- Parameters:
M- (Input) 3x3 matrixT- (Input) 3x1 vectorP- (Output) [M,T]
-
createWorldToPixel
public static WorldToCameraToPixel createWorldToPixel(CameraPinholeBrown intrinsic, georegression.struct.se.Se3_F64 worldToCamera)
Creates a transform from world coordinates into pixel coordinates. can handle lens distortion
-
createWorldToPixel
public static WorldToCameraToPixel createWorldToPixel(LensDistortionNarrowFOV distortion, georegression.struct.se.Se3_F64 worldToCamera)
Creates a transform from world coordinates into pixel coordinates. can handle lens distortion
-
computeHFov
public static double computeHFov(CameraPinhole intrinsic)
-
computeVFov
public static double computeVFov(CameraPinhole intrinsic)
-
convertToMatrix
public static org.ejml.data.DMatrixRMaj convertToMatrix(georegression.struct.se.Se3_F64 m, org.ejml.data.DMatrixRMaj A)Converts the SE3 into a 3x4 matrix. [R|T]- Parameters:
m- (Input) transformA- (Output) equivalent 3x4 matrix represenation
-
extractColumn
public static void extractColumn(org.ejml.data.DMatrixRMaj P, int col, georegression.struct.GeoTuple3D_F64 a)Extracts a column from the camera matrix and puts it into the geometric 3-tuple.
-
insertColumn
public static void insertColumn(org.ejml.data.DMatrixRMaj P, int col, georegression.struct.GeoTuple3D_F64 a)Inserts 3-tuple into the camera matrix's columns
-
multTranA
public static void multTranA(org.ejml.data.DMatrixRMaj A, org.ejml.data.DMatrixRMaj B, org.ejml.data.DMatrixRMaj C, org.ejml.data.DMatrixRMaj output)Computes: D = AT*B*C- Parameters:
A- (Input) 3x3 matrixB- (Input) 3x3 matrixC- (Input) 3x3 matrixoutput- (Output) 3x3 matrix. Can be same instance A or B.
-
multTranC
public static void multTranC(org.ejml.data.DMatrixRMaj A, org.ejml.data.DMatrixRMaj B, org.ejml.data.DMatrixRMaj C, org.ejml.data.DMatrixRMaj output)Computes: D = A*B*CT- Parameters:
A- (Input) 3x3 matrixB- (Input) 3x3 matrixC- (Input) 3x3 matrixoutput- (Output) 3x3 matrix. Can be same instance A or B.
-
multTranA
public static void multTranA(org.ejml.data.DMatrix3x3 A, org.ejml.data.DMatrix3x3 B, org.ejml.data.DMatrix3x3 C, org.ejml.data.DMatrix3x3 output)Computes: D = AT*B*C- Parameters:
A- (Input) 3x3 matrixB- (Input) 3x3 matrixC- (Input) 3x3 matrixoutput- (Output) 3x3 matrix. Can be same instance A or B.
-
multTranC
public static void multTranC(org.ejml.data.DMatrix3x3 A, org.ejml.data.DMatrix3x3 B, org.ejml.data.DMatrix3x3 C, org.ejml.data.DMatrix3x3 output)Computes: D = A*B*CT- Parameters:
A- (Input) 3x3 matrixB- (Input) 3x3 matrixC- (Input) 3x3 matrixoutput- (Output) 3x3 matrix. Can be same instance A or B.
-
inplaceAdjustCameraMatrix
public static void inplaceAdjustCameraMatrix(double sx, double sy, double tx, double ty, org.ejml.data.DMatrixRMaj P)Multiplies A*P, where A = [sx 0 tx; 0 sy ty; 0 0 1]
-
invariantCrossLine
public static double invariantCrossLine(georegression.struct.point.Point3D_F64 a0, georegression.struct.point.Point3D_F64 a1, georegression.struct.point.Point3D_F64 a2, georegression.struct.point.Point3D_F64 a3)Computes the cross-ratio between 4 points that lie along a line. This is an invariant under projective geometry.- Parameters:
a0- Unique point on a linea1- Unique point on a linea2- Unique point on a linea3- Unique point on a line- Returns:
- cross ratio
-
invariantCrossLine
public static double invariantCrossLine(georegression.struct.point.Point2D_F64 a0, georegression.struct.point.Point2D_F64 a1, georegression.struct.point.Point2D_F64 a2, georegression.struct.point.Point2D_F64 a3)Computes the cross-ratio between 4 points that lie along a line. This is an invariant under projective geometry.- Parameters:
a0- Unique point on a linea1- Unique point on a linea2- Unique point on a linea3- Unique point on a line- Returns:
- cross ratio
-
invariantCrossRatio
public static double invariantCrossRatio(georegression.struct.point.Point2D_F64 p1, georegression.struct.point.Point2D_F64 p2, georegression.struct.point.Point2D_F64 p3, georegression.struct.point.Point2D_F64 p4, georegression.struct.point.Point2D_F64 p5)Computes the cross-ratio (invariant for projective transform) using 5 coplanar points.
cross ratio = P(1,2,3)*P(1,4,5)/(P(1,2,4)*P(1,3,5))
where P() is the area of a triangle defined by the 3 points.NOTE: Perspective and projective transforms are the same thing
Nakai, Tomohiro, Koichi Kise, and Masakazu Iwamura. "Hashing with local combinations of feature points and its application to camera-based document image retrieval." Proc. CBDAR05 (2005): 87-94.
-
invariantAffine
public static double invariantAffine(georegression.struct.point.Point2D_F64 p1, georegression.struct.point.Point2D_F64 p2, georegression.struct.point.Point2D_F64 p3, georegression.struct.point.Point2D_F64 p4)Computes an invariant under affine distortion using 4 coplanar points.
invariant = P(1,3,4)/P(1,2,3)
where P() is the area of a triangle defined by the 3 points.
-
homogenousTo3dPositiveZ
public static void homogenousTo3dPositiveZ(georegression.struct.point.Point4D_F64 p4, double farAway, double tol, georegression.struct.point.Point3D_F64 p3)Converts a 3D homogenous coordinate into a non-homogenous coordinate. Things get tricky when a point is at or "close to" infinity. This situation is handled by throwing it at some distant location. This is a reasonable approach when you can't just skip the point. It's assumed that points at infinity have a positive Z value.- Parameters:
p4- (Input) Homogenous coordinate.farAway- (Input) How far away points at infinity should be put. Application dependent. Try 1e9tol- (Input) Tolerance for defining a point at infinity. If p4 has a norm of 1 then 1e-7 is probably reasonable.p3- (output) Cartesian coordinate.
-
-