ComfyUI Node
CV Decompose Projection Matrix (RQ)
Splits a camera/projection matrix with cv2.RQDecomp3x3. This is the compact RQ decomposition used to recover a K-like upper-triangular matrix and an orthogonal rotation from M = R @ Q, while also exposing the per-axis rotation matrices OpenCV computes. A full 3x4 projection matrix P = K[R|t] is accepted directly: its left 3x3 block (K @ R) is what gets decomposed, so R is the intrinsics and Q the camera rotation. The translation is NOT recovered - use 'Solve PnP' / 'Pose To Matrix' for that.
CV Decompose Projection Matrix (RQ)
- matrix
- matrix
- Q
- R
- Qx
- Qy
- Qz
Categoryimage/CV/features
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| matrix | NPARRAY | Matrix to decompose: either a 3x3 matrix, or a full 3x4 camera projection matrix P = K[R|t] (only its left 3x3 block is decomposed; the translation column is ignored). |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| matrix | NPARRAY | The 3x3 block that was actually decomposed, as float64 (the input itself for a 3x3 matrix, its left 3x3 block for a 3x4 one). R @ Q reconstructs exactly this - handy for matrix comparisons and inspectors. |
| Q | NPARRAY | 3x3 orthogonal matrix from the RQ decomposition. |
| R | NPARRAY | 3x3 upper-triangular matrix from the RQ decomposition (K-like for camera matrices). |
| Qx | NPARRAY | OpenCV's x-axis rotation matrix component. NOTE the composition order: OpenCV reduces M by RIGHT-multiplying these, so Qx @ Qy @ Qz is Q TRANSPOSED - the identity that holds is Q = Qz.T @ Qy.T @ Qx.T (exactly, and M = R @ Qz.T @ Qy.T @ Qx.T). |
| Qy | NPARRAY | OpenCV's y-axis rotation matrix component. Composes as Q = Qz.T @ Qy.T @ Qx.T, not Qx @ Qy @ Qz (see Qx). |
| Qz | NPARRAY | OpenCV's z-axis rotation matrix component. Composes as Q = Qz.T @ Qy.T @ Qx.T, not Qx @ Qy @ Qz (see Qx). |