Visual Servoing Platform  version 3.3.0
vpFeatureVanishingPoint Class Reference

#include <vpFeatureVanishingPoint.h>

+ Inheritance diagram for vpFeatureVanishingPoint:

Public Types

enum  { FEATURE_ALL = 0xffff }
 
enum  vpBasicFeatureDeallocatorType { user, vpServo }
 

Public Member Functions

 vpFeatureVanishingPoint ()
 
virtual ~vpFeatureVanishingPoint ()
 
void buildFrom (double x, double y)
 
void display (const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1) const
 
void display (const vpCameraParameters &cam, const vpImage< vpRGBa > &I, const vpColor &color=vpColor::green, unsigned int thickness=1) const
 
vpFeatureVanishingPointduplicate () const
 
vpColVector error (const vpBasicFeature &s_star, unsigned int select=(selectX()|selectY()))
 
double get_x () const
 
double get_y () const
 
double getAtanOneOverRho () const
 
double getOneOverRho () const
 
double getAlpha () const
 
void init ()
 
vpMatrix interaction (unsigned int select=(selectX()|selectY()))
 
void print (unsigned int select=(selectX()|selectY())) const
 
void set_x (double x)
 
void set_y (double y)
 
void set_xy (double x, double y)
 
void setAtanOneOverRho (double atan_one_over_rho)
 
void setOneOverRho (double one_over_rho)
 
void setAlpha (double alpha)
 

Static Public Member Functions

static unsigned int selectAlpha ()
 
static unsigned int selectAtanOneOverRho ()
 
static unsigned int selectOneOverRho ()
 
static unsigned int selectX ()
 
static unsigned int selectY ()
 

Static Public Attributes

static const unsigned int FEATURE_LINE [32]
 

Protected Attributes

unsigned int m_select
 
vpColVector s
 
unsigned int dim_s
 
bool * flags
 
unsigned int nbParameters
 

Inherited functionalities from vpBasicFeature

vpBasicFeatureDeallocatorType deallocate
 
static unsigned int selectAll ()
 
unsigned int dimension_s ()
 
vpColVector get_s (unsigned int select=FEATURE_ALL) const
 
vpBasicFeatureDeallocatorType getDeallocate ()
 
unsigned int getDimension (unsigned int select=FEATURE_ALL) const
 
virtual double operator[] (unsigned int i) const
 
void setDeallocate (vpBasicFeatureDeallocatorType d)
 
void setFlags ()
 
void resetFlags ()
 

Detailed Description

Class that defines 2D vanishing point visual features. Various features can be considered:

  • Either the cartesian coordinates $ (x, y) $ of the vanishing point obtained from the intersection of two lines; in that case $ {\bf s} = (x, y) $ and the corresponding interaction matrices are:

    \[ L_x = \left[ \begin{array}{cccccc} 0 & 0 & 0 & x y & -(1 + x^2) & y \end{array} \right] \]

    \[ L_y = \left[ \begin{array}{cccccc} 0 & 0 & 0 & 1 + y * y & -xy & -x \end{array} \right] \]

  • Rather features fonction of the polar coordinates of the vanishing point obtained themselves from the polar coordinates of the two lines $(\rho_1, \theta_1)$ and $(\rho_2, \theta_2)$; in that case $ {\bf s} = (\arctan(1/\rho), 1/\rho, \alpha) $ with:

    \[ 1/\rho = \frac{\sin(\theta_1 - \theta_2)}{\sqrt{\rho_1^2 + \rho_2^2 - 2 \rho_1 \rho_2 cos(\theta_1 - \theta_2)}} \]

    \[ \alpha = \frac{\rho_1 \cos \theta_2 - \rho_2 cos \theta_1}{\sqrt{\rho_1^2 + \rho_2^2 - 2 \rho_1 \rho_2 cos(\theta_1 - \theta_2)}} \]

    The corresponding interaction matrices are:

    \[ L_{\arctan(\frac{1}{\rho})} = \left[ \begin{array}{cccccc} 0 & 0 & 0 & - \sin \alpha & \cos \alpha & 0 \end{array} \right] \]

    \[ L_{\frac{1}{\rho}} = \left[ \begin{array}{cccccc} 0 & 0 & 0 & -(1 + \frac{1}{\rho^2}) \sin \alpha & (1 + \frac{1}{\rho^2}) \cos \alpha & 0 \end{array} \right] \]

    \[ L_{\alpha} = \left[ \begin{array}{cccccc} 0 & 0 & 0 & \frac{\cos \alpha}{\rho} & \frac{\sin \alpha}{\rho} & -1 \end{array} \right] \]

