-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDrawFace.cpp
More file actions
executable file
·67 lines (49 loc) · 1.49 KB
/
DrawFace.cpp
File metadata and controls
executable file
·67 lines (49 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
* @file DrawFace.cpp
* @ingroup Drawing Kinect
* @author Dominique Vaufreydaz, Grenoble Alpes University, Inria
* @copyright All right reserved.
*/
#include "DrawFace.h"
using namespace cv;
using namespace MobileRGBD;
#ifdef KINECT_1
namespace MobileRGBD { namespace Kinect1 {
bool DrawFace::DrawElement( cv::Mat& WhereToDraw, const TimeB &RequestTimestamp )
{
int x = 0, y = 0, size = 0;
if ( sscanf( DataBuffer, "%*d %d, %d, %d", &x, &y, &size ) == 3 )
{
Point Courant(x/2,y/2);
circle( WhereToDraw, Courant, size/2, cvScalar(0,255,0), 2 );
}
return true;
}
}} // namespace MobileRGBD::Kinect1
#endif // KINECT_1
#ifdef KINECT_2
namespace MobileRGBD { namespace Kinect2 {
/** @brief ProcessElement is a callback function called by mother classes when data are ready.
*
* @param RequestTimestamp [in] The timestamp of the data.
* @param UserData [in] User pointer to working data. Here a pointer to a cv:Mat to draw in.
*/
bool DrawFace::ProcessElement( const TimeB &RequestTimestamp, void *UserData )
{
cv::Mat& WhereToDraw = *((cv::Mat*)UserData);
if ( NumberOfSubFrames == 0 )
{
// Nothing to Draw, draw is done
return true;
}
for( int i = 0; i < NumberOfSubFrames; i++ )
{
// Initialise memory block for a face
CurrentFace.Set( ((unsigned char*)FrameBuffer) + i*FrameSize );
// Draw it
CurrentFace.Draw(WhereToDraw, DrawInDepth);
}
return true;
}
}} // namespace MobileRGBD::Kinect1
#endif // KINECT_2