-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathdepthComp.hpp
111 lines (79 loc) · 3.02 KB
/
depthComp.hpp
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// *****************************************************************************
/*
DepthComp : efficient depth filling appraoch built on segmentation
Requirements: depth image / segmented image
Implementation of DepthComp - Atapour-Abarghouei / Breckon, Proc. BMVC 2017.
Author : Amir Atapour-Abarghouei, amir.atapour-abarghouei@durham.ac.uk
Copyright (c) 2017 Engineering and Computing Sciences, Durham University
License : GPL - http://www.gnu.org/licenses/gpl.html
********************************************************************************
*/
#ifndef depthComp_hpp
#define depthComp_hpp
// *****************************************************************************
#include <iostream>
#include <stdlib.h>
#include <opencv2/photo/photo.hpp>
// #include <opencv2/cv.h>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/calib3d/calib3d.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <stdlib.h>
#include <cstdlib>
#include <stdio.h>
#include <math.h>
#include <fstream>
#include <chrono>
using ns = std::chrono::microseconds;
using get_time = std::chrono::steady_clock;
using namespace cv;
using namespace std;
// *****************************************************************************
class DepthComp {
private:
int holeFound;
//counting case numbers
int case1;
int case2;
int case3;
int case4;
int case5;
int case6;
int case7;
int case8;
int case9;
int case10;
int case11;
int case12;
int holesExist; // used to check if holes still exist after each run
int times; // shows how many times we have iterated over the image
// worker function to perform each pass of the completion process
Mat identFillHolesPass(Mat depthIn, const Mat& labelIn);
public:
DepthComp();
~DepthComp();
// perform pre-processing on the depth image prior to completion
// depthIn - input depth (N.B. modified inplace)
// labelIn - input segmented label image
// depthNormalize - perform depth normalization (stretching) for visualization
// return value - pre-processed depth image
Mat preProcess(Mat depthIn, const Mat& labelIn, bool depthNormalize=true);
// perform post-processing on the depth image after completion if required
// depthIn - input depth (N.B. modified inplace)
// labelIn - input segmented label image
// inpaintLeftOvers - perform post filling of non-parametrically unresolvable cases if needed
// return value - post-processed depth image
Mat postProcess(Mat depthIn, const Mat& labelIn, bool inpaintLeftOvers=true);
// perform the identification and filling of depth holes
// depthIn - input depth (N.B. modified inplace)
// labelIn - input segmented label image (N.B. modified inplace)
// logStats - log the statistics of the completion process to file data.txt
// return value - completed output depth image
Mat identFillHoles(Mat depthIn, const Mat labelIn, bool logStats=false);
};
#endif
// *****************************************************************************