Examples
servoBebop2.cpp.

Definition at line 74 of file vpFeatureVanishingPoint.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
inherited
Enumerator
FEATURE_ALL 

Definition at line 81 of file vpBasicFeature.h.

◆ vpBasicFeatureDeallocatorType

Indicates who should deallocate the feature.

Enumerator
user 
vpServo 

Definition at line 87 of file vpBasicFeature.h.

Constructor & Destructor Documentation

◆ vpFeatureVanishingPoint()

vpFeatureVanishingPoint::vpFeatureVanishingPoint ( )

Default constructor that calls init().

Definition at line 76 of file vpFeatureVanishingPoint.cpp.

◆ ~vpFeatureVanishingPoint()

virtual vpFeatureVanishingPoint::~vpFeatureVanishingPoint ( )
inlinevirtual

Destructor.

Definition at line 86 of file vpFeatureVanishingPoint.h.

Member Function Documentation

◆ buildFrom()

void vpFeatureVanishingPoint::buildFrom ( double  x,
double  y 
)

Set vanishing point visual feature $ {\bf s} = (x, y) $ from cartesian coordinates. Same as set_xy().

Definition at line 349 of file vpFeatureVanishingPoint.cpp.

◆ dimension_s()

unsigned int vpBasicFeature::dimension_s ( )
inlineinherited

Return the dimension of the feature vector $\bf s$.

Definition at line 109 of file vpBasicFeature.h.

◆ display() [1/2]

void vpFeatureVanishingPoint::display ( const vpCameraParameters cam,
const vpImage< unsigned char > &  I,
const vpColor color = vpColor::green,
unsigned int  thickness = 1 
) const
virtual

Display vanishing point feature.

Parameters
cam: Camera parameters.
I: Image.
color: Color to use for the display.
thickness: Thickness of the feature representation.

Implements vpBasicFeature.

Definition at line 362 of file vpFeatureVanishingPoint.cpp.

◆ display() [2/2]

void vpFeatureVanishingPoint::display ( const vpCameraParameters cam,
const vpImage< vpRGBa > &  I,
const vpColor color = vpColor::green,
unsigned int  thickness = 1 
) const
virtual

Display vanishing point feature.

Parameters
cam: Camera parameters.
I: color Image.
color: Color to use for the display.
thickness: Thickness of the feature representation.

Implements vpBasicFeature.

Definition at line 396 of file vpFeatureVanishingPoint.cpp.

◆ duplicate()

vpFeatureVanishingPoint * vpFeatureVanishingPoint::duplicate ( ) const
virtual

Duplicate visual feature (used by the vpServo class only).

Implements vpBasicFeature.

Definition at line 425 of file vpFeatureVanishingPoint.cpp.

◆ error()

vpColVector vpFeatureVanishingPoint::error ( const vpBasicFeature s_star,
unsigned int  select = (selectX() | selectY()) 
)
virtual

Compute the error between two visual features from a subset of the possible features.

Parameters
s_star: Desired visual feature $ {\bf s}^* $.
select: Feature selector. Value is either selectX() to select x visual feature, selectY() for y visual feature, selectOneOverRho() for $ 1/\rho $, or selectAlpha() for $ \alpha $ visual feature. You can also use a combination like selectX() | selectY() to select x and y visual features.

Reimplemented from vpBasicFeature.

Definition at line 273 of file vpFeatureVanishingPoint.cpp.

◆ get_s()

vpColVector vpBasicFeature::get_s ( unsigned int  select = FEATURE_ALL) const
inherited

Get the feature vector $\bf s$.

Examples
servoAfma6Ellipse2DCamVelocity.cpp.

Definition at line 113 of file vpBasicFeature.cpp.

◆ get_x()

double vpFeatureVanishingPoint::get_x ( ) const

Get vanishing point feature $ x $ value.

Definition at line 87 of file vpFeatureVanishingPoint.cpp.

◆ get_y()

double vpFeatureVanishingPoint::get_y ( ) const

Get vanishing point feature $ y $ value.

Definition at line 98 of file vpFeatureVanishingPoint.cpp.

◆ getAlpha()

