44 #include <visp3/core/vpException.h>
45 #include <visp3/visual_features/vpFeatureBuilder.h>
46 #include <visp3/visual_features/vpFeatureException.h>
103 double rho_l = L1.
getRho();
104 double rho_r = L2.getRho();
106 double theta_r = L2.getTheta();
107 double c_l = cos(theta_l);
108 double c_r = cos(theta_r);
109 double s_l = sin(theta_l);
110 double s_r = sin(theta_r);
113 if (fabs(theta_r - theta_l) < min || fabs(fabs(theta_r - theta_l) - M_PI) < min ||
114 fabs(fabs(theta_r - theta_l) - 2 * M_PI) < min) {
115 vpCERROR <<
"There is no vanishing point : the lines are parallel in the "
119 "There is no vanishing point : the lines are "
120 "parallel in the image plane"));
123 double y = (rho_r * c_l - rho_l * c_r) / (-s_l * c_r + s_r * c_l);
124 double x = (rho_r * s_l - rho_l * s_r) / (-c_l * s_r + c_r * s_l);
130 double rho_1 = L1.
getRho();
132 double rho_2 = L2.getRho();
133 double theta_2 = L2.getTheta();
135 double theta_diff = theta_1 - theta_2;
137 double denom = sqrt(rho_1 * rho_1 + rho_2 * rho_2 - 2 * rho_1 * rho_2 * cos(theta_diff));
138 double one_over_rho = sin(theta_diff) / denom;
139 double alpha = atan2(rho_1 * cos(theta_2) - rho_2 * cos(theta_1), rho_2 * sin(theta_1) - rho_1 * sin(theta_2));
197 double x1 = 0, y1 = 0;
198 double x2 = 0, y2 = 0;
204 double theta_1 = atan2(-(x1 - x2), y1 - y2);
205 double rho_1 = ((x1 + x2) * cos(theta_1) + (y1 + y2) * sin(theta_1)) / 2.;
211 double theta_2 = atan2(-(x1 - x2), y1 - y2);
212 double rho_2 = ((x1 + x2) * cos(theta_2) + (y1 + y2) * sin(theta_2)) / 2.;
216 double theta_diff = theta_1 - theta_2;
218 if (fabs(theta_diff) < min || fabs(fabs(theta_diff) - M_PI) < min || fabs(fabs(theta_diff) - 2 * M_PI) < min) {
220 "There is no vanishing point : the lines are parallel in the image plane"));
223 double x = (sin(theta_1) * rho_2 - sin(theta_2) * rho_1) / sin(theta_diff);
224 double y = (cos(theta_2) * rho_1 - cos(theta_1) * rho_2) / sin(theta_diff);
229 double theta_diff = theta_1 - theta_2;
230 double denom = sqrt(rho_1 * rho_1 + rho_2 * rho_2 - 2 * rho_1 * rho_2 * cos(theta_diff));
231 double one_over_rho = sin(theta_diff) / denom;
235 double alpha = atan2(rho_1 * cos(theta_2) - rho_2 * cos(theta_1), rho_2 * sin(theta_1) - rho_1 * sin(theta_2));
240 double theta_diff = theta_1 - theta_2;
241 double denom = sqrt(rho_1 * rho_1 + rho_2 * rho_2 - 2 * rho_1 * rho_2 * cos(theta_diff));
242 double alpha = atan2(rho_1 * cos(theta_2) - rho_2 * cos(theta_1), rho_2 * sin(theta_1) - rho_1 * sin(theta_2));
243 double one_over_rho = sin(theta_diff) / denom;
244 double atan_one_over_rho = atan2(sin(theta_diff), denom);
Generic class defining intrinsic camera parameters.
error that can be emitted by ViSP classes.
static void create(vpFeaturePoint &s, const vpCameraParameters &cam, const vpDot &d)
Error that can be emitted by the vpBasicFeature class and its derivates.
@ badInitializationError
Wrong feature initialization.
Class that defines a 2D line visual feature which is composed by two parameters that are and ,...
static unsigned int selectAtanOneOverRho()
void set_y(double y)
Set vanishing point feature value.
void setAlpha(double alpha)
Set vanishing point feature value.
void setAtanOneOverRho(double atan_one_over_rho)
Set vanishing point feature value.
void setOneOverRho(double one_over_rho)
Set vanishing point feature value.
static unsigned int selectX()
Select visual feature .
static unsigned int selectOneOverRho()
static unsigned int selectAlpha()
static unsigned int selectY()
Select visual feature .
void set_x(double x)
Set vanishing point feature value.
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Class that defines a 3D line in the object frame and allows forward projection of the line in the cam...
static void convertPoint(const vpCameraParameters &cam, const double &u, const double &v, double &x, double &y)
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
double get_y() const
Get the point y coordinate in the image plane.
double get_x() const
Get the point x coordinate in the image plane.