Ocean
|
This class implements a 2D pixel position with pixel precision. More...
Public Types | |
enum | RoughPixelDirection { RPD_INVALID , RPD_VERTICAL , RPD_HORIZONTAL , RPD_DIAGONAL } |
Definition of individual rough directions. More... | |
Public Member Functions | |
PixelPositionT () | |
Creates an invalid pixel position object with invalid coordinates. More... | |
PixelPositionT (const PixelPositionT< T > &position) | |
Copy constructor. More... | |
PixelPositionT (const T &x, const T &y) | |
Creates a new coordinate object by two given coordinate values. More... | |
T | x () const |
Returns the horizontal coordinate position of this object. More... | |
T | y () const |
Returns the vertical coordinate position of this object. More... | |
T & | x () |
Returns the horizontal coordinate position of this object. More... | |
T & | y () |
Returns the vertical coordinate position of this object. More... | |
void | setPosition (const T &x, const T &y) |
Sets the two coordinate values of this object. More... | |
unsigned int | sqrDistance (const PixelPositionT< T > &position) const |
Returns the square difference between two pixel positions. More... | |
CV::PixelPositionT< T > | neighbor (const CV::PixelDirection pixelDirection) const |
Returns the position of the pixel neighbor to this position. More... | |
PixelPositionT< T > | north () const |
Returns the pixel position north to this position. More... | |
PixelPositionT< T > | northWest () const |
Returns the pixel position north west to this position. More... | |
PixelPositionT< T > | west () const |
Returns the pixel position west to this position. More... | |
PixelPositionT< T > | southWest () const |
Returns the pixel position south west to this position. More... | |
PixelPositionT< T > | south () const |
Returns the pixel position south to this position. More... | |
PixelPositionT< T > | southEast () const |
Returns the pixel position south east to this position. More... | |
PixelPositionT< T > | east () const |
Returns the pixel position east to this position. More... | |
PixelPositionT< T > | northEast () const |
Returns the pixel position north east to this position. More... | |
PixelPositionT< T > | half () const |
Returns this position divided by two. More... | |
PixelPositionT< T > | twice () const |
Returns this position multiplied by two. More... | |
Vector2 | vector () const |
Returns a sub-pixel accuracy vector of this pixel position. More... | |
bool | isValid () const |
Returns whether this pixel position object holds two valid parameters. More... | |
bool | inArea9 (const PixelPositionT< T > &position) const |
Returns whether this pixel position is equal to a second pixel position or is the direct neighbor in an 8-neighborhood. More... | |
bool | isNeighbor4 (const PixelPositionT< T > &position) const |
Returns whether this pixel position is the direct neighbor to a second pixel position in an 4-neighborhood. More... | |
bool | isNeighbor8 (const PixelPositionT< T > &position) const |
Returns whether this pixel position is the direct neighbor to a second pixel position in an 8-neighborhood. More... | |
T | index (const unsigned int width) const |
Returns the index of this position inside a frame with given width. More... | |
PixelPositionT< T > & | operator= (const PixelPositionT< T > &position) |
Copy assignment operator. More... | |
PixelPositionT< T > | operator+ (const PixelPositionT< T > &position) const |
Adds two pixel positions and returns the result as a new pixel position object. More... | |
PixelPositionT< T > & | operator+= (const PixelPositionT< T > &position) |
Add a second pixel position to this position object. More... | |
PixelPositionT< T > | operator- (const PixelPositionT< T > &position) const |
Subtracts two pixel positions and returns the result as a new pixel position object. More... | |
PixelPositionT< T > & | operator-= (const PixelPositionT< T > &position) |
Subtracts a second pixel position from this position object. More... | |
PixelPositionT< T > | operator* (const T factor) const |
Multiplies this pixel position by a scalar and returns the new resulting position. More... | |
PixelPositionT< T > & | operator*= (const T factor) |
Multiplies this pixel position by a scalar. More... | |
PixelPositionT< T > | operator/ (const T factor) const |
Divides this pixel position by a scalar and returns the new resulting position. More... | |
PixelPositionT< T > & | operator/= (const T factor) |
Divides this pixel position by a scalar. More... | |
bool | operator< (const PixelPositionT< T > &position) const |
Compares two pixel position objects. More... | |
bool | operator== (const PixelPositionT< T > &position) const |
Returns whether two pixel position objects are equal. More... | |
bool | operator!= (const PixelPositionT< T > &position) const |
Returns whether two pixel position objects are not equal. More... | |
operator bool () const | |
Returns whether this pixel position object holds two valid parameters. More... | |
size_t | operator() (const PixelPositionT< T > &pixelPosition) const |
Hash function. More... | |
PixelPositionT () | |
bool | isValid () const |
bool | isValid () const |
bool | isValid () const |
bool | isValid () const |
PixelPositionT< unsigned int > | vector2pixelPosition (const Vector2 &value) |
PixelPositionT< int > | vector2pixelPosition (const Vector2 &value) |
Static Public Member Functions | |
static PixelDirection | direction (const PixelPositionT< T > &pixel0, const PixelPositionT< T > &pixel1) |
Returns the pixel direction of two successive pixels in a dense contour. More... | |
static RoughPixelDirection | roughDirection (const PixelPositionT< T > &pixel0, const PixelPositionT< T > &pixel1) |
Returns the rough pixel direction of two successive pixels in a dense contour. More... | |
static Vector2 | pixelPosition2vector (const PixelPositionT< T > &pixelPosition) |
Converts a pixel position into a 2D vector. More... | |
static Vectors2 | pixelPositions2vectors (const std::vector< PixelPositionT< T >> &pixelPositions) |
Converts several pixel positions to 2D vectors. More... | |
static PixelPositionT< T > | vector2pixelPosition (const Vector2 &value) |
Converts a 2D vector into a pixel position. More... | |
static std::vector< PixelPositionT< T > > | vectors2pixelPositions (const Vectors2 &values) |
Converts several 2D vectors into pixel positions. More... | |
static std::vector< PixelPositionT< T > > | vectors2pixelPositions (const Vectors2 &values, const unsigned int width, const unsigned int height) |
Converts several 2D vectors into pixel positions. More... | |
template<typename TTarget > | |
static std::vector< PixelPositionT< TTarget > > | pixelPositions2pixelPositions (const std::vector< PixelPositionT< T >> &pixelPositions) |
Converts pixels positions with a data type T to pixel positions with another data type. More... | |
Protected Attributes | |
T | x_ |
Horizontal coordinate value of this object, in pixel. More... | |
T | y_ |
Vertical coordinate value of this object, in pixel. More... | |
This class implements a 2D pixel position with pixel precision.
T | The data type that is used to store the elements of a pixel coordinate |
enum Ocean::CV::PixelPositionT::RoughPixelDirection |
|
inline |
Creates an invalid pixel position object with invalid coordinates.
|
inline |
Copy constructor.
position | The position to copy |
|
inline |
Creates a new coordinate object by two given coordinate values.
x | Horizontal position in pixel |
y | Vertical position in pixel |
|
inline |
|
inlinestatic |
Returns the pixel direction of two successive pixels in a dense contour.
pixel0 | First pixel |
pixel1 | Following pixel |
|
inline |
Returns the pixel position east to this position.
|
inline |
Returns this position divided by two.
|
inline |
Returns whether this pixel position is equal to a second pixel position or is the direct neighbor in an 8-neighborhood.
position | Second pixel position to check |
|
inline |
|
inline |
Returns whether this pixel position is the direct neighbor to a second pixel position in an 4-neighborhood.
position | Second pixel position to check |
|
inline |
Returns whether this pixel position is the direct neighbor to a second pixel position in an 8-neighborhood.
position | Second pixel position to check |
|
inline |
Returns whether this pixel position object holds two valid parameters.
|
inline |
|
inline |
|
inline |
|
inline |
CV::PixelPositionT< T > Ocean::CV::PixelPositionT< T >::neighbor | ( | const CV::PixelDirection | pixelDirection | ) | const |
Returns the position of the pixel neighbor to this position.
pixelDirection | The direction in which the neighbor will be located, must be valid |
|
inline |
Returns the pixel position north to this position.
|
inline |
Returns the pixel position north east to this position.
|
inline |
Returns the pixel position north west to this position.
|
inlineexplicit |
Returns whether this pixel position object holds two valid parameters.
|
inline |
Returns whether two pixel position objects are not equal.
position | Second pixel position object to be compared |
|
inline |
Hash function.
pixelPosition | The pixel position for which the hash value will be determined |
|
inline |
Multiplies this pixel position by a scalar and returns the new resulting position.
factor | The multiplication factor, with range (-infinity, infinity) |
|
inline |
Multiplies this pixel position by a scalar.
factor | The multiplication factor, with range (-infinity, infinity) |
|
inline |
Adds two pixel positions and returns the result as a new pixel position object.
position | Second pixel position to add |
|
inline |
Add a second pixel position to this position object.
position | Second pixel position to add |
|
inline |
Subtracts two pixel positions and returns the result as a new pixel position object.
position | Second pixel position to subtract |
|
inline |
Subtracts a second pixel position from this position object.
position | Second pixel position to subtract |
|
inline |
Divides this pixel position by a scalar and returns the new resulting position.
factor | The division factor, with range (-infinity, infinity) \ {0} |
|
inline |
Divides this pixel position by a scalar.
factor | The division factor, with range (-infinity, infinity) \ {0} |
|
inline |
Compares two pixel position objects.
position | Second pixel position object to be compared |
|
inline |
Copy assignment operator.
position | The position to copy |
|
inline |
Returns whether two pixel position objects are equal.
position | Second pixel position object to be compared |
|
inlinestatic |
Converts a pixel position into a 2D vector.
pixelPosition | Pixel position to be converted |
|
inlinestatic |
Converts pixels positions with a data type T to pixel positions with another data type.
Beware: This function does not handle out-of-range issues. Thus, ensure that the target data types can covers the locations of the source positions.
pixelPositions | The pixel positions to convert |
TTarget | Data type of the target pixel positions |
|
inlinestatic |
Converts several pixel positions to 2D vectors.
pixelPositions | Pixel positions to be converted |
|
inlinestatic |
Returns the rough pixel direction of two successive pixels in a dense contour.
pixel0 | First pixel |
pixel1 | Following pixel |
|
inline |
Sets the two coordinate values of this object.
x | Horizontal coordinate value to set, in pixel |
y | Vertical coordinate value to be set, in pixel |
|
inline |
Returns the pixel position south to this position.
|
inline |
Returns the pixel position south east to this position.
|
inline |
Returns the pixel position south west to this position.
|
inline |
Returns the square difference between two pixel positions.
position | Second position to determine the difference for |
|
inline |
Returns this position multiplied by two.
|
inline |
Returns a sub-pixel accuracy vector of this pixel position.
|
inlinestatic |
Converts a 2D vector into a pixel position.
The pixel positions are rounded.
value | The value to be converted, with range [0, infinity)x[0, infinity) |
|
inline |
|
inline |
|
inlinestatic |
Converts several 2D vectors into pixel positions.
The pixel positions are rounded.
values | The values to be converted, with range [0, infinity)x[0, infinity) |
|
inlinestatic |
Converts several 2D vectors into pixel positions.
The pixel positions are rounded and clipped to the given frame dimension.
values | The values to be converted, with range [0, infinity)x[0, infinity) |
width | The width of the clipping area, in pixel |
height | The height of the clipping area, in pixel |
|
inline |
Returns the pixel position west to this position.
|
inline |
Returns the horizontal coordinate position of this object.
|
inline |
Returns the horizontal coordinate position of this object.
|
inline |
Returns the vertical coordinate position of this object.
|
inline |
Returns the vertical coordinate position of this object.
|
protected |
Horizontal coordinate value of this object, in pixel.
|
protected |
Vertical coordinate value of this object, in pixel.