libfreenect  0.1.2
libfreenect_registration.h
Go to the documentation of this file.
1 /*
2  * This file is part of the OpenKinect Project. http://www.openkinect.org
3  *
4  * Copyright (c) 2011 individual OpenKinect contributors. See the CONTRIB file
5  * for details.
6  *
7  * This code is licensed to you under the terms of the Apache License, version
8  * 2.0, or, at your option, the terms of the GNU General Public License,
9  * version 2.0. See the APACHE20 and GPL2 files for the text of the licenses,
10  * or the following URLs:
11  * http://www.apache.org/licenses/LICENSE-2.0
12  * http://www.gnu.org/licenses/gpl-2.0.txt
13  *
14  * If you redistribute this file in source form, modified or unmodified, you
15  * may:
16  * 1) Leave this header intact and distribute it under the same terms,
17  * accompanying it with the APACHE20 and GPL20 files, or
18  * 2) Delete the Apache 2.0 clause and accompany it with the GPL2 file, or
19  * 3) Delete the GPL v2 clause and accompany it with the APACHE20 file
20  * In all cases you must keep the copyright notice intact and include a copy
21  * of the CONTRIB file.
22  *
23  * Binary distributions must follow the binary distribution requirements of
24  * either License.
25  */
26 #pragma once
27 
28 #include "libfreenect.h"
29 #include <stdint.h>
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
38 typedef struct {
39  int32_t dx_center; // not used by mapping algorithm
40 
41  int32_t ax;
42  int32_t bx;
43  int32_t cx;
44  int32_t dx;
45 
46  int32_t dx_start;
47 
48  int32_t ay;
49  int32_t by;
50  int32_t cy;
51  int32_t dy;
52 
53  int32_t dy_start;
54 
55  int32_t dx_beta_start;
56  int32_t dy_beta_start;
57 
58  int32_t rollout_blank; // not used by mapping algorithm
59  int32_t rollout_size; // not used by mapping algorithm
60 
61  int32_t dx_beta_inc;
62  int32_t dy_beta_inc;
63 
64  int32_t dxdx_start;
65  int32_t dxdy_start;
66  int32_t dydx_start;
67  int32_t dydy_start;
68 
69  int32_t dxdxdx_start;
70  int32_t dydxdx_start;
71  int32_t dxdxdy_start;
72  int32_t dydxdy_start;
73 
74  int32_t back_comp1; // not used by mapping algorithm
75 
76  int32_t dydydx_start;
77 
78  int32_t back_comp2; // not used by mapping algorithm
79 
80  int32_t dydydy_start;
82 
84 typedef struct {
85  uint16_t start_lines;
86  uint16_t end_lines;
87  uint16_t cropping_lines;
89 
91 typedef struct {
92  float dcmos_emitter_dist; // Distance between IR camera and IR emitter, in cm.
93  float dcmos_rcmos_dist; // Distance between IR camera and RGB camera, in cm.
94  float reference_distance; // The focal length of the IR camera, in mm.
95  float reference_pixel_size; // The size of a single pixel on the zero plane, in mm.
97 
99 typedef struct {
103 
104  double const_shift;
105 
106  uint16_t* raw_to_mm_shift;
108  int32_t (*registration_table)[2]; // A table of 640*480 pairs of x,y values.
109  // Index first by pixel, then x:0 and y:1.
111 
112 
113 // These allow clients to export registration parameters; proper docs will
114 // come later
117 
118 // convenience function to convert a single x-y coordinate pair from camera
119 // to world coordinates
121  int cx, int cy, int wz, double* wx, double* wy);
122 
123 // helper function to map one FREENECT_VIDEO_RGB image to a FREENECT_DEPTH_MM
124 // image (inverse mapping to FREENECT_DEPTH_REGISTERED, which is depth -> RGB)
126  uint16_t* depth_mm, uint8_t* rgb_raw, uint8_t* rgb_registered );
127 
128 #ifdef __cplusplus
129 }
130 #endif