|
Ocean
|
This class implements a 2D pixel position with pixel precision. More...
#include <PixelPosition.h>
Public Types | |
| enum | RoughPixelDirection : uint32_t { RPD_INVALID = 0u , 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. | |
| PixelPositionT (const PixelPositionT< T > &position) | |
| Copy constructor. | |
| PixelPositionT (const T &x, const T &y) | |
| Creates a new coordinate object by two given coordinate values. | |
| T | x () const |
| Returns the horizontal coordinate position of this object. | |
| T | y () const |
| Returns the vertical coordinate position of this object. | |
| T & | x () |
| Returns the horizontal coordinate position of this object. | |
| T & | y () |
| Returns the vertical coordinate position of this object. | |
| void | setPosition (const T &x, const T &y) |
| Sets the two coordinate values of this object. | |
| unsigned int | sqrDistance (const PixelPositionT< T > &position) const |
| Returns the square difference between two pixel positions. | |
| CV::PixelPositionT< T > | neighbor (const CV::PixelDirection pixelDirection) const |
| Returns the position of the pixel neighbor to this position. | |
| PixelPositionT< T > | north () const |
| Returns the pixel position north to this position. | |
| PixelPositionT< T > | northWest () const |
| Returns the pixel position north west to this position. | |
| PixelPositionT< T > | west () const |
| Returns the pixel position west to this position. | |
| PixelPositionT< T > | southWest () const |
| Returns the pixel position south west to this position. | |
| PixelPositionT< T > | south () const |
| Returns the pixel position south to this position. | |
| PixelPositionT< T > | southEast () const |
| Returns the pixel position south east to this position. | |
| PixelPositionT< T > | east () const |
| Returns the pixel position east to this position. | |
| PixelPositionT< T > | northEast () const |
| Returns the pixel position north east to this position. | |
| PixelPositionT< T > | half () const |
| Returns this position divided by two. | |
| PixelPositionT< T > | twice () const |
| Returns this position multiplied by two. | |
| Vector2 | vector () const |
| Returns a sub-pixel accuracy vector of this pixel position. | |
| bool | isValid () const |
| Returns whether this pixel position object holds two valid parameters. | |
| 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. | |
| 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. | |
| 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. | |
| T | index (const unsigned int width) const |
| Returns the index of this position inside a frame with given width. | |
| PixelPositionT< T > & | operator= (const PixelPositionT< T > &position) |
| Copy assignment operator. | |
| PixelPositionT< T > | operator+ (const PixelPositionT< T > &position) const |
| Adds two pixel positions and returns the result as a new pixel position object. | |
| PixelPositionT< T > & | operator+= (const PixelPositionT< T > &position) |
| Add a second pixel position to this position object. | |
| PixelPositionT< T > | operator- (const PixelPositionT< T > &position) const |
| Subtracts two pixel positions and returns the result as a new pixel position object. | |
| PixelPositionT< T > & | operator-= (const PixelPositionT< T > &position) |
| Subtracts a second pixel position from this position object. | |
| PixelPositionT< T > | operator* (const T factor) const |
| Multiplies this pixel position by a scalar and returns the new resulting position. | |
| PixelPositionT< T > & | operator*= (const T factor) |
| Multiplies this pixel position by a scalar. | |
| PixelPositionT< T > | operator/ (const T factor) const |
| Divides this pixel position by a scalar and returns the new resulting position. | |
| PixelPositionT< T > & | operator/= (const T factor) |
| Divides this pixel position by a scalar. | |
| bool | operator< (const PixelPositionT< T > &position) const |
| Compares two pixel position objects. | |
| bool | operator== (const PixelPositionT< T > &position) const |
| Returns whether two pixel position objects are equal. | |
| bool | operator!= (const PixelPositionT< T > &position) const |
| Returns whether two pixel position objects are not equal. | |
| operator bool () const | |
| Returns whether this pixel position object holds two valid parameters. | |
| size_t | operator() (const PixelPositionT< T > &pixelPosition) const |
| Hash function. | |
| 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. | |
| static RoughPixelDirection | roughDirection (const PixelPositionT< T > &pixel0, const PixelPositionT< T > &pixel1) |
| Returns the rough pixel direction of two successive pixels in a dense contour. | |
| static Vector2 | pixelPosition2vector (const PixelPositionT< T > &pixelPosition) |
| Converts a pixel position into a 2D vector. | |
| static Vectors2 | pixelPositions2vectors (const std::vector< PixelPositionT< T > > &pixelPositions) |
| Converts several pixel positions to 2D vectors. | |
| static PixelPositionT< T > | vector2pixelPosition (const Vector2 &value) |
| Converts a 2D vector into a pixel position. | |
| static std::vector< PixelPositionT< T > > | vectors2pixelPositions (const Vectors2 &values) |
| Converts several 2D vectors into pixel positions. | |
| static std::vector< PixelPositionT< T > > | vectors2pixelPositions (const Vectors2 &values, const unsigned int width, const unsigned int height) |
| Converts several 2D vectors into pixel positions. | |
| 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. | |
Protected Attributes | |
| T | x_ |
| Horizontal coordinate value of this object, in pixel. | |
| T | y_ |
| Vertical coordinate value of this object, in pixel. | |
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 : uint32_t |
|
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.