43 #include <visp3/core/vpConfig.h> 52 #include <visp3/core/vpMeterPixelConversion.h> 53 #include <visp3/core/vpPixelMeterConversion.h> 54 #include <visp3/core/vpPlane.h> 55 #include <visp3/mbt/vpMbtDistanceCylinder.h> 56 #include <visp3/visual_features/vpFeatureBuilder.h> 57 #include <visp3/visual_features/vpFeatureEllipse.h> 59 #include <visp3/vision/vpPose.h> 65 : name(), index(0), cam(), me(NULL), wmean1(1), wmean2(1), featureline1(), featureline2(), isTrackedCylinder(true),
66 meline1(NULL), meline2(NULL), cercle1(NULL), cercle2(NULL), radius(0), p1(NULL), p2(NULL), L(), error(),
67 nbFeature(0), nbFeaturel1(0), nbFeaturel2(0), Reinit(false), c(NULL), hiddenface(NULL), index_polygon(-1),
226 double i11, i12, i21, i22, j11, j12, j21, j22;
272 while (theta1 > M_PI) {
275 while (theta1 < -M_PI) {
279 if (theta1 < -M_PI / 2.0)
280 theta1 = -theta1 - 3 * M_PI / 2.0;
282 theta1 = M_PI / 2.0 - theta1;
284 while (theta2 > M_PI) {
287 while (theta2 < -M_PI) {
291 if (theta2 < -M_PI / 2.0)
292 theta2 = -theta2 - 3 * M_PI / 2.0;
294 theta2 = M_PI / 2.0 - theta2;
297 meline1->initTracking(I, ip11, ip12, rho1, theta1);
303 meline2->initTracking(I, ip21, ip22, rho2, theta2);
364 std::cout <<
"Probleme projection cercle 1\n";
369 std::cout <<
"Probleme projection cercle 2\n";
382 double i11, i12, i21, i22, j11, j12, j21, j22;
430 while (theta1 > M_PI) {
433 while (theta1 < -M_PI) {
437 if (theta1 < -M_PI / 2.0)
438 theta1 = -theta1 - 3 * M_PI / 2.0;
440 theta1 = M_PI / 2.0 - theta1;
442 while (theta2 > M_PI) {
445 while (theta2 < -M_PI) {
449 if (theta2 < -M_PI / 2.0)
450 theta2 = -theta2 - 3 * M_PI / 2.0;
452 theta2 = M_PI / 2.0 - theta2;
456 meline1->updateParameters(I, ip11, ip12, rho1, theta1);
462 meline2->updateParameters(I, ip21, ip22, rho2, theta2);
511 const bool displayFullModel)
513 if ((
isvisible && isTrackedCylinder) || displayFullModel) {
526 std::cout <<
"Problem projection circle 1";
531 std::cout <<
"Problem projection circle 2";
543 double i11, i12, i21, i22, j11, j12, j21, j22;
576 const bool displayFullModel)
578 if ((
isvisible && isTrackedCylinder) || displayFullModel) {
591 std::cout <<
"Problem projection circle 1";
596 std::cout <<
"Problem projection circle 2";
608 double i11, i12, i21, i22, j11, j12, j21, j22;
687 std::cout <<
"Problem projection circle 1\n";
692 std::cout <<
"Problem projection circle 2\n";
704 double rho1 = featureline1.
getRho();
705 double theta1 = featureline1.
getTheta();
706 double rho2 = featureline2.
getRho();
707 double theta2 = featureline2.
getTheta();
709 double co1 = cos(theta1);
710 double si1 = sin(theta1);
711 double co2 = cos(theta2);
712 double si2 = sin(theta2);
714 double mx = 1.0 / cam.
get_px();
715 double my = 1.0 / cam.
get_py();
726 for (std::list<vpMeSite>::const_iterator it =
meline1->getMeList().begin(); it !=
meline1->getMeList().end();
728 double x = (double)it->
j;
729 double y = (
double)it->i;
734 double alpha1 = x * si1 - y * co1;
736 double *Lrho = H1[0];
737 double *Ltheta = H1[1];
739 for (
unsigned int k = 0; k < 6; k++) {
740 L[j][k] = (Lrho[k] + alpha1 * Ltheta[k]);
742 error[j] = rho1 - (x * co1 + y * si1);
750 for (std::list<vpMeSite>::const_iterator it =
meline2->getMeList().begin(); it !=
meline2->getMeList().end();
752 double x = (double)it->j;
753 double y = (
double)it->i;
758 double alpha2 = x * si2 - y * co2;
760 double *Lrho = H2[0];
761 double *Ltheta = H2[1];
763 for (
unsigned int k = 0; k < 6; k++) {
764 L[j][k] = (Lrho[k] + alpha2 * Ltheta[k]);
766 error[j] = rho2 - (x * co2 + y * si2);
void setMovingEdge(vpMe *Me)
Implementation of a matrix and operations on matrices.
void displayMovingEdges(const vpImage< unsigned char > &I)
void updateMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
vpCylinder * c
The cylinder.
void projection(const vpColVector &_cP, vpColVector &_p)
double get_oY() const
Get the point Y coordinate in the object frame.
void trackMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
void changeFrame(const vpHomogeneousMatrix &cMo, vpColVector &cP)
perspective projection of the circle
bool isvisible
Indicates if the cylinder is visible or not.
Implementation of an homogeneous matrix and operations on such kind of matrices.
Performs search in a given direction(normal) for a given distance(pixels) for a given 'site'...
void resize(const unsigned int nrows, const unsigned int ncols, const bool flagNullify=true, const bool recopy_=true)
Class to define colors available for display functionnalities.
unsigned int nbFeature
The number of moving edges.
vpPoint * p1
The first extremity on the axe.
void initInteractionMatrixError()
static void flush(const vpImage< unsigned char > &I)
double get_oX() const
Get the point X coordinate in the object frame.
void changeFrame(const vpHomogeneousMatrix &cMo, vpColVector &cP)
Class that defines what is a point.
vpMatrix L
The interaction matrix.
static const vpColor orange
unsigned int nbFeaturel1
The number of moving edges on line 1.
vpCircle * cercle2
The lower circle limiting the cylinder.
void reinitMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
static void computeIntersectionPoint(const vpCircle &circle, const vpCameraParameters &cam, const double &rho, const double &theta, double &i, double &j)
Generic class defining intrinsic camera parameters.
double get_oZ() const
Get the point Z coordinate in the object frame.
bool initMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
vpMbtMeLine * meline1
The moving edge containers (first line of the cylinder)
vpMatrix interaction(const unsigned int select=FEATURE_ALL)
static void convertLine(const vpCameraParameters &cam, const double &rho_m, const double &theta_m, double &rho_p, double &theta_p)
Line coordinates conversion (rho,theta).
vpPoint * p2
The second extremity on the axe.
static void displayCross(const vpImage< unsigned char > &I, const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness=1)
Class that defines what is a cylinder.
void buildFrom(const vpPoint &_p1, const vpPoint &_p2, const double r)
Implementation of column vector and the associated operations.
void display(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor &col, const unsigned int thickness=1, const bool displayFullModel=false)
vpColVector error
The error vector.
vpCircle * cercle1
The upper circle limiting the cylinder.
bool Reinit
Indicates if the line has to be reinitialized.
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
double radius
The radius of the cylinder.
static void displayLine(const vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)
void setWorldCoordinates(const vpColVector &oP)
static void create(vpFeaturePoint &s, const vpCameraParameters &cam, const vpDot &d)
unsigned int nbFeaturel2
The number of moving edges on line 2.
void changeFrame(const vpHomogeneousMatrix &cMo, vpColVector &_cP)
Class that defines what is a circle.
vpMbtMeLine * meline2
The moving edge containers (second line of the cylinder)
void computeInteractionMatrixError(const vpHomogeneousMatrix &cMo, const vpImage< unsigned char > &I)
void set_ij(const double ii, const double jj)
void setWorldCoordinates(const vpColVector &oP)
void resize(const unsigned int i, const bool flagNullify=true)