# 3D transformation

## Modules

- [Essential Matrix](https://docs.qualcomm.com/doc/80-63309-1/topic/essential_matrix.html)
- [Recover Pose](https://docs.qualcomm.com/doc/80-63309-1/topic/recover_pose.html)
- [PnP](https://docs.qualcomm.com/doc/80-63309-1/topic/pnp.html)
- [Project Points](https://docs.qualcomm.com/doc/80-63309-1/topic/project_points.html)

- enum FadasRodriguesType\_e

    - Type of Rodrigues transform.

3D transformations (*e.g*., RT matrices) and associated data transformations (*e.g*., Rodrigues vectors).

*Values:*

- enumerator FADAS\_RODRIGUES\_VECTOR\_TO\_MATRIX

    - Transform vector to matrix.

- enumerator FADAS\_RODRIGUES\_MATRIX\_TO\_VECTOR

    - Transform matrix to vector.

- enumerator FADAS\_RODRIGUES\_MAX

    - Do not use.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) Fadas3D\_Init(const char \*licenseKey)

    - Initialize the 3D transform module. **WARNING:** Must be called once before other FastADAS functions except [FadasVersion()](https://docs.qualcomm.com/doc/80-63309-1/topic/misc.html#group__misc_1ga55cbdff48d751f2a0227ae4ac106d746).

- Parameters:

    - **licenseKey** – License key string.

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) — Success.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) Fadas3D\_DeInit(void)

    - Deinitialize 3D transform module. **WARNING:** Must be called once after all other FastADAS functions.

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) — Success.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) Fadas3D\_MultiplyPtsWth4x4RT(const [float32\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/typedef_fadas_8h_1a4611b605e45ab401f02cab15c5e38715.html#_CPPv49float32_t) \*\_\_restrict RT, uint32\_t RTStride, uint32\_t nPts, const [float32\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/typedef_fadas_8h_1a4611b605e45ab401f02cab15c5e38715.html#_CPPv49float32_t) \*\_\_restrict src, uint32\_t srcStride, [float32\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/typedef_fadas_8h_1a4611b605e45ab401f02cab15c5e38715.html#_CPPv49float32_t) \*\_\_restrict dst, uint32\_t dstStride)

    - Multiplies a 4 x 4 RT matrix with a number of points and outputs the result into separate memory.

- Parameters:

    - - **RT** – Pointer to 4 x 4 RT matrix. It is explicitly assumed that the matrix is composed of a rotation and translation matrix and the bottom row is [0, 0, 0, 1].
- **RTStride** – RT matrix stride (in bytes). Gap between the first element of a row and that of the successive row. If the value is equal to 0, a value is calculated assuming contiguous memory.
- **nPts** – Number of points to follow in both input and output.
- **src** – Input points represented by an array of 1x4 floating-point vectors. **WARNING:** Must be 128-byte aligned.
- **srcStride** – Input points stride. The gap (in terms of bytes) between the first element of a 1 x 4 vector and the first element of the successive 1 x 4 vector. If the value is equal to 0, a value is calculated assuming contiguous memory. **WARNING:** Must be a multiple of 8.
- **dst** – Output image with the same type and size as the input image. The size of buffer is dstStride\*n\_pts bytes. **WARNING:** Must be 128-byte aligned.
- **dstStride** – Output points stride. The gap (in terms of bytes) between the first element of a 1 x 4 vector and the first element of the successive 1 x 4 vector. If the value is equal to 0, a value is calculated assuming contiguous memory. **WARNING:** Must be a multiple of 8.

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) — Success.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) Fadas3D\_Rodrigues(const [float32\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/typedef_fadas_8h_1a4611b605e45ab401f02cab15c5e38715.html#_CPPv49float32_t) \*\_\_restrict src, [FadasRodriguesType\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_group__three__d_1gade9c210e1339be74cc245cdf054a9b10.html#_CPPv420FadasRodriguesType_e) convType, [float32\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/typedef_fadas_8h_1a4611b605e45ab401f02cab15c5e38715.html#_CPPv49float32_t) \*\_\_restrict dst, [float32\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/typedef_fadas_8h_1a4611b605e45ab401f02cab15c5e38715.html#_CPPv49float32_t) \*\_\_restrict jcb)

    - Converts a rotation matrix to a rotation vector or vice versa.

- Parameters:

    - - **src** – Pointer containing either the 1 x 3 rotation vector or 3 x 3 rotation matrix in a flattened fashion.
- **convType** – Might hold values [FADAS\_RODRIGUES\_VECTOR\_TO\_MATRIX](https://docs.qualcomm.com/doc/80-63309-1/topic/3d-transformation.html#group__three__d_1ggade9c210e1339be74cc245cdf054a9b10a46a8663753f1a26406119a9014bfb8cd) or [FADAS\_RODRIGUES\_MATRIX\_TO\_VECTOR](https://docs.qualcomm.com/doc/80-63309-1/topic/3d-transformation.html#group__three__d_1ggade9c210e1339be74cc245cdf054a9b10ad4653dbc8ac5da55c839f3f6c3101c3c)
- **dst** – Pointer to either the 1 x 3 rotation vector or 3 x 3 rotation matrix in a flattened fashion.
- **jcb** – Pointer to the output Jacobian matrix, 3 x 9 or 9 x 3, which is a matrix of partial derivatives of the output array components with respect to the input array components.

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) — Success.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) Fadas3D\_Init\_Calib(const char \*licenseKey)

    - Initialize 3D calib module. **WARNING:** Must be called once before other FastADAS functions except [FadasVersion()](https://docs.qualcomm.com/doc/80-63309-1/topic/misc.html#group__misc_1ga55cbdff48d751f2a0227ae4ac106d746).

- Parameters:

    - **licenseKey** – License key string.

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) — Success.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) Fadas3D\_DeInit\_Calib(void)

    - Deinitialize 3D calib module. **WARNING:** Must be called once after all other FastADAS functions.

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) — Success.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) Fadas3D\_UndistortPoints([FadasMatrix\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_matrix__t.html#_CPPv413FadasMatrix_t) src, [FadasMatrix\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_matrix__t.html#_CPPv413FadasMatrix_t) dst, [FadasCameraProps\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_camera_props__t.html#_CPPv418FadasCameraProps_t) camProps, [FadasDistCoeffs\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_dist_coeffs__t.html#_CPPv417FadasDistCoeffs_t) distCoeffs, [FadasMatrix\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_matrix__t.html#_CPPv413FadasMatrix_t) \*R = nullptr, [FadasCameraProps\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_camera_props__t.html#_CPPv418FadasCameraProps_t) \*newCamProps = nullptr)

    - Undistorts a point cloud.

- Parameters:

    - - **src** – Matrix object containing points before undistortion. Dimensions of the matrix must be 1 x 2N (N = number of points).
- **dst** – Matrix object to store points after undistortion. Dimensions of the matrix must be 1 x 2N.
- **camProps** – Camera calibration parameters.
- **distCoeffs** – Camera distortion coefficients.
- **R** – Rectification transformation in the object space (optional). Dimensions of the matrix must be 3 x 3.
- **newCamProps** – New camera properties (optional).

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) — Success.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) Fadas3D\_TriangulatePoints([FadasMatrix\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_matrix__t.html#_CPPv413FadasMatrix_t) projMat1, [FadasMatrix\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_matrix__t.html#_CPPv413FadasMatrix_t) projMat2, [FadasMatrix\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_matrix__t.html#_CPPv413FadasMatrix_t) ptsCam1, [FadasMatrix\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_matrix__t.html#_CPPv413FadasMatrix_t) ptsCam2, [FadasMatrix\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_matrix__t.html#_CPPv413FadasMatrix_t) ptsOut)

    - Triangulate 2D points.

- Parameters:

    - - **projMat1** – Projection matrix for the first image. Dimensions of the matrix must be 3 x 4.
- **projMat2** – Projection matrix for the second image. Dimensions of the matrix must be 3 x 4.
- **ptsCam1** – Matrix object containing 2D points from the first image. Dimensions of the matrix must be 1 x 2N (N = number of points).
- **ptsCam2** – Matrix object containing 2D points from the second image. Dimensions of the matrix must be 1 x 2N.
- **pts3D** – Matrix object to store output 3D points. Dimensions of the matrix must be 1 x 4N.

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) — Success.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) Fadas3D\_UndistortPointsf64([FadasMatrixf64\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_matrixf64__t.html#_CPPv416FadasMatrixf64_t) src, [FadasMatrixf64\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_matrixf64__t.html#_CPPv416FadasMatrixf64_t) dst, [FadasCameraProps\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_camera_props__t.html#_CPPv418FadasCameraProps_t) camProps, [FadasDistCoeffs\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_dist_coeffs__t.html#_CPPv417FadasDistCoeffs_t) distCoeffs, [FadasMatrixf64\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_matrixf64__t.html#_CPPv416FadasMatrixf64_t) \*R = nullptr, [FadasCameraProps\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_camera_props__t.html#_CPPv418FadasCameraProps_t) \*newCamProps = nullptr)

    - Same as [Fadas3D\_UndistortPoints](https://docs.qualcomm.com/doc/80-63309-1/topic/3d-transformation.html#group__three__d_1gae99cce9dfdc295cb5fc5e8c1e94d7279) for 64-bit floating point data.

- Parameters:

    - - **src** – Matrix object containing points before undistortion. Dimensions of the matrix must be 1 x 2N (N = number of points).
- **dst** – Matrix object to store points after undistortion. Dimensions of the matrix must be 1 x 2N.
- **camProps** – Camera calibration parameters.
- **distCoeffs** – Camera distortion coefficients.
- **R** – Rectification transformation in the object space (optional). Dimensions of the matrix must be 3 x 3.
- **newCamProps** – New camera properties (optional).

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) — Success.

- [FadasError\_e](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#_CPPv412FadasError_e) Fadas3D\_TriangulatePointsf64([FadasMatrixf64\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_matrixf64__t.html#_CPPv416FadasMatrixf64_t) projMat1, [FadasMatrixf64\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_matrixf64__t.html#_CPPv416FadasMatrixf64_t) projMat2, [FadasMatrixf64\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_matrixf64__t.html#_CPPv416FadasMatrixf64_t) ptsCam1, [FadasMatrixf64\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_matrixf64__t.html#_CPPv416FadasMatrixf64_t) ptsCam2, [FadasMatrixf64\_t](https://docs.qualcomm.com/doc/80-63309-1/topic/struct_fadas_matrixf64__t.html#_CPPv416FadasMatrixf64_t) ptsOut)

    - Same as [Fadas3D\_TriangulatePoints](https://docs.qualcomm.com/doc/80-63309-1/topic/3d-transformation.html#group__three__d_1gae1f8a237e13e2e751b370f1174686b21) for 64-bit floating point data.

- Parameters:

    - - **projMat1** – Projection matrix for the first image. Dimensions of the matrix must be 3 x 4.
- **projMat2** – Projection matrix for the second image. Dimensions of the matrix must be 3 x 4.
- **ptsCam1** – Matrix object containing 2D points from the first image. Dimensions of the matrix must be 1 x 2N (N = number of points).
- **ptsCam2** – Matrix object containing 2D points from the second image. Dimensions of the matrix must be 1 x 2N.
- **pts3D** – Matrix object to store output 3D points. Dimensions of the matrix must be 1 x 4N.

- Returns:

    - [FADAS\_ERROR\_NONE](https://docs.qualcomm.com/doc/80-63309-1/topic/enum_fadas_8h_1a280abf443019bfc722ac1158e5fe1013.html#fadas_8h_1a280abf443019bfc722ac1158e5fe1013aea09a4171f0866f38326d7e5323f2d12) — Success.

## Related examples

[one/one.cpp](https://docs.qualcomm.com/doc/80-63309-1/topic/one.html)

Last Published: Sep 30, 2024

[Previous Topic
Miscellaneous](https://docs.qualcomm.com/bundle/publicresource/80-63309-1/topics/misc.md) [Next Topic
Essential Matrix](https://docs.qualcomm.com/bundle/publicresource/80-63309-1/topics/essential_matrix.md)