8 #ifndef META_OCEAN_CV_SEGMENTATION_CONTOUR_ANALYZER_H
9 #define META_OCEAN_CV_SEGMENTATION_CONTOUR_ANALYZER_H
26 namespace Segmentation
40 typedef std::vector<unsigned int>
Indices;
68 inline Scalar dense()
const;
74 inline unsigned int index()
const;
81 inline bool operator<(
const DenseObject&
object)
const;
89 unsigned int index_ = (
unsigned int)(-1);
137 static inline size_t pixelPositionHashValueFunction(
const PixelPosition& position);
167 return dense_ <
object.dense_;
180 const size_t size_tBits_2 =
sizeof(size_t) * 4u;
181 const size_t maximalValue = size_t(1) << size_tBits_2;
182 ocean_assert(
size_t(position.
x()) < maximalValue &&
size_t(position.
y()) < maximalValue);
185 return (
size_t(position.
x()) <<
sizeof(
size_t) * 4) | size_t(position.
y());
190 ocean_assert(pixel0 && pixel1);
193 const unsigned int parameter = (0x0000FFFF & (pixel1.
x() - pixel0.
x())) | ((pixel1.
y() - pixel0.
y()) << 16);
202 ocean_assert(pixel0.
north() == pixel1);
207 ocean_assert(pixel0.
northWest() == pixel1);
212 ocean_assert(pixel0.
west() == pixel1);
217 ocean_assert(pixel0.
southWest() == pixel1);
222 ocean_assert(pixel0.
south() == pixel1);
227 ocean_assert(pixel0.
southEast() == pixel1);
232 ocean_assert(pixel0.
east() == pixel1);
237 ocean_assert(pixel0.
northEast() == pixel1);
241 ocean_assert(
false &&
"Invalid direction");
PixelPositionT< T > west() const
Returns the pixel position west to this position.
Definition: PixelPosition.h:561
PixelPositionT< T > southWest() const
Returns the pixel position south west to this position.
Definition: PixelPosition.h:567
bool isNeighbor8(const PixelPositionT< T > &position) const
Returns whether this pixel position is the direct neighbor to a second pixel position in an 8-neighbo...
Definition: PixelPosition.h:663
PixelPositionT< T > north() const
Returns the pixel position north to this position.
Definition: PixelPosition.h:549
PixelPositionT< T > east() const
Returns the pixel position east to this position.
Definition: PixelPosition.h:585
T y() const
Returns the vertical coordinate position of this object.
Definition: PixelPosition.h:470
PixelPositionT< T > southEast() const
Returns the pixel position south east to this position.
Definition: PixelPosition.h:579
T x() const
Returns the horizontal coordinate position of this object.
Definition: PixelPosition.h:458
PixelPositionT< T > northWest() const
Returns the pixel position north west to this position.
Definition: PixelPosition.h:555
static std::vector< PixelPositionT< unsigned int > > vectors2pixelPositions(const Vectors2 &values)
Converts several 2D vectors into pixel positions.
Definition: PixelPosition.h:947
PixelPositionT< T > south() const
Returns the pixel position south to this position.
Definition: PixelPosition.h:573
PixelPositionT< T > northEast() const
Returns the pixel position north east to this position.
Definition: PixelPosition.h:591
This class implements a simple storage for a point index with corresponding dense parameter.
Definition: ContourAnalyzer.h:49
DenseObject()=default
Creates an default dense object.
bool operator<(const DenseObject &object) const
Returns whether the dense value of this object is smaller than that of a given second object.
Definition: ContourAnalyzer.h:165
Scalar dense() const
Returns the dense value of this object.
Definition: ContourAnalyzer.h:155
unsigned int index() const
Returns the index of this object.
Definition: ContourAnalyzer.h:160
This class implements functions analyzing contours.
Definition: ContourAnalyzer.h:34
static Vectors2 equalizeContourDensity(const Vectors2 &contour)
Equalized a sparse contour according to the density of the locations of contour points.
std::vector< DenseObject > DenseObjects
Definition of a vector holding dense objects.
Definition: ContourAnalyzer.h:93
static PixelDirection determinePixelDirection(const PixelPosition &pixel0, const PixelPosition &pixel1)
Returns the pixel direction of two successive pixels in a dense contour.
Definition: ContourAnalyzer.h:188
std::vector< unsigned int > Indices
Definition of a vector holding indices.
Definition: ContourAnalyzer.h:40
static size_t pixelPositionHashValueFunction(const PixelPosition &position)
Calculates a hash value for a given pixel position.
Definition: ContourAnalyzer.h:175
static Scalars curvature(const PixelPositions &contour, const unsigned int offset)
Determines the curvature for each contour pixel.
static PixelContour createDenseContour(const PixelPositions &points)
Creates a dense and distinct contour from any kind of given contour also ensuring that the resulting ...
std::vector< PixelPosition > PixelPositions
Definition of a vector holding pixel positions (with positive coordinate values).
Definition: PixelPosition.h:48
PixelDirection
Definition of individual directions with pixel accuracy.
Definition: CV.h:85
@ PD_WEST
Definition: CV.h:93
@ PD_NORTH_EAST
Definition: CV.h:103
@ PD_NORTH_WEST
Definition: CV.h:91
@ PD_EAST
Definition: CV.h:101
@ PD_SOUTH_WEST
Definition: CV.h:95
@ PD_SOUTH
Definition: CV.h:97
@ PD_SOUTH_EAST
Definition: CV.h:99
@ PD_INVALID
Definition: CV.h:87
@ PD_NORTH
Definition: CV.h:89
float Scalar
Definition of a scalar type.
Definition: Math.h:128
std::vector< Scalar > Scalars
Definition of a vector holding Scalar objects.
Definition: Math.h:144
std::vector< Vector2 > Vectors2
Definition of a vector holding Vector2 objects.
Definition: Vector2.h:64
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15