Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
vpImageCircle Class Reference

#include <vpImageCircle.h>

Public Member Functions

 vpImageCircle ()
 vpImageCircle (const vpImagePoint &center, const float &radius)
float computeAngularCoverageInRoI (const vpRect &roi, const float &roundingTolerance=0.001f) const
float computeArcLengthInRoI (const vpRect &roi, const float &roundingTolerance=0.001f) const
unsigned int computePixelsInMask (const vpImage< bool > &mask) const
vpImagePoint getCenter () const
float getRadius () const
vpRect getBBox () const
float get_n20 () const
float get_n02 () const
float get_n11 () const
bool isInside (const vpImagePoint &ip) const

Detailed Description

Class that defines a 2D circle in an image.

Examples
testImageCircle.cpp, tutorial-circle-hough.cpp, and tutorial-draw-circle.cpp.

Definition at line 56 of file vpImageCircle.h.

Constructor & Destructor Documentation

◆ vpImageCircle() [1/2]

vpImageCircle::vpImageCircle ( )

Default constructor.

Definition at line 70 of file vpImageCircle.cpp.

◆ vpImageCircle() [2/2]

vpImageCircle::vpImageCircle ( const vpImagePoint & center,
const float & radius )

Constructor from a center and radius.

Definition at line 77 of file vpImageCircle.cpp.

Member Function Documentation

◆ computeAngularCoverageInRoI()

float vpImageCircle::computeAngularCoverageInRoI ( const vpRect & roi,
const float & roundingTolerance = 0.001f ) const

Compute the angular coverage, in terms of radians, that is contained in the Region of Interest (RoI).

See also
computeArcLengthInRoI(), computeArcLengthInRoI(const vpRect &roi)
Parameters
[in]roiThe rectangular RoI in which we want to know the number of pixels of the circle that are contained.
[in]roundingToleranceThe tolerance on the angle when the angle is close to a negative multiple of 2 * M_PI_FLOAT.
Returns
Returns angular coverage of a circle in a ROI as an angle value in radians. More precisely, it returns 2.f * M_PI for a circle that is fully visible in the RoI, or the sum of the angles of the arc(s) that is(are) visible in the RoI.

Definition at line 947 of file vpImageCircle.cpp.

References vpException::fatalError, vpImagePoint::get_u(), vpImagePoint::get_v(), vpRect::getHeight(), vpRect::getTopLeft(), vpRect::getWidth(), vpRect::isInside(), and vpMath::modulo().

Referenced by computeArcLengthInRoI().

◆ computeArcLengthInRoI()

float vpImageCircle::computeArcLengthInRoI ( const vpRect & roi,
const float & roundingTolerance = 0.001f ) const

Compute the arc length, in terms of number of pixels, that is contained in the Region of Interest (RoI).

See also
computeAngularCoverageInRoI(), computeAngularCoverageInRoI(const vpRect &roi)
Parameters
[in]roiThe rectangular RoI in which we want to know the number of pixels of the circle that are contained.
[in]roundingToleranceThe tolerance on the angle when the angle is close to 2.f * M_PI_FLOAT .
Returns
The number of pixels of the circle that are contained in the RoI.
Examples
tutorial-circle-hough.cpp.

Definition at line 1057 of file vpImageCircle.cpp.

References computeAngularCoverageInRoI().

Referenced by vpCircleHoughTransform::computeCircleProbability().

◆ computePixelsInMask()

unsigned int vpImageCircle::computePixelsInMask ( const vpImage< bool > & mask) const

Count the number of pixels of the circle whose value in the mask is true.

Parameters
maskA mask where true indicates that a pixel must be taken into account and false that it must be ignored.
Returns
unsigned int The number of pixels in the mask.

Definition at line 1085 of file vpImageCircle.cpp.

References vpMath::equal(), vpImage< Type >::getHeight(), and vpImage< Type >::getWidth().

Referenced by vpCircleHoughTransform::computeCircleProbability().

◆ get_n02()

float vpImageCircle::get_n02 ( ) const

Compute the normalized moment $n_{02}$ of the image (2D) circle.

Returns
The normalized moment $n_{02}$.

Definition at line 1201 of file vpImageCircle.cpp.

◆ get_n11()

float vpImageCircle::get_n11 ( ) const

Compute the normalized moment $n_{11}$ of the image (2D) circle.

Returns
The normalized moment $n_{11}$.

Definition at line 1207 of file vpImageCircle.cpp.

◆ get_n20()

float vpImageCircle::get_n20 ( ) const

Compute the normalized moment $n_{20}$ of the image (2D) circle.

Returns
The normalized moment $n_{20}$.

Definition at line 1195 of file vpImageCircle.cpp.

◆ getBBox()

vpRect vpImageCircle::getBBox ( ) const

Compute the bounding box, in the image, of the image (2D) circle.

Returns
the 2D circle bounding box.

Definition at line 1188 of file vpImageCircle.cpp.

◆ getCenter()

vpImagePoint vpImageCircle::getCenter ( ) const

◆ getRadius()

float vpImageCircle::getRadius ( ) const

◆ isInside()

bool vpImageCircle::isInside ( const vpImagePoint & ip) const
inline

Returns true if the image point belongs to the circle and false otherwise.

Parameters
[in]ipThe image point that we are interested in.
Returns
true The image point belongs to the circle.
false Otherwise.

Definition at line 149 of file vpImageCircle.h.

References vpImagePoint::sqrDistance().