forked from kuronekodaisuki/StitchCam
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MyCompensator.h
66 lines (51 loc) · 1.8 KB
/
MyCompensator.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 <opencv2/opencv.hpp>
#include <opencv2/gpu/gpumat.hpp>
#include <opencv2/stitching/detail/util.hpp>
#include <opencv2/stitching/detail/exposure_compensate.hpp>
using namespace std;
namespace cv {
namespace gpu {
namespace device {
void cudaApply(gpu::GpuMat &image, float scale);
void cudaApply(Mat &image, float scale);
} // namespace device
} // namespace gpu
namespace detail {
class MyCompensator : public GainCompensator
{
public:
void feed(const vector<Point> &corners, const vector<Mat> &images,
const vector<Mat> &masks)
{
vector<pair<Mat,uchar> > level_masks;
for (size_t i = 0; i < masks.size(); ++i)
level_masks.push_back(make_pair(masks[i], 255));
feed(corners, images, level_masks);
}
void feed(const vector<Point> &corners, const vector<gpu::GpuMat> &images,
const vector<Mat> &masks)
{
vector<pair<Mat,uchar> > level_masks;
for (size_t i = 0; i < masks.size(); ++i)
level_masks.push_back(make_pair(masks[i], 255));
feed(corners, images, level_masks);
}
void feed(const vector<Point> &corners, const vector<Mat> &images,
const vector<pair<Mat,uchar> > &masks);
void feed(const vector<Point> &corners, const vector<gpu::GpuMat> &images,
const vector<pair<Mat,uchar> > &masks);
void feed(const vector<Point> &corners, const vector<Mat> &images,
const vector<pair<gpu::GpuMat,uchar> > &masks);
void apply(int index, Point corner, Mat &image, const Mat &mask);
void apply(int index, Point corner, gpu::GpuMat &image, const gpu::GpuMat &mask);
MyCompensator(bool useGpu = false); // constructor
protected:
Mat_<double> gains_; //
bool useGpu;
};
} // namespace detail
} // namespace cv