00001 /* 00002 * This file is part of the OpenKinect Project. http://www.openkinect.org 00003 * 00004 * Copyright (c) 2011 individual OpenKinect contributors. See the CONTRIB file 00005 * for details. 00006 * 00007 * This code is licensed to you under the terms of the Apache License, version 00008 * 2.0, or, at your option, the terms of the GNU General Public License, 00009 * version 2.0. See the APACHE20 and GPL2 files for the text of the licenses, 00010 * or the following URLs: 00011 * http://www.apache.org/licenses/LICENSE-2.0 00012 * http://www.gnu.org/licenses/gpl-2.0.txt 00013 * 00014 * If you redistribute this file in source form, modified or unmodified, you 00015 * may: 00016 * 1) Leave this header intact and distribute it under the same terms, 00017 * accompanying it with the APACHE20 and GPL20 files, or 00018 * 2) Delete the Apache 2.0 clause and accompany it with the GPL2 file, or 00019 * 3) Delete the GPL v2 clause and accompany it with the APACHE20 file 00020 * In all cases you must keep the copyright notice intact and include a copy 00021 * of the CONTRIB file. 00022 * 00023 * Binary distributions must follow the binary distribution requirements of 00024 * either License. 00025 */ 00026 00027 #ifndef LIBFREENECT_REGISTRATION_H 00028 #define LIBFREENECT_REGISTRATION_H 00029 00030 #include <libfreenect.h> 00031 #include <stdint.h> 00032 00033 #ifdef __cplusplus 00034 extern "C" { 00035 #endif 00036 00040 typedef struct { 00041 int32_t dx_center; // not used by mapping algorithm 00042 00043 int32_t ax; 00044 int32_t bx; 00045 int32_t cx; 00046 int32_t dx; 00047 00048 int32_t dx_start; 00049 00050 int32_t ay; 00051 int32_t by; 00052 int32_t cy; 00053 int32_t dy; 00054 00055 int32_t dy_start; 00056 00057 int32_t dx_beta_start; 00058 int32_t dy_beta_start; 00059 00060 int32_t rollout_blank; // not used by mapping algorithm 00061 int32_t rollout_size; // not used by mapping algorithm 00062 00063 int32_t dx_beta_inc; 00064 int32_t dy_beta_inc; 00065 00066 int32_t dxdx_start; 00067 int32_t dxdy_start; 00068 int32_t dydx_start; 00069 int32_t dydy_start; 00070 00071 int32_t dxdxdx_start; 00072 int32_t dydxdx_start; 00073 int32_t dxdxdy_start; 00074 int32_t dydxdy_start; 00075 00076 int32_t back_comp1; // not used by mapping algorithm 00077 00078 int32_t dydydx_start; 00079 00080 int32_t back_comp2; // not used by mapping algorithm 00081 00082 int32_t dydydy_start; 00083 } freenect_reg_info; 00084 00086 typedef struct { 00087 uint16_t start_lines; 00088 uint16_t end_lines; 00089 uint16_t cropping_lines; 00090 } freenect_reg_pad_info; 00091 00093 typedef struct { 00094 float dcmos_emitter_dist; // Distance between IR camera and IR emitter, in cm. 00095 float dcmos_rcmos_dist; // Distance between IR camera and RGB camera, in cm. 00096 float reference_distance; // The focal length of the IR camera, in mm. 00097 float reference_pixel_size; // The size of a single pixel on the zero plane, in mm. 00098 } freenect_zero_plane_info; 00099 00101 typedef struct { 00102 freenect_reg_info reg_info; 00103 freenect_reg_pad_info reg_pad_info; 00104 freenect_zero_plane_info zero_plane_info; 00105 00106 double const_shift; 00107 00108 uint16_t* raw_to_mm_shift; 00109 int32_t* depth_to_rgb_shift; 00110 int32_t (*registration_table)[2]; // A table of 640*480 pairs of x,y values. 00111 // Index first by pixel, then x:0 and y:1. 00112 } freenect_registration; 00113 00114 00115 // These allow clients to export registration parameters; proper docs will 00116 // come later 00117 FREENECTAPI freenect_registration freenect_copy_registration(freenect_device* dev); 00118 FREENECTAPI int freenect_destroy_registration(freenect_registration* reg); 00119 00120 // convenience function to convert a single x-y coordinate pair from camera 00121 // to world coordinates 00122 FREENECTAPI void freenect_camera_to_world(freenect_device* dev, 00123 int cx, int cy, int wz, double* wx, double* wy); 00124 00125 #ifdef __cplusplus 00126 } 00127 #endif 00128 00129 #endif // LIBFREENECT_REGISTRATION_H