Visual Servoing Platform  version 3.6.1 under development (2023-11-16)
vpDetectorDNNOpenCV::DetectedFeatures2D Class Reference

#include <visp3/detection/vpDetectorDNNOpenCV.h>

Public Member Functions

 DetectedFeatures2D (double u_min, double u_max, double v_min, double v_max, unsigned int cls, double score, const std::optional< std::string > &classname)
 
vpRect getBoundingBox () const
 
double getConfidenceScore () const
 
unsigned int getClassId () const
 
std::optional< std::string > getClassName () const
 
template<typename Type >
void display (const vpImage< Type > &img, const vpColor &color=vpColor::blue, unsigned int thickness=1) const
 

Public Attributes

friend vpDetectorDNNOpenCV
 

Protected Attributes

vpRect m_bbox
 
double m_score
 
unsigned int m_cls
 
std::optional< std::string > m_classname
 

Detailed Description

Structure containing the bounding box, expressed in pixels, confidence and class information about an object detected in a image.

Examples
tutorial-dnn-object-detection-live.cpp.

Definition at line 112 of file vpDetectorDNNOpenCV.h.

Constructor & Destructor Documentation

◆ DetectedFeatures2D()

vpDetectorDNNOpenCV::DetectedFeatures2D::DetectedFeatures2D ( double  u_min,
double  u_max,
double  v_min,
double  v_max,
unsigned int  cls,
double  score,
const std::optional< std::string > &  classname 
)
inlineexplicit

Construct a new Detected Features 2 D object.

Parameters
u_minThe left coordinate of the bounding box, expressed in pixel.
u_maxThe right coordinate of the bounding box, expressed in pixel.
v_minThe top coordinate of the bounding box, expressed in pixel.
v_maxThe bottom coordinate of the bounding box, expressed in pixel.
clsThe class ID
scoreThe confidence in the detection.
classnameThe class name, if the class names were given to the vpDetectorDNNOpenCV::NetConfig used to configure the vpDetectorDNNOpenCV object.

Definition at line 131 of file vpDetectorDNNOpenCV.h.

Member Function Documentation

◆ display()

template<typename Type >
void vpDetectorDNNOpenCV::DetectedFeatures2D::display ( const vpImage< Type > &  img,
const vpColor color = vpColor::blue,
unsigned int  thickness = 1 
) const
inline

Display the bbox and score of the detected object in an image.

Parameters
[in]img: Image used as background.
[in]color: Color used to draw the CAD model.
[in]thickness: Thickness used to draw the CAD model.
Examples
tutorial-dnn-object-detection-live.cpp.

Definition at line 601 of file vpDetectorDNNOpenCV.h.

References vpDisplay::displayRectangle(), vpDisplay::displayText(), vpRect::getTopRight(), m_bbox, m_classname, m_cls, and m_score.

◆ getBoundingBox()

vpRect vpDetectorDNNOpenCV::DetectedFeatures2D::getBoundingBox ( ) const
inline

Return the bounding box of the detected object.

Examples
tutorial-dnn-object-detection-live.cpp.

Definition at line 151 of file vpDetectorDNNOpenCV.h.

Referenced by vpDetectorDNNOpenCV::filterDetectionMultiClassInput().

◆ getClassId()

unsigned int vpDetectorDNNOpenCV::DetectedFeatures2D::getClassId ( ) const
inline

Return the class ID of the detected object.

Examples
tutorial-dnn-object-detection-live.cpp.

Definition at line 159 of file vpDetectorDNNOpenCV.h.

Referenced by vpDetectorDNNOpenCV::filterDetectionMultiClassInput().

◆ getClassName()

std::optional<std::string> vpDetectorDNNOpenCV::DetectedFeatures2D::getClassName ( ) const
inline

Return the class name of the detected object.

Examples
tutorial-dnn-object-detection-live.cpp.

Definition at line 163 of file vpDetectorDNNOpenCV.h.

◆ getConfidenceScore()

double vpDetectorDNNOpenCV::DetectedFeatures2D::getConfidenceScore ( ) const
inline

Return the confidence score of the detected object, a value between 0 and 1.

Examples
tutorial-dnn-object-detection-live.cpp.

Definition at line 155 of file vpDetectorDNNOpenCV.h.

Member Data Documentation

◆ m_bbox

vpRect vpDetectorDNNOpenCV::DetectedFeatures2D::m_bbox
protected

The bounding box of the detected object.

Definition at line 115 of file vpDetectorDNNOpenCV.h.

Referenced by display().

◆ m_classname

std::optional<std::string> vpDetectorDNNOpenCV::DetectedFeatures2D::m_classname
protected

The class name, if the class names were given to the vpDetectorDNNOpenCV::NetConfig used to configure the vpDetectorDNNOpenCV object.

Definition at line 118 of file vpDetectorDNNOpenCV.h.

Referenced by display().

◆ m_cls

unsigned int vpDetectorDNNOpenCV::DetectedFeatures2D::m_cls
protected

The class ID.

Definition at line 117 of file vpDetectorDNNOpenCV.h.

Referenced by display().

◆ m_score

double vpDetectorDNNOpenCV::DetectedFeatures2D::m_score
protected

The confidence in the detection.

Definition at line 116 of file vpDetectorDNNOpenCV.h.

Referenced by display().

◆ vpDetectorDNNOpenCV

friend vpDetectorDNNOpenCV::DetectedFeatures2D::vpDetectorDNNOpenCV

Definition at line 168 of file vpDetectorDNNOpenCV.h.