HPP class NOISE public virtual double next class UNIFORM_NOISE public

 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
//.HPP
class NOISE {
public:
virtual double next() = 0;
};
class UNIFORM_NOISE: public NOISE {
double L, R;
std::default_random_engine generator;
std::uniform_real_distribution<double> distribution;
public:
UNIFORM_NOISE(double _L, double _R);
double next();
};
class NORMAL_NOISE: public NOISE {
double m, s;
std::default_random_engine generator;
std::normal_distribution<double> distribution;
public:
NORMAL_NOISE(double _m, double _s);
double next();
};
//.CPP
UNIFORM_NOISE::UNIFORM_NOISE(double _L, double _R): L(_L), R(_R) {
distribution = std::uniform_real_distribution<double>(L, R);
}
double UNIFORM_NOISE::next() {
return distribution(generator);
}
NORMAL_NOISE::NORMAL_NOISE(double _m, double _s): m(_m), s(_s) {
distribution = std::normal_distribution<double>(m, s);
}
double NORMAL_NOISE::next() {
std::cout <<"gening" <<std::endl;
return distribution(generator);
}
//OTHER CLASS
std::vector< std::pair<cv::Point2d, cv::Point2d> > generate(const cv::Mat &rvec, const cv::Mat &tvec, int N, NOISE noise)
//ERROR
In file included from /home/other_file:1:0:
/home/other_file:35:117: error: cannot declare parameter noise to be of abstract type NOISE
std::vector< std::pair<cv::Point2d, cv::Point2d> > generate(const cv::Mat &rvec, const cv::Mat &tvec, int N, NOISE noise);