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;
360 const vpColor &color,
unsigned int thickness)
const
371 double x = cos(alpha) / one_over_rho;
372 double y = sin(alpha) / one_over_rho;
377 double x = cos(alpha) / tan(atan_one_over_rho);
378 double y = sin(alpha) / tan(atan_one_over_rho);
392 unsigned int thickness)
const
403 double x = cos(alpha) / one_over_rho;
404 double y = sin(alpha) / one_over_rho;
409 double x = cos(alpha) / tan(atan_one_over_rho);
410 double y = sin(alpha) / tan(atan_one_over_rho);
class that defines what is a visual feature
vpColVector s
State of the visual feature.
static const unsigned int FEATURE_LINE[32]
unsigned int nbParameters
Number of parameters needed to compute the interaction matrix.
unsigned int dim_s
Dimension of the visual feature.
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()
vpColVector error(const vpBasicFeature &s_star, unsigned int select=(selectX()|selectY()))
void set_y(double y)
Set vanishing point feature value.
void setAlpha(double alpha)
Set vanishing point feature value.
void display(const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1) const
vpFeatureVanishingPoint * duplicate() const
vpMatrix interaction(unsigned int select=(selectX()|selectY()))
double getOneOverRho() const
Get vanishing point feature value.
double getAlpha() const
Get vanishing point feature value.
void print(unsigned int select=(selectX()|selectY())) const
void setAtanOneOverRho(double atan_one_over_rho)
Set vanishing point feature value.
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()
double get_y() const
Get vanishing point feature value.
static unsigned int selectAlpha()
void buildFrom(double x, double y)
Set vanishing point visual feature from cartesian coordinates. Same as set_xy().
double get_x() const
Get vanishing point feature value.
vpFeatureVanishingPoint()
Default constructor that calls init().
static unsigned int selectY()
Select visual feature .
void set_x(double x)
Set vanishing point feature value.
Implementation of a matrix and operations on matrices.
void stack(const vpMatrix &A)