Files
kunlun/export/inc/cnn/depth_to_xyz.h
2024-09-28 14:24:04 +08:00

73 lines
2.7 KiB
C
Executable File

/****************************************************************************
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
be copied by any method or incorporated into another program without
the express written consent of Aerospace C.Power. This Information or any portion
thereof remains the property of Aerospace C.Power. The Information contained herein
is believed to be accurate and Aerospace C.Power assumes no responsibility or
liability for its use in any way and conveys no license or title under
any patent or copyright and makes no representation or warranty that this
Information is free from patent or copyright infringement.
****************************************************************************/
#ifndef DEPTH_TO_XYZ_H
#define DEPTH_TO_XYZ_H
/* os shim includes */
#include "os_types_api.h"
#ifdef __cplusplus
extern "C" {
#endif
/** \defgroup depth_to_xyz API
* @brief depth_to_xyz APIs
* These functions could be used for calculate X, Y, Z from depth map
*
*/
/** @addtogroup depth_to_xyz_APIs
* @{
*/
/* @brief depth_to_xyz() - to calculate X, Y, Z from depth map, output will be arranged to X values, Y values and Z values
* given depth input D of size[height, width_], the outputs are:
* Z[w, h] = -D[w, h] - z_mean
* X[w, h] = ((w - cx) * D[w, h] / fx - x_mean) * 1(Z[w, h] > d_min) * 1(Z[w, h] < d_max)
* Y[w, h] = ((cy - h) * D[w, h] / fy - y_mean) * 1(Z[w, h] > d_min) * 1(Z[w, h] < d_max)
* @param depth: pointer to depth map
* @param out: pointer to output
* @param height: height of depth map
* @param width_: width of depth map
* @param inv_fx: 1 / fx, where fx is a constant
* @param inv_fy: 1 / fy, where fy is a constant
* @param x_mean: constant
* @param y_mean: constant
* @param z_mean: constant
* @param cx: constant
* @param cy: constant
* @param d_max: constant
* @param d_min: constant
* @return -1 -- depth address is not a multiple of 32
* @return -2 -- out address is not a multiple of 32
* @return -3 -- depth's height is 0
* @return -4 -- depth's width is 0
* @return -5 -- depth's width is not a multiple of 8
* @return non-negative number -- the number of output points whose Z value is between d_min and d_max
*/
int32_t depth_to_xyz(float *depth, float *out, uint32_t height, uint32_t width_,
float inv_fx, float inv_fy, float x_mean, float y_mean, float z_mean,
float cx, float cy, float d_max, float d_min);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif