# TYCamport3: TYCoordinateMapper.h File Reference

TYCoordinateMapper.h File Reference

Coordinate Conversion API. More...

`#include <stdlib.h>`
`#include "TYApi.h"`
Include dependency graph for TYCoordinateMapper.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Classes

struct | TY_PIXEL_DESC
struct | TY_PIXEL_COLOR_DESC

## Macros

#define | TYMAP_CHECKRET(f, bufToFree)

## Typedefs

typedef struct TY_PIXEL_DESC | TY_PIXEL_DESC
typedef struct TY_PIXEL_COLOR_DESC | TY_PIXEL_COLOR_DESC

## Functions

TY_CAPI | TYInvertExtrinsic (const TY_CAMERA_EXTRINSIC *orgExtrinsic, TY_CAMERA_EXTRINSIC *invExtrinsic)
| Calculate 4x4 extrinsic matrix's inverse matrix. More...
TY_CAPI | TYMapDepthToPoint3d (const TY_CAMERA_CALIB_INFO *src_calib, uint32_t depthW, uint32_t depthH, const TY_PIXEL_DESC *depthPixels, uint32_t count, TY_VECT_3F *point3d, float f_scale_unit=1.0f)
| Map pixels on depth image to 3D points. More...
TY_CAPI | TYMapPoint3dToDepth (const TY_CAMERA_CALIB_INFO *dst_calib, const TY_VECT_3F *point3d, uint32_t count, uint32_t depthW, uint32_t depthH, TY_PIXEL_DESC *depth, float f_scale_unit=1.0f)
| Map 3D points to pixels on depth image. Reverse operation of TYMapDepthToPoint3d. More...
TY_CAPI | TYMapDepthImageToPoint3d (const TY_CAMERA_CALIB_INFO *src_calib, int32_t imageW, int32_t imageH, const uint16_t *depth, TY_VECT_3F *point3d, float f_scale_unit=1.0f)
| Map depth image to 3D points. 0 depth pixels maps to (NAN, NAN, NAN). More...
TY_CAPI | TYMapPoint3dToDepthImage (const TY_CAMERA_CALIB_INFO *dst_calib, const TY_VECT_3F *point3d, uint32_t count, uint32_t depthW, uint32_t depthH, uint16_t *depth, float f_target_scale=1.0f)
| Map 3D points to depth image. (NAN, NAN, NAN) will be skipped. More...
TY_CAPI | TYMapPoint3dToPoint3d (const TY_CAMERA_EXTRINSIC *extrinsic, const TY_VECT_3F *point3dFrom, int32_t count, TY_VECT_3F *point3dTo)
| Map 3D points to another coordinate. More...

## Detailed Description

Coordinate Conversion API.

Note
  Considering performance, we leave the responsibility of parameters check to users.

Copyright
  Copyright(C)2016-2018 Percipio All Rights Reserved

Definition in file TYCoordinateMapper.h.

## Macro Definition Documentation

## TYMAP_CHECKRET

#define TYMAP_CHECKRET | ( |  | f,
|  |  | bufToFree
| ) |  |

Value:
do{ \
TY_STATUS err = (f); \
if(err){ \
if(bufToFree) \
free(bufToFree); \
return err; \
} \
} while(0)

Definition at line 268 of file TYCoordinateMapper.h.

## Function Documentation

## TYInvertExtrinsic()

TY_CAPI TYInvertExtrinsic | ( | const TY_CAMERA_EXTRINSIC * | orgExtrinsic,
|  | TY_CAMERA_EXTRINSIC * | invExtrinsic
| ) |  |

Calculate 4x4 extrinsic matrix's inverse matrix.

Parameters

  [in] | orgExtrinsic | Input extrinsic matrix.
  [out] | invExtrinsic | Inverse matrix.

Return values

  TY_STATUS_OK | Succeed.
  TY_STATUS_ERROR | Calculation failed.

## TYMapDepthImageToPoint3d()

