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> 120 s[3] = atan_one_over_rho;
158 if (
flags[i] ==
false) {
161 vpTRACE(
"Warning !!! The interaction matrix is computed but x was not set yet");
164 vpTRACE(
"Warning !!! The interaction matrix is computed but y was not set yet");
167 vpTRACE(
"Warning !!! The interaction matrix is computed but 1/rho was not set yet");
170 vpTRACE(
"Warning !!! The interaction matrix is computed but atan(1/rho) was not set yet");
173 vpTRACE(
"Warning !!! The interaction matrix is computed but alpha was not set yet");
176 vpTRACE(
"Problem during the reading of the variable flags");
193 Lx[0][4] = -(1 + x * x);
208 Ly[0][3] = 1 + y * y;
219 double rho2 = 1. + one_over_rho * one_over_rho;
221 Lone_over_rho[0][0] = 0.;
222 Lone_over_rho[0][1] = 0.;
223 Lone_over_rho[0][2] = 0.;
224 Lone_over_rho[0][3] = - rho2 * sin(alpha);
225 Lone_over_rho[0][4] = rho2 * cos(alpha);
226 Lone_over_rho[0][5] = 0.;
235 Latan_one_over_rho[0][0] = 0.;
236 Latan_one_over_rho[0][1] = 0.;
237 Latan_one_over_rho[0][2] = 0.;
238 Latan_one_over_rho[0][3] = - sin(alpha);
239 Latan_one_over_rho[0][4] = cos(alpha);
240 Latan_one_over_rho[0][5] = 0.;
253 Lalpha[0][3] = cos(alpha) * one_over_rho;
254 Lalpha[0][4] = sin(alpha) * one_over_rho;
280 ex[0] =
s[0] - s_star[0];
287 ey[0] =
s[1] - s_star[1];
293 e_one_over_rho[0] =
s[2] - s_star[2];
300 e_atan_one_over_rho[0] =
s[3] - s_star[3];
307 double err =
s[4] - s_star[4];
331 std::cout <<
"Vanishing point:";
333 std::cout <<
" x=" <<
get_x();
335 std::cout <<
" y=" <<
get_y();
343 std::cout <<
" alpha=" <<
getAlpha();
345 std::cout << std::endl;
364 const vpColor &color,
unsigned int thickness)
const 376 double x = cos(alpha) / one_over_rho;
377 double y = sin(alpha) / one_over_rho;
383 double x = cos(alpha) / tan(atan_one_over_rho);
384 double y = sin(alpha) / tan(atan_one_over_rho);
398 unsigned int thickness)
const 410 double x = cos(alpha) / one_over_rho;
411 double y = sin(alpha) / one_over_rho;
417 double x = cos(alpha) / tan(atan_one_over_rho);
418 double y = sin(alpha) / tan(atan_one_over_rho);
Implementation of a matrix and operations on matrices.
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true, bool recopy_=true)
double getAtanOneOverRho() const
Get vanishing point feature value.
static unsigned int selectAtanOneOverRho()
Class to define RGB colors available for display functionnalities.
void stack(const vpMatrix &A)
unsigned int dim_s
Dimension of the visual feature.
double getOneOverRho() const
Get vanishing point feature value.
vpColVector error(const vpBasicFeature &s_star, unsigned int select=(selectX()|selectY()))
vpMatrix interaction(unsigned int select=(selectX()|selectY()))
void print(unsigned int select=(selectX()|selectY())) const
void set_xy(double x, double y)
Set vanishing point visual feature from cartesian coordinates. Same as buildFrom().
static void displayPoint(double x, double y, const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1)
class that defines what is a visual feature
static unsigned int selectX()
Select visual feature .
void buildFrom(double x, double y)
Set vanishing point visual feature from cartesian coordinates. Same as set_xy(). ...
double get_y() const
Get vanishing point feature value.
static unsigned int selectY()
Select visual feature .
Generic class defining intrinsic camera parameters.
void setAtanOneOverRho(double atan_one_over_rho)
Set vanishing point feature value.
vpFeatureVanishingPoint()
Default constructor that calls init().
void display(const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1) const
static unsigned int selectOneOverRho()
vpFeatureVanishingPoint * duplicate() const
static const unsigned int FEATURE_LINE[32]
void setAlpha(double alpha)
Set vanishing point feature value.
double getAlpha() const
Get vanishing point feature value.
void resize(unsigned int i, bool flagNullify=true)
vpBasicFeatureDeallocatorType deallocate
Implementation of column vector and the associated operations.
double get_x() const
Get vanishing point feature value.
void set_y(double y)
Set vanishing point feature value.
static unsigned int selectAlpha()
void set_x(double x)
Set vanishing point feature value.
unsigned int nbParameters
Number of parameters needed to compute the interaction matrix.
vpColVector s
State of the visual feature.
void setOneOverRho(double one_over_rho)
Set vanishing point feature value.