Visual Servoing Platform
version 3.3.0
vpKinect.h
1
/****************************************************************************
2
*
3
* ViSP, open source Visual Servoing Platform software.
4
* Copyright (C) 2005 - 2019 by Inria. All rights reserved.
5
*
6
* This software is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
10
* See the file LICENSE.txt at the root directory of this source
11
* distribution for additional information about the GNU GPL.
12
*
13
* For using ViSP with software that can not be combined with the GNU
14
* GPL, please contact Inria about acquiring a ViSP Professional
15
* Edition License.
16
*
17
* See http://visp.inria.fr for more information.
18
*
19
* This software was developed at:
20
* Inria Rennes - Bretagne Atlantique
21
* Campus Universitaire de Beaulieu
22
* 35042 Rennes Cedex
23
* France
24
*
25
* If you have questions regarding the use of this file, please contact
26
* Inria at visp@inria.fr
27
*
28
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30
*
31
* Description:
32
* API for using a Microsoft Kinect device
33
* Requires libfreenect as a third party library
34
*
35
* Authors:
36
* Celine Teuliere
37
*
38
*****************************************************************************/
39
40
#ifndef _vpKinect_h_
41
#define _vpKinect_h_
42
43
#include <visp3/core/vpConfig.h>
44
// Note that libfreenect needs libusb-1.0 and libpthread
45
#if defined(VISP_HAVE_LIBFREENECT_AND_DEPENDENCIES)
46
47
#include <iostream>
48
#include <libfreenect.hpp>
49
50
#include <visp3/core/vpCameraParameters.h>
51
#include <visp3/core/vpHomogeneousMatrix.h>
52
#include <visp3/core/vpImage.h>
53
#include <visp3/core/vpMeterPixelConversion.h>
54
#include <visp3/core/vpMutex.h>
// need pthread
55
#include <visp3/core/vpPixelMeterConversion.h>
56
109
class
VISP_EXPORT
vpKinect
:
public
Freenect::FreenectDevice
110
{
111
// private:
112
//#ifndef DOXYGEN_SHOULD_SKIP_THIS
113
// vpKinect(const vpKinect &); // Not implemented!
114
// vpKinect &operator=(const vpKinect &){
115
// throw vpException(vpException::functionNotImplementedError,"Not
116
// implemented!"); return *this;
117
// }
118
//#endif
119
120
public
:
124
typedef
enum
{
125
DMAP_LOW_RES
,
126
DMAP_MEDIUM_RES
127
} vpDMResolution;
128
129
vpKinect
(freenect_context *ctx,
int
index);
130
virtual
~
vpKinect
();
131
132
void
start(
vpKinect::vpDMResolution
res = DMAP_LOW_RES);
133
void
stop();
134
135
bool
getDepthMap(
vpImage<float>
&map);
136
bool
getDepthMap(
vpImage<float>
&map,
vpImage<unsigned char>
&Imap);
137
bool
getRGB(
vpImage<vpRGBa>
&IRGB);
138
139
inline
void
getIRCamParameters
(
vpCameraParameters
&cam)
const
{ cam = IRcam; }
140
inline
void
getRGBCamParameters
(
vpCameraParameters
&cam)
const
{ cam = RGBcam; }
141
inline
void
setIRCamParameters
(
const
vpCameraParameters
&cam) { IRcam = cam; }
142
inline
void
setRGBCamParameters
(
const
vpCameraParameters
&cam) { RGBcam = cam; }
143
144
void
warpRGBFrame(
const
vpImage<vpRGBa>
&Irgb,
const
vpImage<float>
&Idepth,
145
vpImage<vpRGBa>
&IrgbWarped);
// warp the RGB image into
146
// the Depth camera frame
147
148
private
:
150
// Do not call directly even in child
151
void
VideoCallback(
void
*rgb, uint32_t timestamp);
152
153
// Do not call directly even in child
154
void
DepthCallback(
void
*depth, uint32_t timestamp);
155
156
private
:
157
vpMutex
m_rgb_mutex;
158
vpMutex
m_depth_mutex;
159
160
vpCameraParameters
RGBcam, IRcam;
// intrinsic parameters of the two cameras
161
vpHomogeneousMatrix
rgbMir;
// Transformation from IRcam coordinate frame to
162
// RGBcam coordinate frame.
163
vpHomogeneousMatrix
irMrgb;
// Transformation from RGBcam coordinate frame
164
// to IRcam coordinate frame .
165
vpDMResolution DMres;
166
unsigned
int
hd;
// height of the depth map
167
unsigned
int
wd;
// width of the depth map
168
169
// Access protected by a mutex:
170
vpImage<float>
dmap;
171
vpImage<vpRGBa>
IRGB;
172
bool
m_new_rgb_frame;
173
bool
m_new_depth_map;
174
bool
m_new_depth_image;
175
unsigned
int
height;
// height of the rgb image
176
unsigned
int
width;
// width of the rgb image
177
};
178
179
#endif
180
181
#endif
vpKinect::setRGBCamParameters
void setRGBCamParameters(const vpCameraParameters &cam)
Definition:
vpKinect.h:142
vpKinect::setIRCamParameters
void setIRCamParameters(const vpCameraParameters &cam)
Definition:
vpKinect.h:141
vpCameraParameters
Generic class defining intrinsic camera parameters.
Definition:
vpCameraParameters.h:234
vpKinect::getRGBCamParameters
void getRGBCamParameters(vpCameraParameters &cam) const
Definition:
vpKinect.h:140
vpKinect::getIRCamParameters
void getIRCamParameters(vpCameraParameters &cam) const
Definition:
vpKinect.h:139
vpKinect::DMAP_LOW_RES
@ DMAP_LOW_RES
Definition:
vpKinect.h:125
vpKinect
Driver for the Kinect-1 device.
Definition:
vpKinect.h:110
vpKinect::vpDMResolution
vpDMResolution
Definition:
vpKinect.h:124
vpMutex
Definition:
vpMutex.h:75
vpImage< float >
vpHomogeneousMatrix
Implementation of an homogeneous matrix and operations on such kind of matrices.
Definition:
vpHomogeneousMatrix.h:150
modules
sensor
include
visp3
sensor
vpKinect.h
Generated by
1.8.20