Visual Servoing Platform  version 3.6.1 under development (2024-10-10)
vpImageCircle Class Reference

#include <visp3/core/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
 

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]

BEGIN_VISP_NAMESPACE vpImageCircle::vpImageCircle ( )

Default constructor.

Definition at line 38 of file vpImageCircle.cpp.

◆ vpImageCircle() [2/2]

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

Constructor from a center and radius.

Definition at line 45 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 915 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 1025 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 1050 of file vpImageCircle.cpp.

References vpMath::equal(), vpImagePoint::get_u(), vpImagePoint::get_v(), 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 1164 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 1169 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 1159 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 1153 of file vpImageCircle.cpp.

◆ getCenter()

vpImagePoint vpImageCircle::getCenter ( ) const

Get the center of the image (2D) circle

Returns
The center of the image (2D) circle.
Examples
tutorial-circle-hough.cpp.

Definition at line 1143 of file vpImageCircle.cpp.

Referenced by vpDisplay::displayCircle(), vpImageDraw::drawCircle(), and vpCircleHoughTransform::mergeCandidates().

◆ getRadius()

float vpImageCircle::getRadius ( ) const

Get the radius of the image (2D) circle.

Returns
The radius of the image (2D) circle.
Examples
tutorial-circle-hough.cpp.

Definition at line 1148 of file vpImageCircle.cpp.

Referenced by vpDisplay::displayCircle(), vpImageDraw::drawCircle(), and vpCircleHoughTransform::mergeCandidates().