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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132 | /*
* File: CameraInfo.h
* Author: Oliver Welter
*
* Created on 1. Februar 2009, 20:07
*/
#ifndef _CAMERAINFO_H_
#define _CAMERAINFO_H_
#include "Tools/DataStructures/ParameterList.h"
#include "Tools/DataStructures/Printable.h"
#include "Tools/DataStructures/Serializer.h"
namespace naoth
{
// TODO: remove this
static const unsigned int IMAGE_WIDTH = 640;
static const unsigned int IMAGE_HEIGHT = 480;
class CameraInfoParameter : public ParameterList
{
public:
//diagonal angle of field of view
double openingAngleDiagonal;
/*
//size of an Pixel on the chip
double pixelSize;
//measured focus
double focus;
//moved middle point
double xp;
double yp;
//radial symmetric distortion parameters
double k1;
double k2;
double k3;
//radial asymmetric and tangential distortion parameters
double p1;
double p2;
//affinity and ... distortion parameters
double b1;
double b2;
*/
CameraInfoParameter(std::string idName);<--- Class 'CameraInfoParameter' has a constructor with 1 argument that is not explicit. [+]Class 'CameraInfoParameter' has a constructor with 1 argument that is not explicit. Such constructors should in general be explicit for type safety reasons. Using the explicit keyword in the constructor means some mistakes when using the class can be avoided.
};
class CameraInfo: public Printable
{
friend class Serializer<CameraInfo>;
public:
enum CameraID
{
Top,
Bottom,
numOfCamera //FIXME: this doesn't correspond to the type naothmessages::CameraID
};
CameraInfo()
:
cameraID(Bottom),
resolutionWidth(IMAGE_WIDTH),
resolutionHeight(IMAGE_HEIGHT),
params(getCameraIDName(Bottom))
{}
CameraInfo(CameraID id)<--- Class 'CameraInfo' has a constructor with 1 argument that is not explicit. [+]Class 'CameraInfo' has a constructor with 1 argument that is not explicit. Such constructors should in general be explicit for type safety reasons. Using the explicit keyword in the constructor means some mistakes when using the class can be avoided.
:
cameraID(id),
resolutionWidth(IMAGE_WIDTH),
resolutionHeight(IMAGE_HEIGHT),
params(getCameraIDName(id))
{}
virtual ~CameraInfo()
{}
CameraID cameraID;
unsigned int resolutionWidth;
unsigned int resolutionHeight;
// getter functions that use the existing values to calculate their result
double getFocalLength() const;
double getOpeningAngleWidth() const;
double getOpeningAngleHeight() const;
double getOpticalCenterX() const;
double getOpticalCenterY() const;
unsigned long getSize() const;
double getOpeningAngleDiagonal() const;
virtual void print(std::ostream& stream) const;
std::string getCameraIDName(CameraID id) const
{
switch(id)
{
case Top: return "Top";
case Bottom: return "Bottom";
default: return "unknown";
}
}
protected:
CameraInfoParameter params;
};
template<>
class Serializer<CameraInfo>
{
public:
static void serialize(const CameraInfo& representation, std::ostream& stream);
static void deserialize(std::istream& stream, CameraInfo& representation);<--- Function 'deserialize' argument 2 names different: declaration 'representation' definition 'r'.
};
class CameraInfoTop : public CameraInfo
{
public:
CameraInfoTop() : CameraInfo(Top) {};
virtual ~CameraInfoTop() {}
};
template<>
class Serializer<CameraInfoTop> : public Serializer<CameraInfo>{};
}
#endif /* _CAMERAINFO_H_ */
|