TY_CAPI TYMapDepthImageToPoint3d | ( | const TY_CAMERA_CALIB_INFO * | src_calib,
|  | int32_t | imageW,
|  | int32_t | imageH,
|  | const uint16_t * | depth,
|  | TY_VECT_3F * | point3d,
|  | float | f_scale_unit = `1.0f`
| ) |  |

Map depth image to 3D points. 0 depth pixels maps to (NAN, NAN, NAN).

Parameters

  [in] | src_calib | Depth image's calibration data.
  [in] | depthW | Width of depth image.
  [in] | depthH | Height of depth image.
  [in] | depth | Depth image.
  [out] | point3d | Output point3D image.

Return values

  TY_STATUS_OK | Succeed.

## TYMapDepthToPoint3d()

TY_CAPI TYMapDepthToPoint3d | ( | const TY_CAMERA_CALIB_INFO * | src_calib,
|  | uint32_t | depthW,
|  | uint32_t | depthH,
|  | const TY_PIXEL_DESC * | depthPixels,
|  | uint32_t | count,
|  | TY_VECT_3F * | point3d,
|  | float | f_scale_unit = `1.0f`
| ) |  |

Map pixels on depth image to 3D points.

Parameters

  [in] | src_calib | Depth image's calibration data.
  [in] | depthW | Width of depth image.
  [in] | depthH | Height of depth image.
  [in] | depthPixels | Pixels on depth image.
  [in] | count | Number of depth pixels.
  [out] | point3d | Output point3D.

Return values

  TY_STATUS_OK | Succeed.

## TYMapPoint3dToDepth()

TY_CAPI TYMapPoint3dToDepth | ( | const TY_CAMERA_CALIB_INFO * | dst_calib,
|  | const TY_VECT_3F * | point3d,
|  | uint32_t | count,
|  | uint32_t | depthW,
|  | uint32_t | depthH,
|  | TY_PIXEL_DESC * | depth,
|  | float | f_scale_unit = `1.0f`
| ) |  |

Map 3D points to pixels on depth image. Reverse operation of TYMapDepthToPoint3d.

Parameters

  [in] | dst_calib | Target depth image's calibration data.
  [in] | point3d | Input 3D points.
  [in] | count | Number of points.
  [in] | depthW | Width of target depth image.
  [in] | depthH | Height of target depth image.
  [out] | depth | Output depth pixels.

Return values

  TY_STATUS_OK | Succeed.

## TYMapPoint3dToDepthImage()

TY_CAPI TYMapPoint3dToDepthImage | ( | const TY_CAMERA_CALIB_INFO * | dst_calib,
|  | const TY_VECT_3F * | point3d,
|  | uint32_t | count,
|  | uint32_t | depthW,
|  | uint32_t | depthH,
|  | uint16_t * | depth,
|  | float | f_target_scale = `1.0f`
| ) |  |

Map 3D points to depth image. (NAN, NAN, NAN) will be skipped.

Parameters

  [in] | dst_calib | Target depth image's calibration data.
  [in] | point3d | Input 3D points.
  [in] | count | Number of points.
  [in] | depthW | Width of target depth image.
  [in] | depthH | Height of target depth image.
  [in,out] | depth | Depth image buffer.

Return values

  TY_STATUS_OK | Succeed.

## TYMapPoint3dToPoint3d()

TY_CAPI TYMapPoint3dToPoint3d | ( | const TY_CAMERA_EXTRINSIC * | extrinsic,
|  | const TY_VECT_3F * | point3dFrom,
|  | int32_t | count,
|  | TY_VECT_3F * | point3dTo
| ) |  |

Map 3D points to another coordinate.

Parameters

  [in] | extrinsic | Extrinsic matrix.
  [in] | point3dFrom | Source 3D points.
  [in] | count | Number of source 3D points.
  [out] | point3dTo | Target 3D points.

Return values

  TY_STATUS_OK | Succeed.