double vpFeatureVanishingPoint::getAlpha ( ) const

Get vanishing point feature $ \alpha $ value.

Definition at line 139 of file vpFeatureVanishingPoint.cpp.

◆ getAtanOneOverRho()

double vpFeatureVanishingPoint::getAtanOneOverRho ( ) const

Get vanishing point feature $ \arctan(1/\rho) $ value.

Definition at line 128 of file vpFeatureVanishingPoint.cpp.

◆ getDeallocate()

vpBasicFeatureDeallocatorType vpBasicFeature::getDeallocate ( )
inlineinherited

Definition at line 122 of file vpBasicFeature.h.

◆ getDimension()

unsigned int vpBasicFeature::getDimension ( unsigned int  select = FEATURE_ALL) const
inherited

Get the feature vector dimension.

Definition at line 99 of file vpBasicFeature.cpp.

◆ getOneOverRho()

double vpFeatureVanishingPoint::getOneOverRho ( ) const

Get vanishing point feature $ 1/\rho $ value.

Definition at line 125 of file vpFeatureVanishingPoint.cpp.

◆ init()

void vpFeatureVanishingPoint::init ( void  )
virtual

Vanishing point visual feature initialization.

Implements vpBasicFeature.

Definition at line 60 of file vpFeatureVanishingPoint.cpp.

◆ interaction()

vpMatrix vpFeatureVanishingPoint::interaction ( unsigned int  select = (selectX() | selectY()))
virtual

Compute the interaction matrix from a subset of the possible features.

Parameters
select: Feature selector. Value is either selectX() to select x visual feature, selectY() for y visual feature, selectOneOverRho() for $ 1/\rho $, or selectAlpha() for $ \alpha $ visual feature. You can also use a combination like selectX() | selectY() to select x and y visual features.

Implements vpBasicFeature.

Definition at line 149 of file vpFeatureVanishingPoint.cpp.

◆ operator[]()

virtual double vpBasicFeature::operator[] ( unsigned int  i) const
inlinevirtualinherited

Return element i in the state vector (usage : x = s[i] )

Definition at line 129 of file vpBasicFeature.h.

◆ print()

void vpFeatureVanishingPoint::print ( unsigned int  select = (selectX() | selectY())) const
virtual

Print vanishing point features values to stdout.

Parameters
select: Use either selectX() to display x value, selectY() to display y value, select selectOneOverRho() to display $ 1/\rho $ value, or selectAlpha() to display $ \alpha $ value. You can also use a combination like selectX() | selectY() to display x and y values.

Implements vpBasicFeature.

Definition at line 328 of file vpFeatureVanishingPoint.cpp.

◆ resetFlags()

void vpBasicFeature::resetFlags ( )
protectedinherited

Definition at line 130 of file vpBasicFeature.cpp.

References vpBasicFeature::flags, and vpBasicFeature::nbParameters.

◆ selectAll()

static unsigned int vpBasicFeature::selectAll ( )
inlinestaticinherited

Select all the features.

Definition at line 141 of file vpBasicFeature.h.

◆ selectAlpha()

unsigned int vpFeatureVanishingPoint::selectAlpha ( )
static

Select $ s = \theta $ visual feature.

Definition at line 450 of file vpFeatureVanishingPoint.cpp.

◆ selectAtanOneOverRho()

unsigned int vpFeatureVanishingPoint::selectAtanOneOverRho ( )
static

Select visual feature $ s = \arctan(1/\rho) $.

Examples
servoBebop2.cpp.

Definition at line 445 of file vpFeatureVanishingPoint.cpp.

◆ selectOneOverRho()

unsigned int vpFeatureVanishingPoint::selectOneOverRho ( )
static

Select visual feature $ s = 1/\rho $.

Definition at line 440 of file vpFeatureVanishingPoint.cpp.

◆ selectX()

unsigned int vpFeatureVanishingPoint::selectX ( )
static

Select visual feature $ s = x $.

Definition at line 432 of file vpFeatureVanishingPoint.cpp.

◆ selectY()

unsigned int vpFeatureVanishingPoint::selectY ( )
static

Select visual feature $ s = y $.

Definition at line 435 of file vpFeatureVanishingPoint.cpp.

◆ set_x()

void vpFeatureVanishingPoint::set_x ( double  x)

Set vanishing point feature $ x $ value.

Definition at line 79 of file vpFeatureVanishingPoint.cpp.

