-
Notifications
You must be signed in to change notification settings - Fork 0
/
KlgReader.h
73 lines (55 loc) · 1.73 KB
/
KlgReader.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
67
68
69
70
71
72
73
// developed by John McCormac
// https://bitbucket.org/jbmcc/objecttagger
#ifndef KLGREADER_H
#define KLGREADER_H
#include <iostream>
#include <fstream>
#include <string>
#include <set>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <zlib.h>
class KlgReader
{
public:
KlgReader ();
KlgReader (const std::string& video);
virtual ~KlgReader () {}
void openRGBD(const std::string& video);
void openGroundTruth(const std::string& ground_truth);
void openArtificialDepth(const std::string& depth);
bool isOpen() const;
bool hasNextFrame() const;
bool nextFrame();
unsigned long long int timestamp() const;
int classAtPixel(const int x, const int y) const;
int instanceAtPixel(const int x, const int y) const;
int depthAtPixel(const int x, const int y) const;
int artificialDepthAtPixel(const int x, const int y) const;
cv::Mat rgb() const;
cv::Mat depth() const;
cv::Mat groundTruth() const;
cv::Mat groundTruthDepth() const;
private:
void reset();
std::ifstream video_stream_;
std::ifstream ground_truth_stream_;
std::ifstream artificial_depth_stream_;
std::vector<unsigned char> image_buffer_;
std::vector<unsigned char> depth_buffer_;
std::vector<Bytef> depth_decompression_buffer_;
std::vector<unsigned char> ground_truth_buffer_;
std::vector<unsigned char> artificial_depth_buffer_;
cv::Mat current_frame_rgb_;
cv::Mat current_frame_depth_;
cv::Mat current_frame_ground_truth_;
cv::Mat current_frame_artificial_depth_;
int number_frames_left_rgb_;
int number_frames_left_ground_truth_;
int number_frames_left_artificial_depth_;
int64_t timestamp_;
bool ground_truth_;
bool artificial_depth_;
};
#endif