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