43 #include <visp3/visual_features/vpBasicFeature.h>
44 #include <visp3/visual_features/vpFeatureVanishingPoint.h>
47 #include <visp3/core/vpException.h>
48 #include <visp3/visual_features/vpFeatureException.h>
51 #include <visp3/core/vpDebug.h>
54 #include <visp3/core/vpMath.h>
56 #include <visp3/core/vpFeatureDisplay.h>
121 s[3] = atan_one_over_rho;
159 if (
flags[i] ==
false) {
162 vpTRACE(
"Warning !!! The interaction matrix is computed but x was not set yet");
165 vpTRACE(
"Warning !!! The interaction matrix is computed but y was not set yet");
168 vpTRACE(
"Warning !!! The interaction matrix is computed but 1/rho was not set yet");
171 vpTRACE(
"Warning !!! The interaction matrix is computed but atan(1/rho) was not set yet");
174 vpTRACE(
"Warning !!! The interaction matrix is computed but alpha was not set yet");
177 vpTRACE(
"Problem during the reading of the variable flags");
194 Lx[0][4] = -(1 + x * x);
209 Ly[0][3] = 1 + y * y;
220 double rho2 = 1. + one_over_rho * one_over_rho;
222 Lone_over_rho[0][0] = 0.;
223 Lone_over_rho[0][1] = 0.;
224 Lone_over_rho[0][2] = 0.;
225 Lone_over_rho[0][3] = -rho2 * sin(alpha);
226 Lone_over_rho[0][4] = rho2 * cos(alpha);
227 Lone_over_rho[0][5] = 0.;
236 Latan_one_over_rho[0][0] = 0.;
237 Latan_one_over_rho[0][1] = 0.;
238 Latan_one_over_rho[0][2] = 0.;
239 Latan_one_over_rho[0][3] = -sin(alpha);
240 Latan_one_over_rho[0][4] = cos(alpha);
241 Latan_one_over_rho[0][5] = 0.;
254 Lalpha[0][3] = cos(alpha) * one_over_rho;
255 Lalpha[0][4] = sin(alpha) * one_over_rho;
281 ex[0] =
s[0] - s_star[0];
288 ey[0] =
s[1] - s_star[1];
294 e_one_over_rho[0] =
s[2] - s_star[2];
301 e_atan_one_over_rho[0] =
s[3] - s_star[3];
308 double err =
s[4] - s_star[4];
332 std::cout <<
"Vanishing point:";
334 std::cout <<
" x=" <<
get_x();
336 std::cout <<
" y=" <<
get_y();
344 std::cout <<
" alpha=" <<
getAlpha();
346 std::cout << std::endl;
365 const vpColor &color,
unsigned int thickness)
const
377 double x = cos(alpha) / one_over_rho;
378 double y = sin(alpha) / one_over_rho;
384 double x = cos(alpha) / tan(atan_one_over_rho);
385 double y = sin(alpha) / tan(atan_one_over_rho);
399 unsigned int thickness)
const
411 double x = cos(alpha) / one_over_rho;
412 double y = sin(alpha) / one_over_rho;
418 double x = cos(alpha) / tan(atan_one_over_rho);
419 double y = sin(alpha) / tan(atan_one_over_rho);
class that defines what is a visual feature
vpColVector s
State of the visual feature.
unsigned int nbParameters
Number of parameters needed to compute the interaction matrix.
unsigned int dim_s
Dimension of the visual feature.
static const unsigned int FEATURE_LINE[32]
vpBasicFeatureDeallocatorType deallocate
Generic class defining intrinsic camera parameters.
Implementation of column vector and the associated operations.
void resize(unsigned int i, bool flagNullify=true)
Class to define RGB colors available for display functionalities.
static void displayPoint(double x, double y, const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1)
static unsigned int selectAtanOneOverRho()
vpFeatureVanishingPoint * duplicate() const VP_OVERRIDE
void set_y(double y)
Set vanishing point feature value.
void setAlpha(double alpha)
Set vanishing point feature value.
double getOneOverRho() const
Get vanishing point feature value.
double getAlpha() const
Get vanishing point feature value.
void setAtanOneOverRho(double atan_one_over_rho)
Set vanishing point feature value.
vpColVector error(const vpBasicFeature &s_star, unsigned int select=(vpFeatureVanishingPoint::selectX()|vpFeatureVanishingPoint::selectY())) VP_OVERRIDE
void setOneOverRho(double one_over_rho)
Set vanishing point feature value.
double getAtanOneOverRho() const
Get vanishing point feature value.
void set_xy(double x, double y)
Set vanishing point visual feature from cartesian coordinates. Same as buildFrom().
static unsigned int selectX()
Select visual feature .
static unsigned int selectOneOverRho()
vpFeatureVanishingPoint & buildFrom(const double &x, const double &y)
Set vanishing point visual feature from cartesian coordinates. Same as set_xy().
double get_y() const
Get vanishing point feature value.
void display(const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1) const VP_OVERRIDE
static unsigned int selectAlpha()
vpMatrix interaction(unsigned int select=(vpFeatureVanishingPoint::selectX()|vpFeatureVanishingPoint::selectY())) VP_OVERRIDE
double get_x() const
Get vanishing point feature value.
vpFeatureVanishingPoint()
Default constructor that calls init().
static unsigned int selectY()
Select visual feature .
void print(unsigned int select=(vpFeatureVanishingPoint::selectX()|vpFeatureVanishingPoint::selectY())) const VP_OVERRIDE
void set_x(double x)
Set vanishing point feature value.
Implementation of a matrix and operations on matrices.
void stack(const vpMatrix &A)