◆ set_xy()

void vpFeatureVanishingPoint::set_xy ( double  x,
double  y 
)

Set vanishing point visual feature $ {\bf s} = (x, y) $ from cartesian coordinates. Same as buildFrom().

Definition at line 101 of file vpFeatureVanishingPoint.cpp.

◆ set_y()

void vpFeatureVanishingPoint::set_y ( double  y)

Set vanishing point feature $ y $ value.

Definition at line 90 of file vpFeatureVanishingPoint.cpp.

◆ setAlpha()

void vpFeatureVanishingPoint::setAlpha ( double  alpha)

Set vanishing point feature $ \alpha $ value.

Examples
servoBebop2.cpp.

Definition at line 131 of file vpFeatureVanishingPoint.cpp.

◆ setAtanOneOverRho()

void vpFeatureVanishingPoint::setAtanOneOverRho ( double  atan_one_over_rho)

Set vanishing point feature $ \arctan(1/\rho) $ value.

Examples
servoBebop2.cpp.

Definition at line 117 of file vpFeatureVanishingPoint.cpp.

◆ setDeallocate()

void vpBasicFeature::setDeallocate ( vpBasicFeatureDeallocatorType  d)
inlineinherited

Definition at line 136 of file vpBasicFeature.h.

◆ setFlags()

void vpBasicFeature::setFlags ( )
inherited

Set feature flags to true to prevent warning when re-computing the interaction matrix without having updated the feature.

Definition at line 140 of file vpBasicFeature.cpp.

◆ setOneOverRho()

void vpFeatureVanishingPoint::setOneOverRho ( double  one_over_rho)

Set vanishing point feature $ 1/\rho $ value.

Definition at line 109 of file vpFeatureVanishingPoint.cpp.

Member Data Documentation

◆ deallocate

vpBasicFeatureDeallocatorType vpBasicFeature::deallocate
protectedinherited

Definition at line 147 of file vpBasicFeature.h.

◆ dim_s

unsigned int vpBasicFeature::dim_s
protectedinherited

Dimension of the visual feature.

Definition at line 93 of file vpBasicFeature.h.

Referenced by vpGenericFeature::duplicate(), vpFeatureEllipse::init(), and vpFeatureLuminance::init().

◆ FEATURE_LINE

const unsigned int vpBasicFeature::FEATURE_LINE
staticinherited
Initial value:
= {
(unsigned int)(1 << 0), (unsigned int)(1 << 1), (unsigned int)(1 << 2), (unsigned int)(1 << 3),
(unsigned int)(1 << 4), (unsigned int)(1 << 5), (unsigned int)(1 << 6), (unsigned int)(1 << 7),
(unsigned int)(1 << 8), (unsigned int)(1 << 9), (unsigned int)(1 << 10), (unsigned int)(1 << 11),
(unsigned int)(1 << 12), (unsigned int)(1 << 13), (unsigned int)(1 << 14), (unsigned int)(1 << 15),
(unsigned int)(1 << 16), (unsigned int)(1 << 17), (unsigned int)(1 << 18), (unsigned int)(1 << 19),
(unsigned int)(1 << 20), (unsigned int)(1 << 21), (unsigned int)(1 << 22), (unsigned int)(1 << 23),
(unsigned int)(1 << 24), (unsigned int)(1 << 25), (unsigned int)(1 << 26), (unsigned int)(1 << 27),
(unsigned int)(1 << 28), (unsigned int)(1 << 29), (unsigned int)(1 << 30), (unsigned int)(1 << 31)}

Definition at line 79 of file vpBasicFeature.h.

Referenced by vpFeatureEllipse::selectMu02(), vpFeatureEllipse::selectMu11(), vpFeatureEllipse::selectMu20(), and vpFeatureEllipse::selectY().

◆ flags

bool* vpBasicFeature::flags
protectedinherited

◆ m_select

unsigned int vpFeatureVanishingPoint::m_select
protected

Definition at line 118 of file vpFeatureVanishingPoint.h.

◆ nbParameters

unsigned int vpBasicFeature::nbParameters
protectedinherited

Number of parameters needed to compute the interaction matrix.

Definition at line 99 of file vpBasicFeature.h.

Referenced by vpFeatureEllipse::buildFrom(), vpFeatureEllipse::init(), vpBasicFeature::resetFlags(), and vpFeatureEllipse::setABC().

◆ s