44 #include <visp3/core/vpException.h>
45 #include <visp3/visual_features/vpFeatureBuilder.h>
46 #include <visp3/visual_features/vpFeatureException.h>
105 double rho_l = L1.
getRho();
106 double rho_r = L2.getRho();
108 double theta_r = L2.getTheta();
109 double c_l = cos(theta_l);
110 double c_r = cos(theta_r);
111 double s_l = sin(theta_l);
112 double s_r = sin(theta_r);
115 if (fabs(theta_r - theta_l) < min || fabs(fabs(theta_r - theta_l) - M_PI) < min ||
116 fabs(fabs(theta_r - theta_l) - 2 * M_PI) < min) {
117 vpCERROR <<
"There is no vanishing point : the lines are parallel in the "
121 "There is no vanishing point : the lines are "
122 "parallel in the image plane"));
125 double y = (rho_r * c_l - rho_l * c_r) / (-s_l * c_r + s_r * c_l);
126 double x = (rho_r * s_l - rho_l * s_r) / (-c_l * s_r + c_r * s_l);
133 double rho_1 = L1.
getRho();
135 double rho_2 = L2.getRho();
136 double theta_2 = L2.getTheta();
138 double theta_diff = theta_1 - theta_2;
140 double denom = sqrt(rho_1 * rho_1 + rho_2 * rho_2 - 2 * rho_1 * rho_2 * cos(theta_diff));
141 double one_over_rho = sin(theta_diff) / denom;
142 double alpha = atan2(rho_1 * cos(theta_2) - rho_2 * cos(theta_1), rho_2 * sin(theta_1) - rho_1 * sin(theta_2));
200 double x1 = 0, y1 = 0;
201 double x2 = 0, y2 = 0;
207 double theta_1 = atan2(-(x1 - x2), y1 - y2);
208 double rho_1 = ((x1 + x2) * cos(theta_1) + (y1 + y2) * sin(theta_1)) / 2.;
214 double theta_2 = atan2(-(x1 - x2), y1 - y2);
215 double rho_2 = ((x1 + x2) * cos(theta_2) + (y1 + y2) * sin(theta_2)) / 2.;
219 double theta_diff = theta_1 - theta_2;
221 if (fabs(theta_diff) < min || fabs(fabs(theta_diff) - M_PI) < min || fabs(fabs(theta_diff) - 2 * M_PI) < min) {
223 "There is no vanishing point : the lines are parallel in the image plane"));
226 double x = (sin(theta_1) * rho_2 - sin(theta_2) * rho_1) / sin(theta_diff);
227 double y = (cos(theta_2) * rho_1 - cos(theta_1) * rho_2) / sin(theta_diff);
233 double theta_diff = theta_1 - theta_2;
234 double denom = sqrt(rho_1 * rho_1 + rho_2 * rho_2 - 2 * rho_1 * rho_2 * cos(theta_diff));
235 double one_over_rho = sin(theta_diff) / denom;
239 double alpha = atan2(rho_1 * cos(theta_2) - rho_2 * cos(theta_1), rho_2 * sin(theta_1) - rho_1 * sin(theta_2));
245 double theta_diff = theta_1 - theta_2;
246 double denom = sqrt(rho_1 * rho_1 + rho_2 * rho_2 - 2 * rho_1 * rho_2 * cos(theta_diff));
247 double alpha = atan2(rho_1 * cos(theta_2) - rho_2 * cos(theta_1), rho_2 * sin(theta_1) - rho_1 * sin(theta_2));
248 double one_over_rho = sin(theta_diff) / denom;
249 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 vpImagePoint &t)
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.