CVB++ 15.0
search_result.hpp
1#pragma once
2
3#include "../_cexports/c_sf2.h"
4
5#include "shapefinder2.hpp"
6
7#include "../point_2d.hpp"
8#include "../string.hpp"
9//
10#include <iomanip>
11
12namespace Cvb
13{
14 CVB_BEGIN_INLINE_NS
15
16 namespace ShapeFinder2
17 {
18
20
22 class SearchResult
23 {
24
25 public:
26 SearchResult() noexcept
28 , position_()
29 , quality_(0.0)
30 , rotation_(0.0)
31 , scale_(0.0)
32 {
33 }
34
36
41 {
42 return precisionMode_;
43 }
44
46
50 Point2D<double> Position() const noexcept
51 {
52 return position_;
53 }
54
56
60 double X() const noexcept
61 {
62 return position_.X();
63 }
64
66
70 double Y() const noexcept
71 {
72 return position_.Y();
73 }
74
76
80 double Quality() const noexcept
81 {
82 return quality_;
83 }
84
86
90 double Scale() const noexcept
91 {
92 return scale_;
93 }
94
96
100 Angle Rotation() const noexcept
101 {
102 return Angle::FromRadians(rotation_);
103 }
104
106
112 bool operator!=(const SearchResult &rhs) const noexcept
113 {
114 return ((*this).PrecisionMode() != rhs.PrecisionMode()) || ((*this).Position() != rhs.Position())
115 || ((*this).Quality() != rhs.Quality()) || ((*this).Rotation() != rhs.Rotation())
116 || ((*this).Scale() != rhs.Scale());
117 }
118
120
126 bool operator==(const SearchResult &rhs) const noexcept
127 {
128 return (!(*this != rhs));
129 }
130
131 private:
133 : precisionMode_(mode)
134 {
135 if (data.size() == 5)
136 {
137 position_.SetX(data[0]);
138 position_.SetY(data[1]);
139 quality_ = data[2];
140 rotation_ = data[3] * CVB_M_PI / 180.0;
141 scale_ = data[4];
142 }
143 }
144
145 private:
147 Point2D<double> position_;
148 double quality_;
149 double rotation_;
150 double scale_;
151
152 friend class Classifier;
153 }; // Search Result
154
155 } // namespace ShapeFinder2
156
158
159 CVB_END_INLINE_NS
160} // namespace Cvb
Object for convenient and type - safe handling of angles.
Definition angle.hpp:16
static Angle FromRadians(double rad, bool trim=false) noexcept
Create an angle in radians.
Definition angle.hpp:39
Multi-purpose 2D vector class.
Definition point_2d.hpp:20
void SetX(T x) noexcept
Sets the x-component of the point.
Definition point_2d.hpp:94
void SetY(T y)
Sets the y-component of the point.
Definition point_2d.hpp:114
Search result as returned by the classifier.
Definition search_result.hpp:23
bool operator!=(const SearchResult &rhs) const noexcept
Comparison operator for SearchResult objects.
Definition search_result.hpp:112
double Quality() const noexcept
Quality measure of the result.
Definition search_result.hpp:80
double Scale() const noexcept
Scale of the result relative the originally trained object.
Definition search_result.hpp:90
Point2D< double > Position() const noexcept
Result location in the image.
Definition search_result.hpp:50
Angle Rotation() const noexcept
Rotation angle of the result.
Definition search_result.hpp:100
double Y() const noexcept
Y position at which the object has been found.
Definition search_result.hpp:70
double X() const noexcept
X position at which the object has been found.
Definition search_result.hpp:60
bool operator==(const SearchResult &rhs) const noexcept
Comparison operator for SearchResult objects.
Definition search_result.hpp:126
Cvb::ShapeFinder2::PrecisionMode PrecisionMode() const noexcept
PrecisionMode that was used for generating this result.
Definition search_result.hpp:40
Namespace for the ShapeFinder2 package.
Definition classifier.hpp:30
PrecisionMode
Controls precision over accuracy for ShapeFinder 1 type searches.
Definition shapefinder2.hpp:42
@ NoCorrelation
In the NoCorrelation mode, only the ShapeFinder edge model will be searched.
Definition shapefinder2.hpp:44
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17