Ocean
OrientedPointFeature.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_CV_DETECTOR_ORIENTED_POINT_FEATURE_H
9 #define META_OCEAN_CV_DETECTOR_ORIENTED_POINT_FEATURE_H
10 
13 
14 namespace Ocean
15 {
16 
17 namespace CV
18 {
19 
20 namespace Detector
21 {
22 
23 // Forward declaration.
24 class OrientedPointFeature;
25 
26 /**
27  * Definition of a vector holding oriented point features.
28  * @ingroup cvdetector
29  */
30 typedef std::vector<OrientedPointFeature> OrientedPointFeatures;
31 
32 /**
33  * This class implements the base class for all computer vision features mainly basing on points width an orientation.
34  * The feature observation is the 2D position the feature can observed e.g. on an image plane.<br>
35  * In contrast the feature position is the real 3D position of the feature.
36  * @ingroup cvdetector
37  */
38 class OCEAN_CV_DETECTOR_EXPORT OrientedPointFeature : public PointFeature
39 {
40  public:
41 
42  /**
43  * Creates a new feature object
44  */
45  inline OrientedPointFeature();
46 
47  /**
48  * Creates a new feature object by a given 2D observation point.
49  * @param observation Feature 2D observation position
50  * @param distortionState Distortion state of the 2D feature position
51  * @param strength Feature strength
52  * @param orientation Feature orientation in radian, range [0, 2*PI)
53  */
54  inline explicit OrientedPointFeature(const Vector2& observation, const DistortionState distortionState = DS_UNKNOWN, const Scalar strength = 0, const Scalar orientation = 0);
55 
56  /**
57  * Creates a new feature object by a given position.
58  * @param position Feature 3D position
59  * @param strength Feature strength
60  * @param orientation Feature orientation in radian, range [0, 2*PI)
61  */
62  inline explicit OrientedPointFeature(const Vector3& position, const Scalar strength = 0, const Scalar orientation = 0);
63 
64  /**
65  * Returns the orientation of this feature in radian.
66  * @return Feature orientation
67  */
68  inline Scalar orientation() const;
69 
70  /**
71  * Sets the orientation of this features in radian.
72  * @param orientation Feature orientation to set
73  */
74  inline void setOrientation(const Scalar orientation);
75 
76  protected:
77 
78  // Feature orientation in radian, range [0, 2*PI)
80 
81 };
82 
84  PointFeature(),
85  featureOrientation(0)
86 {
87  // nothing to do here
88 }
89 
90 inline OrientedPointFeature::OrientedPointFeature(const Vector2& observation, const DistortionState distortionState, const Scalar strength, const Scalar orientation) :
91  PointFeature(observation, distortionState, strength)
92 {
93  ocean_assert_accuracy(orientation >= 0 && orientation < Numeric::pi2());
95 }
96 
97 inline OrientedPointFeature::OrientedPointFeature(const Vector3& position, const Scalar strength, const Scalar orientation) :
98  PointFeature(position, strength)
99 {
100  ocean_assert_accuracy(orientation >= 0 && orientation < Numeric::pi2());
102 
104 }
105 
107 {
108  return featureOrientation;
109 }
110 
111 inline void OrientedPointFeature::setOrientation(const Scalar orientation)
112 {
113  ocean_assert_accuracy(orientation >= 0 && orientation < Numeric::pi2());
115 }
116 
117 }
118 
119 }
120 
121 }
122 
123 #endif // META_OCEAN_CV_DETECTOR_ORIENTED_POINT_FEATURE_H
This class implements the base class for all computer vision features mainly basing on points width a...
Definition: OrientedPointFeature.h:39
Scalar featureOrientation
Definition: OrientedPointFeature.h:79
OrientedPointFeature()
Creates a new feature object.
Definition: OrientedPointFeature.h:83
void setOrientation(const Scalar orientation)
Sets the orientation of this features in radian.
Definition: OrientedPointFeature.h:111
Scalar orientation() const
Returns the orientation of this feature in radian.
Definition: OrientedPointFeature.h:106
This class implements the base class for all computer vision features mainly basing on points.
Definition: PointFeature.h:44
DistortionState
Definition of individual distortion states.
Definition: PointFeature.h:51
@ DS_INVALID
Invalid distortion state.
Definition: PointFeature.h:53
DistortionState featureDistortionState
Holds the distortion state of the observation position.
Definition: PointFeature.h:168
static constexpr T pi2()
Returns 2*PI which is equivalent to 360 degree.
Definition: Numeric.h:932
std::vector< OrientedPointFeature > OrientedPointFeatures
Definition of a vector holding oriented point features.
Definition: OrientedPointFeature.h:24
float Scalar
Definition of a scalar type.
Definition: Math.h:128
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15