-
Notifications
You must be signed in to change notification settings - Fork 0
/
PMSPropagation.h
95 lines (72 loc) · 2.18 KB
/
PMSPropagation.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//
// Created by tianhe on 2022/8/10.
//
#ifndef PMSPROPAGATION_H
#define PMSPROPAGATION_H
#include <random>
#include <cmath>
#include "PMSType.h"
#include "CostComputer.hpp"
class PMSPropagation {
public:
PMSPropagation(const PMSOption &option,
const sint32 &width, const sint32 &height,
const uint8 *imgLeft, const uint8 *imgRight,
const PGradient *gradLeft, const PGradient *gradRight,
DisparityPlane *planeLeft, DisparityPlane *planeRight,
float32 *costLeft, float32 *costRight,
float32 *disparityMap);
~PMSPropagation();
/** \brief 执行传播一次 */
void doPropagation();
private:
/** \brief PMS算法参数*/
PMSOption _option;
/** \brief 影像宽高 */
sint32 _width;
sint32 _height;
/** \brief 影像数据 */
const uint8 *_imgLeft;
const uint8 *_imgRight;
/** \brief 梯度数据 */
const PGradient *_gradLeft;
const PGradient *_gradRight;
/** \brief 平面数据 */
DisparityPlane *_planeLeft;
DisparityPlane *_planeRight;
/** \brief 代价数据 */
float32 *_costLeft;
float32 *_costRight;
/** \brief 视差数据 */
float32 *_disparityMap;
/** \brief 代价计算器 */
CostComputer *_costCptLeft;
CostComputer *_costCptRight;
/** \brief 传播迭代次数 */
sint32 _numIter;
/** \brief 随机数生成器 */
std::uniform_real_distribution<float32>* _randDisp;
std::uniform_real_distribution<float32>* _randNorm;
/** \brief 计算代价数据 */
void computeCostData();
/**
* \brief 空间传播
* \param x 像素x坐标
* \param y 像素y坐标
* \param direction 传播方向
*/
void spatialPropagation(const sint32& x, const sint32& y, const sint32& direction);
/**
* \brief 视图传播
* \param x 像素x坐标
* \param y 像素y坐标
*/
void viewPropagation(const sint32& x, const sint32& y);
/**
* \brief 平面优化
* \param x 像素x坐标
* \param y 像素y坐标
*/
void planeRefine(const sint32& x, const sint32& y);
};
#endif //PMSPROPAGATION_H