-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathUtil.h
66 lines (59 loc) · 1.25 KB
/
Util.h
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
#pragma once
#include <windows.h>
#include <string>
#include <k4a/k4a.h>
#include <k4a/k4a.hpp>
#ifdef CONVERT_IMAGE
#include "libyuv.h"
#include "turbojpeg.h"
#endif
namespace sen
{
void create_xy_table(const k4a::calibration &calibration, k4a::image &xy_table);
double ElapsedTime(const LARGE_INTEGER& start, const LARGE_INTEGER& end);
void checkGlError(const char* op);
inline uint32_t k4a_convert_fps_to_uint(k4a_fps_t fps)
{
uint32_t fps_int;
switch (fps)
{
case K4A_FRAMES_PER_SECOND_5:
fps_int = 5;
break;
case K4A_FRAMES_PER_SECOND_15:
fps_int = 15;
break;
case K4A_FRAMES_PER_SECOND_30:
fps_int = 30;
break;
default:
fps_int = 0;
break;
}
return fps_int;
}
inline bool ImagesAreCorrectlySized(const k4a::image &srcImage,
const k4a::image &dstImage,
const size_t *srcImageExpectedSize)
{
if (srcImageExpectedSize)
{
if (srcImage.get_size() != *srcImageExpectedSize)
{
return false;
}
}
if (srcImage.get_width_pixels() != dstImage.get_width_pixels())
{
return false;
}
if (srcImage.get_height_pixels() != dstImage.get_height_pixels())
{
return false;
}
return true;
}
#ifdef CONVERT_IMAGE
bool ConvertImage(const k4a::image &srcImage, k4a::image *bgraImage);
#endif
}