43 #include <visp/vpConfig.h>
50 #include <visp/vpMbtDistanceLine.h>
51 #include <visp/vpPlane.h>
52 #include <visp/vpMeterPixelConversion.h>
53 #include <visp/vpFeatureBuilder.h>
63 : name(), index(0), cam(), me(NULL), alpha(0), wmean(1),
64 featureline(), poly(), meline(NULL), line(NULL), p1(NULL), p2(NULL), L(),
65 error(), nbFeature(0), Reinit(false), hiddenface(NULL), Lindex_polygon(),
127 double norm = sqrt(A*A+B*B+C*C) ;
151 buildPlane(P1,P2,P3,plane1) ;
152 buildPlane(P1,P2,P4,plane2) ;
189 if(std::fabs((V1-V2).sumSquare()) > std::numeric_limits<double>::epsilon())
192 V3[0]=double(rand()%1000)/100;
193 V3[1]=double(rand()%1000)/100;
194 V3[2]=double(rand()%1000)/100;
269 while (theta > M_PI) { theta -= M_PI ; }
270 while (theta < -M_PI) { theta += M_PI ; }
272 if (theta < -M_PI/2.0) theta = -theta - 3*M_PI/2.0;
273 else theta = M_PI/2.0 - theta;
275 meline =
new vpMbtMeLine ;
287 meline->initTracking(I,ip1,ip2,rho,theta);
380 while (theta > M_PI) { theta -= M_PI ; }
381 while (theta < -M_PI) { theta += M_PI ; }
383 if (theta < -M_PI/2.0) theta = -theta - 3*M_PI/2.0;
384 else theta = M_PI/2.0 - theta;
393 meline->updateParameters(I,ip1,ip2,rho,theta) ;
485 const unsigned int thickness,
const bool displayFullModel)
541 L.resize((
unsigned int)
meline->getMeList().size(),6) ;
564 double rho = featureline.
getRho() ;
565 double theta = featureline.
getTheta() ;
567 double co = cos(theta);
568 double si = sin(theta);
570 double mx = 1.0/cam.
get_px() ;
571 double my = 1.0/cam.
get_py() ;
572 double xc = cam.
get_u0() ;
573 double yc = cam.
get_v0() ;
582 for(std::list<vpMeSite>::const_iterator it=
meline->getMeList().begin(); it!=
meline->getMeList().end(); ++it){
589 alpha_ = x*si - y*co;
591 double *Lrho = H[0] ;
592 double *Ltheta = H[1] ;
594 for (
unsigned int k=0 ; k < 6 ; k++)
596 L[j][k] = (Lrho[k] + alpha_*Ltheta[k]);
598 error[j] = rho - ( x*co + y*si) ;
619 for(std::list<vpMeSite>::const_iterator it=
meline->getMeList().begin(); it!=
meline->getMeList().end(); ++it){
627 if( ((
unsigned int)i > (I.
getHeight()- threshold) ) || (
unsigned int)i < threshold ||
628 ((
unsigned int)j > (I.
getWidth ()- threshold) ) || (
unsigned int)j < threshold ) {
Definition of the vpMatrix class.
void setD(const double d)
vpLine * line
The 3D line.
void updateMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
unsigned int getWidth() const
unsigned int getClipping() const
bool Reinit
Indicates if the line has to be reinitialized.
static vpColVector cross(const vpColVector &a, const vpColVector &b)
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
void setWorldCoordinates(const double &A1, const double &B1, const double &C1, const double &D1, const double &A2, const double &B2, const double &C2, const double &D2)
Performs search in a given direction(normal) for a given distance(pixels) for a given 'site'...
static void convertPoint(const vpCameraParameters &cam, const double &x, const double &y, double &u, double &v)
Point coordinates conversion from normalized coordinates in meter to pixel coordinates ...
Class to define colors available for display functionnalities.
void trackMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
vpPoint * p1
The first extremity.
void displayMovingEdges(const vpImage< unsigned char > &I)
double get_oY() const
Get the point Y coordinate in the object frame.
Contains predetermined masks for sites and holds moving edges tracking parameters.
bool isvisible
Indicates if the line is visible or not.
unsigned int nbFeature
The number of moving edges.
Class that defines what is a point.
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)
std::vector< std::pair< vpPoint, unsigned int > > roiPointsClip
Region of interest clipped.
void addPoint(const unsigned int n, const vpPoint &P)
Class that defines a line in the object frame, the camera frame and the image plane. All the parameters must be set in meter.
void reinitMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
vpPoint * p2
The second extremity.
vpColVector error
The error vector.
Generic class defining intrinsic camera parameters.
double get_oZ() const
Get the point Z coordinate in the object frame.
void setA(const double a)
vpMatrix interaction(const unsigned int select=FEATURE_ALL)
void computeRoiClipped(const vpCameraParameters &cam=vpCameraParameters())
void changeFrame(const vpHomogeneousMatrix &cMo, vpColVector &cP)
void setC(const double c)
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).
double get_oX() const
Get the point X coordinate in the object frame.
bool closeToImageBorder(const vpImage< unsigned char > &I, const unsigned int threshold)
Class that provides a data structure for the column vectors as well as a set of operations on these v...
void setMovingEdge(vpMe *Me)
void computeInteractionMatrixError(const vpHomogeneousMatrix &cMo)
void setB(const double b)
unsigned int getHeight() const
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
virtual void displayLine(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)=0
This class defines the container for a plane geometrical structure.
static void create(vpFeaturePoint &s, const vpCameraParameters &cam, const vpDot &d)
void changeFrame(const vpHomogeneousMatrix &cMo, vpColVector &_cP)
virtual void setNbPoint(const unsigned int nb)
bool initMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
void initInteractionMatrixError()
vpMbtMeLine * meline
The moving edge container.
void buildFrom(vpPoint &_p1, vpPoint &_p2)
void setWorldCoordinates(const double ox, const double oy, const double oz)
Set the point world coordinates. We mean here the coordinates of the point in the object frame...
void resize(const unsigned int i, const bool flagNullify=true)
void computeFov(const unsigned int &w, const unsigned int &h)
vpPoint * p
corners in the object frame