Package boofcv.alg.geo
Class DecomposeProjectiveToMetric
java.lang.Object
boofcv.alg.geo.DecomposeProjectiveToMetric
public class DecomposeProjectiveToMetric extends Object
Decomposes metric camera matrices as well as projective with known intrinsic parameters.
-
Field Summary
Fields Modifier and Type Field Description protected DMatrixRMaj
A
protected DMatrixRMaj
A_p
protected DMatrixRMaj
K_inv
protected DMatrixRMaj
P_metric
protected DMatrixRMaj
P_rt
protected DMatrixRMaj
Pv
protected QRDecomposition<DMatrixRMaj>
qr
double
singularError
Indicates how far the singular values deviated from their expected value.protected SingularValueDecomposition_F64<DMatrixRMaj>
svd
-
Constructor Summary
Constructors Constructor Description DecomposeProjectiveToMetric()
-
Method Summary
Modifier and Type Method Description boolean
decomposeMetricCamera(DMatrixRMaj cameraMatrix, DMatrixRMaj K, Se3_F64 worldToView)
Decomposes a metric camera matrix P=K*[R|T], where A is an upper triangular camera calibration matrix, R is a rotation matrix, and T is a translation vector.boolean
projectiveToMetric(DMatrixRMaj cameraMatrix, DMatrixRMaj H, Se3_F64 worldToView, DMatrixRMaj K)
Elevates a projective camera matrix into a metric one using the rectifying homography.boolean
projectiveToMetricKnownK(DMatrixRMaj cameraMatrix, DMatrixRMaj H, DMatrixRMaj K, Se3_F64 worldToView)
Convert the projective camera matrix into a metric transform given the rectifying homography and a known calibration matrix.
-
Field Details
-
qr
-
Pv
-
A_p
-
A
-
svd
-
P_metric
-
P_rt
-
K_inv
-
singularError
public double singularErrorIndicates how far the singular values deviated from their expected value. zero means perfect match
-
-
Constructor Details
-
DecomposeProjectiveToMetric
public DecomposeProjectiveToMetric()
-
-
Method Details
-
projectiveToMetricKnownK
public boolean projectiveToMetricKnownK(DMatrixRMaj cameraMatrix, DMatrixRMaj H, DMatrixRMaj K, Se3_F64 worldToView)Convert the projective camera matrix into a metric transform given the rectifying homography and a known calibration matrix. This simplifies the math compared to
projectiveToMetric(org.ejml.data.DMatrixRMaj, org.ejml.data.DMatrixRMaj, georegression.struct.se.Se3_F64, org.ejml.data.DMatrixRMaj)
where it needs to extract `K`.P = K*[R|T]*H
where H is the inverse of the rectifying homography. A goodness of fit error can be accessed usingsingularError
.- Parameters:
cameraMatrix
- (Input) camera matrix. 3x4H
- (Input) Rectifying homography. 4x4K
- (Input) Known calibration matrixworldToView
- (Output) transform from world to camera view- Returns:
- true if the decomposition was successful
-
projectiveToMetric
public boolean projectiveToMetric(DMatrixRMaj cameraMatrix, DMatrixRMaj H, Se3_F64 worldToView, DMatrixRMaj K)Elevates a projective camera matrix into a metric one using the rectifying homography. Extracts calibration and Se3 pose.P'=P*H K,R,t = decompose(P')
where P is the camera matrix, H is the homography, (K,R,t) are the intrinsic calibration matrix, rotation, and translation- Parameters:
cameraMatrix
- (Input) camera matrix. 3x4H
- (Input) Rectifying homography. 4x4worldToView
- (Output) Transform from world to camera viewK
- (Output) Camera calibration matrix- See Also:
MultiViewOps.absoluteQuadraticToH(org.ejml.data.DMatrix4x4, org.ejml.data.DMatrixRMaj)
,decomposeMetricCamera(DMatrixRMaj, DMatrixRMaj, Se3_F64)
-
decomposeMetricCamera
Decomposes a metric camera matrix P=K*[R|T], where A is an upper triangular camera calibration matrix, R is a rotation matrix, and T is a translation vector. If
PerspectiveOps.createCameraMatrix(org.ejml.data.DMatrixRMaj, georegression.struct.point.Vector3D_F64, org.ejml.data.DMatrixRMaj, org.ejml.data.DMatrixRMaj)
is called using the returned value you will get an equivalent camera matrix.- NOTE: There are multiple valid solutions to this problem and only one solution is returned.
- NOTE: The camera center will be on the plane at infinity.
- Parameters:
cameraMatrix
- Input: Camera matrix, 3 by 4K
- Output: Camera calibration matrix, 3 by 3.worldToView
- Output: The rotation and translation.- Returns:
- true if decompose was successful
-