49 #include <visp/vpDebug.h>
50 #include <visp/vpPose.h>
51 #include <visp/vpExponentialMap.h>
52 #include <visp/vpPixelMeterConversion.h>
53 #include <visp/vpImageIo.h>
54 #include <visp/vpRobust.h>
55 #include <visp/vpDisplayOpenCV.h>
56 #include <visp/vpDisplayX.h>
57 #include <visp/vpDisplayGDI.h>
58 #include <visp/vpMatrixException.h>
59 #include <visp/vpMath.h>
60 #include <visp/vpException.h>
61 #include <visp/vpTrackingException.h>
62 #include <visp/vpMbEdgeTracker.h>
63 #include <visp/vpMbtDistanceLine.h>
64 #include <visp/vpMbtXmlParser.h>
65 #include <visp/vpMbtPolygon.h>
66 #include <visp/vpVelocityTwistMatrix.h>
74 bool samePoint(
const vpPoint &P1,
const vpPoint &P2,
double threshold);
80 : compute_interaction(1), lambda(1), me(), lines(1), circles(1), cylinders(1), nline(0), ncircle(0), ncylinder(0),
81 nbvisiblepolygone(0), percentageGdPt(0.4), scales(1),
82 Ipyramid(0), scaleLevel(0)
103 for (
unsigned int i = 0; i <
lines.size(); i += 1){
105 for(std::list<vpMbtDistanceLine*>::const_iterator it=
lines[i].begin(); it!=
lines[i].end(); ++it){
113 for(std::list<vpMbtDistanceCylinder*>::const_iterator it=
cylinders[i].begin(); it!=
cylinders[i].end(); ++it){
125 for (
unsigned int i = 0; i <
circles.size(); i += 1){
126 for(std::list<vpMbtDistanceCircle*>::const_iterator it=
circles[i].begin(); it!=
circles[i].end(); ++it){
148 for (
unsigned int i = 0; i <
scales.size(); i += 1){
150 for(std::list<vpMbtDistanceLine*>::const_iterator it=
lines[i].begin(); it!=
lines[i].end(); ++it){
151 (*it)->setMovingEdge(&(this->
me)) ;
155 for(std::list<vpMbtDistanceCylinder*>::const_iterator it=
cylinders[i].begin(); it!=
cylinders[i].end(); ++it){
161 for(std::list<vpMbtDistanceCircle*>::const_iterator it=
circles[i].begin(); it!=
circles[i].end(); ++it){
180 double residu_1 =1e3;
196 unsigned int iter = 0;
199 unsigned int nbrow = 0;
200 unsigned int nberrors_lines = 0;
201 unsigned int nberrors_cylinders = 0;
202 unsigned int nberrors_circles = 0;
240 double e_prev = 0, e_cur, e_next;
248 while ( reloop ==
true && iter<10)
252 weighted_error.
resize(nerror) ;
271 int index = *itindex;
285 std::list<vpMeSite>::const_iterator itListLine;
286 if (iter == 0 && l->
meline != NULL)
287 itListLine = l->
meline->getMeList().begin();
289 for (
unsigned int i=0 ; i < l->
nbFeature ; i++)
291 for (
unsigned int j=0; j < 6 ; j++)
293 L[n+i][j] = l->
L[i][j];
297 if (
m_error[n+i] <= limite) count = count+1.0;
315 e_next = l->
error[1];
338 e_next = l->
error[i+1];
339 if ( fabs(e_cur - e_prev) < limite )
343 if ( fabs(e_cur - e_next) < limite )
358 std::list<vpMeSite>::const_iterator itCyl1;
359 std::list<vpMeSite>::const_iterator itCyl2;
361 itCyl1 = cy->
meline1->getMeList().begin();
362 itCyl2 = cy->
meline2->getMeList().begin();
365 for(
unsigned int i=0 ; i < cy->
nbFeature ; i++){
366 for(
unsigned int j=0; j < 6 ; j++){
367 L[n+i][j] = cy->
L[i][j];
371 if (
m_error[n+i] <= limite) count = count+1.0;
379 if(i<cy->nbFeaturel1) {
393 e_cur = cy->
error[0];
396 e_next = cy->
error[1];
407 e_cur = cy->
error[i];
410 e_next = cy->
error[i+1];
423 e_cur = cy->
error[i];
432 e_cur = cy->
error[i];
441 e_cur = cy->
error[i];
442 e_next = cy->
error[i+1];
443 if ( fabs(e_cur - e_prev) < limite ){
446 if ( fabs(e_cur - e_next) < limite ){
461 std::list<vpMeSite>::const_iterator itCir;
462 if (iter == 0 && (ci->
meEllipse != NULL)) {
463 itCir = ci->
meEllipse->getMeList().begin();
466 for(
unsigned int i=0 ; i < ci->
nbFeature ; i++){
467 for(
unsigned int j=0; j < 6 ; j++){
468 L[n+i][j] = ci->
L[i][j];
472 if (
m_error[n+i] <= limite) count = count+1.0;
487 e_cur = ci->
error[0];
490 e_next = ci->
error[1];
503 e_cur = ci->
error[i];
512 e_cur = ci->
error[i];
513 e_next = ci->
error[i+1];
514 if ( fabs(e_cur - e_prev) < limite ){
517 if ( fabs(e_cur - e_next) < limite ){
527 count = count / (double)nbrow;
535 double wi ;
double eri ;
536 for(
unsigned int i = 0; i < nerror; i++){
537 wi =
m_w[i]*factor[i];
542 weighted_error[i] = wi*eri ;
546 for (
unsigned int i=0 ; i < nerror ; i++){
547 for (
unsigned int j=0 ; j < 6 ; j++){
548 L[i][j] =
m_w[i]*factor[i]*L[i][j] ;
556 if (isoJoIdentity_) {
560 unsigned int rank = (L*cVo).kernel(K);
569 isoJoIdentity_ =
false;
598 vpRobust robust_lines(nberrors_lines);
599 vpRobust robust_cylinders(nberrors_cylinders);
600 vpRobust robust_circles(nberrors_circles);
617 while ( ((
int)((residu_1 - r)*1e8) !=0 ) && (iter<30))
620 unsigned int nlines = 0;
621 unsigned int ncylinders = 0;
622 unsigned int ncircles = 0;
626 for (
unsigned int i=0 ; i < l->
nbFeature ; i++){
627 for (
unsigned int j=0; j < 6 ; j++){
628 L[n+i][j] = l->
L[i][j];
630 error_lines[nlines+i] =
m_error[n+i];
640 for(
unsigned int i=0 ; i < cy->
nbFeature ; i++){
641 for(
unsigned int j=0; j < 6 ; j++){
642 L[n+i][j] = cy->
L[i][j];
644 error_cylinders[ncylinders+i] =
m_error[n+i];
655 for(
unsigned int i=0 ; i < ci->
nbFeature ; i++){
656 for(
unsigned int j=0; j < 6 ; j++){
657 L[n+i][j] = ci->
L[i][j];
659 error_circles[ncircles+i] =
m_error[n+i];
669 weighted_error.
resize(nerror);
672 w_lines.
resize(nberrors_lines);
674 w_cylinders.
resize(nberrors_cylinders);
676 w_circles.
resize(nberrors_circles);
682 if(nberrors_lines > 0)
684 if(nberrors_cylinders > 0)
686 if(nberrors_circles > 0)
694 if(nberrors_lines > 0)
696 if(nberrors_cylinders > 0)
698 if(nberrors_circles > 0)
702 unsigned int cpt = 0;
704 if(cpt<nberrors_lines){
705 m_w[cpt] = w_lines[cpt];
707 else if (cpt<nberrors_lines+nberrors_cylinders){
708 m_w[cpt] = w_cylinders[cpt-nberrors_lines];
711 m_w[cpt] = w_circles[cpt-nberrors_lines-nberrors_cylinders];
730 LVJ_true = (L*cVo*
oJo);
734 for(
unsigned int i=0; i<nerror; i++){
735 wi =
m_w[i]*factor[i];
741 weighted_error[i] = wi*eri ;
747 for (
unsigned int i=0 ; i < nerror ; i++){
748 for (
unsigned int j=0 ; j < 6 ; j++){
749 L[i][j] =
m_w[i]*factor[i]*L[i][j];
794 std::list<vpMeSite>::iterator itListLine;
797 for (
unsigned int i=0 ; i < l->
nbFeature ; i++){
826 std::list<vpMeSite>::iterator itListCyl1;
827 std::list<vpMeSite>::iterator itListCyl2;
830 itListCyl1 = cy->
meline1->getMeList().begin();
831 itListCyl2 = cy->
meline2->getMeList().begin();
859 for(
unsigned int i=cy->
nbFeaturel1 ; i < cy->nbFeature ; i++){
889 std::list<vpMeSite>::iterator itListCir;
892 itListCir = ci->
meEllipse->getMeList().begin();
896 for(
unsigned int i=0 ; i < ci->
nbFeature ; i++){
931 int nbExpectedPoint = 0;
940 nbExpectedPoint += (int)l->
meline->expecteddensity;
941 for(std::list<vpMeSite>::const_iterator itme=l->
meline->getMeList().begin(); itme!=l->
meline->getMeList().end(); ++itme){
954 nbExpectedPoint += (int)cy->
meline1->expecteddensity;
955 for(std::list<vpMeSite>::const_iterator itme1=cy->
meline1->getMeList().begin(); itme1!=cy->
meline1->getMeList().end(); ++itme1){
960 nbExpectedPoint += (int)cy->
meline2->expecteddensity;
961 for(std::list<vpMeSite>::const_iterator itme2=cy->
meline2->getMeList().begin(); itme2!=cy->
meline2->getMeList().end(); ++itme2){
974 nbExpectedPoint += ci->
meEllipse->getExpectedDensity();
975 for(std::list<vpMeSite>::const_iterator itme=ci->
meEllipse->getMeList().begin(); itme!=ci->
meEllipse->getMeList().end(); ++itme){
987 if (nbGoodPoint < nb_min || nbExpectedPoint < 2) {
988 std::ostringstream oss;
989 oss <<
"Not enough moving edges ("
991 <<
") to track the object: expected "
993 <<
". Try to reduce the threshold="
995 <<
" using vpMbTracker::setGoodMovingEdgesRatioThreshold()";
1013 unsigned int lvl = (
unsigned int)
scales.size();
1028 vpTRACE(
"Error in moving edge tracking") ;
1035 for(std::list<vpMbtDistanceLine*>::const_iterator it=
lines[lvl].begin(); it!=
lines[lvl].end(); ++it){
1043 for(std::list<vpMbtDistanceCylinder*>::const_iterator it=
cylinders[lvl].begin(); it!=
cylinders[lvl].end(); ++it){
1051 for(std::list<vpMbtDistanceCircle*>::const_iterator it=
circles[lvl].begin(); it!=
circles[lvl].end(); ++it){
1080 for(std::list<vpMbtDistanceLine*>::const_iterator it=
lines[lvl].begin(); it!=
lines[lvl].end(); ++it){
1087 for(std::list<vpMbtDistanceCylinder*>::const_iterator it=
cylinders[lvl].begin(); it!=
cylinders[lvl].end(); ++it){
1094 for(std::list<vpMbtDistanceCircle*>::const_iterator it=
circles[lvl].begin(); it!=
circles[lvl].end(); ++it){
1113 bool newvisibleface = false ;
1152 #ifdef VISP_HAVE_OGRE
1164 unsigned int i = (
unsigned int)
scales.size();
1195 if((*it)->meline != NULL){
1196 delete (*it)->meline;
1197 (*it)->meline = NULL;
1205 if((*it)->meline1 != NULL){
1206 delete (*it)->meline1;
1207 (*it)->meline1 = NULL;
1209 if((*it)->meline2 != NULL){
1210 delete (*it)->meline2;
1211 (*it)->meline2 = NULL;
1219 if((*it)->meEllipse != NULL){
1220 delete (*it)->meEllipse;
1221 (*it)->meEllipse = NULL;
1299 #ifdef VISP_HAVE_XML2
1308 std::cout <<
" *********** Parsing XML for Mb Edge Tracker ************ " << std::endl;
1309 xmlp.
parse(configFile);
1318 xmlp.
getMe(meParser);
1347 vpTRACE(
"You need the libXML2 to read the config file %s", configFile);
1365 const unsigned int thickness,
const bool displayFullModel)
1367 for (
unsigned int i = 0; i <
scales.size(); i += 1){
1370 (*it)->display(I,cMo_, camera, col, thickness, displayFullModel);
1374 (*it)->display(I, cMo_, camera, col, thickness, displayFullModel);
1378 (*it)->display(I, cMo_, camera, col, thickness, displayFullModel);
1385 #ifdef VISP_HAVE_OGRE
1404 const unsigned int thickness,
const bool displayFullModel)
1406 for (
unsigned int i = 0; i <
scales.size(); i += 1){
1409 (*it)->display(I, cMo_, camera, col, thickness, displayFullModel) ;
1413 (*it)->display(I, cMo_, camera, col, thickness, displayFullModel) ;
1417 (*it)->display(I, cMo_, camera, col, thickness, displayFullModel);
1423 #ifdef VISP_HAVE_OGRE
1445 bool isvisible = false ;
1448 int index = *itindex;
1449 if (index ==-1) isvisible =true ;
1480 bool isvisible = false ;
1483 if (index ==-1) isvisible =true ;
1510 bool isvisible = false ;
1513 if (index ==-1) isvisible =true ;
1666 if (dx <= std::numeric_limits<double>::epsilon() && dy <= std::numeric_limits<double>::epsilon() && dz <= std::numeric_limits<double>::epsilon())
1687 bool already_here = false ;
1690 for (
unsigned int i = 0; i <
scales.size(); i += 1){
1693 for(std::list<vpMbtDistanceLine*>::const_iterator it=
lines[i].begin(); it!=
lines[i].end(); ++it){
1697 already_here = true ;
1725 lines[i].push_back(l);
1742 for(
unsigned int i=0; i<
scales.size(); i++){
1744 for(std::list<vpMbtDistanceLine*>::iterator it=
lines[i].begin(); it!=
lines[i].end(); ++it){
1746 if (name.compare(l->
getName()) == 0){
1768 bool already_here = false ;
1771 for (
unsigned int i = 0; i <
scales.size(); i += 1){
1774 for(std::list<vpMbtDistanceCircle*>::const_iterator it=
circles[i].begin(); it!=
circles[i].end(); ++it){
1822 bool already_here = false ;
1825 for (
unsigned int i = 0; i <
scales.size(); i += 1){
1828 for(std::list<vpMbtDistanceCylinder*>::const_iterator it=
cylinders[i].begin(); it!=
cylinders[i].end(); ++it){
1864 for(
unsigned int i=0; i<
scales.size(); i++){
1866 for(std::list<vpMbtDistanceCylinder*>::iterator it=
cylinders[i].begin(); it!=
cylinders[i].end(); ++it){
1868 if (name.compare(cy->
getName()) == 0){
1887 for(
unsigned int i=0; i<
scales.size(); i++){
1889 for(std::list<vpMbtDistanceCircle*>::iterator it=
circles[i].begin(); it!=
circles[i].end(); ++it){
1891 if (name.compare(ci->
getName()) == 0){
1910 for (
unsigned int i=0 ; i < nbpt-1 ; i++)
1917 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
1937 #ifdef VISP_HAVE_OGRE
1938 bool changed =
false;
1949 newvisibleline = true ;
1952 newvisibleline = false ;
1956 #endif //VISP_BUILD_DEPRECATED_FUNCTIONS
1973 bool changed =
false;
1980 #ifdef VISP_HAVE_OGRE
1990 newvisibleline = true ;
1993 newvisibleline = false ;
2015 for (
unsigned int i=0 ; i < nbpt-1 ; i++)
2037 for (
unsigned int i=0 ; i < nbpt-1 ; i++)
2055 const int idFace,
const std::string &name)
2057 addCircle(p1, p2, p3, radius, (
int)idFace, name);
2072 const std::string &name)
2090 for (
unsigned int i = 0; i <
scales.size(); i += 1){
2092 for(std::list<vpMbtDistanceLine*>::const_iterator it=
lines[i].begin(); it!=
lines[i].end(); ++it){
2094 if (l!=NULL)
delete l ;
2098 for(std::list<vpMbtDistanceCylinder*>::const_iterator it=
cylinders[i].begin(); it!=
cylinders[i].end(); ++it){
2100 if (cy!=NULL)
delete cy;
2104 for(std::list<vpMbtDistanceCircle*>::const_iterator it=
circles[i].begin(); it!=
circles[i].end(); ++it){
2106 if (ci!=NULL)
delete ci;
2117 #ifdef VISP_HAVE_OGRE
2170 for (
unsigned int i = 0; i <
scales.size(); i += 1){
2172 for(std::list<vpMbtDistanceLine*>::const_iterator it=
lines[i].begin(); it!=
lines[i].end(); ++it){
2174 if (l!=NULL)
delete l ;
2178 for(std::list<vpMbtDistanceCylinder*>::const_iterator it=
cylinders[i].begin(); it!=
cylinders[i].end(); ++it){
2180 if (cy!=NULL)
delete cy;
2184 for(std::list<vpMbtDistanceCircle*>::const_iterator it=
circles[i].begin(); it!=
circles[i].end(); ++it){
2186 if (ci!=NULL)
delete ci;
2226 unsigned int nbGoodPoints = 0;
2228 for(std::list<vpMbtDistanceLine*>::const_iterator it=
lines[level].begin(); it!=
lines[level].end(); ++it){
2232 for(std::list<vpMeSite>::const_iterator itme=l->
meline->getMeList().begin(); itme!=l->
meline->getMeList().end(); ++itme){
2239 for(std::list<vpMbtDistanceCylinder*>::const_iterator it=
cylinders[level].begin(); it!=
cylinders[level].end(); ++it){
2243 for(std::list<vpMeSite>::const_iterator itme1=cy->
meline1->getMeList().begin(); itme1!=cy->
meline1->getMeList().end(); ++itme1){
2246 for(std::list<vpMeSite>::const_iterator itme2=cy->
meline2->getMeList().begin(); itme2!=cy->
meline2->getMeList().end(); ++itme2){
2253 for(std::list<vpMbtDistanceCircle*>::const_iterator it=
circles[level].begin(); it!=
circles[level].end(); ++it){
2257 for(std::list<vpMeSite>::const_iterator itme=ci->
meEllipse->getMeList().begin(); itme!=ci->
meEllipse->getMeList().end(); ++itme){
2263 return nbGoodPoints;
2289 unsigned int nbActivatedLevels = 0;
2290 for (
unsigned int i = 0; i < scale.size(); i += 1){
2292 nbActivatedLevels++;
2295 if((scale.size() < 1) || (nbActivatedLevels == 0)){
2296 vpERROR_TRACE(
" !! WARNING : must use at least one level for the tracking. Use the global one");
2298 this->
scales.push_back(
true);
2306 lines.resize(scale.size());
2308 for (
unsigned int i = 0; i <
lines.size(); i += 1){
2324 vpTRACE(
"Far clipping value cannot be inferior than near clipping value. Far clipping won't be considered.");
2325 else if ( dist < 0 )
2326 vpTRACE(
"Far clipping value cannot be inferior than 0. Far clipping won't be considered.");
2331 for (
unsigned int i = 0; i <
scales.size(); i += 1){
2333 for(std::list<vpMbtDistanceLine*>::const_iterator it=
lines[i].begin(); it!=
lines[i].end(); ++it){
2351 vpTRACE(
"Near clipping value cannot be superior than far clipping value. Near clipping won't be considered.");
2352 else if ( dist < 0 )
2353 vpTRACE(
"Near clipping value cannot be inferior than 0. Near clipping won't be considered.");
2358 for (
unsigned int i = 0; i <
scales.size(); i += 1){
2360 for(std::list<vpMbtDistanceLine*>::const_iterator it=
lines[i].begin(); it!=
lines[i].end(); ++it){
2383 for (
unsigned int i = 0; i <
scales.size(); i += 1){
2385 for(std::list<vpMbtDistanceLine*>::const_iterator it=
lines[i].begin(); it!=
lines[i].end(); ++it){
2410 _pyramid.resize(
scales.size());
2419 for(
unsigned int i=1; i<_pyramid.size(); i += 1){
2421 unsigned int cScale =
static_cast<unsigned int>(pow(2., (
int)i));
2423 #if (defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION < 0x020408))
2424 IplImage* vpI0 = cvCreateImageHeader(cvSize((
int)_I.
getWidth(), (int)_I.
getHeight()), IPL_DEPTH_8U, 1);
2425 vpI0->imageData = (
char*)(_I.
bitmap);
2426 IplImage* vpI = cvCreateImage(cvSize((
int)(_I.
getWidth() / cScale), (
int)(_I.
getHeight() / cScale)), IPL_DEPTH_8U, 1);
2427 cvResize(vpI0, vpI, CV_INTER_NN);
2429 cvReleaseImage(&vpI);
2430 vpI0->imageData = NULL;
2431 cvReleaseImageHeader(&vpI0);
2433 for (
unsigned int k = 0, ii = 0; k < I->
getHeight(); k += 1, ii += cScale){
2434 for (
unsigned int l = 0, jj = 0; l < I->
getWidth(); l += 1, jj += cScale){
2435 (*I)[k][l] = _I[ii][jj];
2456 if(_pyramid.size() > 0){
2458 for (
unsigned int i = 1; i < _pyramid.size(); i += 1){
2459 if(_pyramid[i] != NULL){
2482 std::ostringstream oss;
2484 std::string errorMsg =
"level " + oss.str() +
" is not used, cannot get its distance lines.";
2488 linesList =
lines[level];
2506 std::ostringstream oss;
2508 std::string errorMsg =
"level " + oss.str() +
" is not used, cannot get its distance lines.";
2530 std::ostringstream oss;
2532 std::string errorMsg =
"level " + oss.str() +
" is not used, cannot get its distance lines.";
2548 const double ratio = pow(2., (
int)_scale);
2570 const double ratio = pow(2., (
int)_scale);
void setWindowName(const Ogre::String &n)
unsigned int ncylinder
Index of the cylinder to add, and total number of cylinders extracted so far.
void setMovingEdge(vpMe *Me)
Definition of the vpMatrix class.
void displayMovingEdges(const vpImage< unsigned char > &I)
vpMatrix covarianceMatrix
Covariance matrix.
void initFromCalibrationMatrix(const vpMatrix &_K)
void updateMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
void setFarClippingDistance(const double &dist)
void setMovingEdge(const vpMe &me)
void setClipping(const unsigned int &flags)
unsigned int nbFeature
The number of moving edges.
void setVisible(bool _isvisible)
vpMbHiddenFaces< vpMbtPolygon > * hiddenface
Pointer to the list of faces.
void trackMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
void setCameraParameters(const vpCameraParameters &camera)
void upScale(const unsigned int _scale)
std::string getName() const
virtual void initFaceFromCorners(vpMbtPolygon &polygon)
void updateMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
void MEstimator(const vpRobustEstimatorType method, const vpColVector &residues, vpColVector &weights)
Compute the weights according a residue vector and a PsiFunction.
vpPoint * p3
An other point on the plane containing the circle.
vpMbHiddenFaces< vpMbtPolygon > * hiddenface
Pointer to the list of faces.
void addLine(vpPoint &p1, vpPoint &p2, int polygon=-1, std::string name="")
bool isAppearing(const unsigned int i)
unsigned int getWidth() const
static void convert(const vpImage< unsigned char > &src, vpImage< vpRGBa > &dest)
void getCameraParameters(vpCameraParameters &_cam) const
vpMbHiddenFaces< vpMbtPolygon > faces
Set of faces describing the object.
bool Reinit
Indicates if the line has to be reinitialized.
void setMeanWeight2(const double wmean)
void computeVVS(const vpImage< unsigned char > &_I)
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
void init(const vpImage< unsigned char > &I)
void track(const vpImage< unsigned char > &I)
double lambda
The gain of the virtual visual servoing stage.
unsigned int scaleLevel
Current scale level used. This attribute must not be modified outside of the downScale() and upScale(...
std::list< int > Lindex_polygon
Index of the faces which contain the line.
Type * bitmap
points toward the bitmap
vpMatrix L
The interaction matrix.
void setCameraParameters(const vpCameraParameters &camera)
void setIdentity()
Basic initialisation (identity)
Performs search in a given direction(normal) for a given distance(pixels) for a given 'site'...
std::vector< std::list< vpMbtDistanceCircle * > > circles
Vector of the tracked circles.
Class to define colors available for display functionnalities.
Parse an Xml file to extract configuration parameters of a mbtConfig object.Data parser for the model...
void trackMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
void setBackgroundSizeOgre(const unsigned int &h, const unsigned int &w)
vpHomogeneousMatrix cMo
The current pose.
vpPoint * p1
The first extremity.
void displayMovingEdges(const vpImage< unsigned char > &I)
double getNearClippingDistance() const
virtual ~vpMbEdgeTracker()
unsigned int ncircle
Index of the circle to add, and total number of circles extracted so far.
vpColVector error
The error vector.
bool modelInitialised
Flag used to ensure that the CAD model is loaded before the initialisation.
double get_oY() const
Get the point Y coordinate in the object frame.
void getMe(vpMe &_ecm) const
void buildFrom(const vpPoint &_p1, const vpPoint &_p2, const vpPoint &_p3, const double r)
error that can be emited by ViSP classes.
void computeJTR(const vpMatrix &J, const vpColVector &R, vpMatrix &JTR)
vpMbtMeEllipse * meEllipse
Polygon describing the circle bbox.
Manage a cylinder used in the model-based tracker.
void reInitLevel(const unsigned int _lvl)
Contains predetermined masks for sites and holds moving edges tracking parameters.
Manage the line of a polygon used in the model-based tracker.
unsigned int nbFeature
The number of moving edges.
virtual void setPose(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cdMo)
std::vector< const vpImage< unsigned char > * > Ipyramid
Pyramid of image associated to the current image. This pyramid is computed in the init() and in the t...
void removeCircle(const std::string &name)
bool useOgre
Use Ogre3d for visibility tests.
int index_polygon
Index of the faces which contain the line.
vpPoint * p2
A point on the plane containing the circle.
void getLcylinder(std::list< vpMbtDistanceCylinder * > &cylindersList, const unsigned int level=0)
void setIndex(const unsigned int i)
virtual void setCameraParameters(const vpCameraParameters &camera)
virtual void initFromPose(const vpImage< unsigned char > &I, const std::string &initFile)
unsigned int setVisibleOgre(const vpImage< unsigned char > &I, const vpCameraParameters &cam, const vpHomogeneousMatrix &cMo, const double &angleAppears, const double &angleDisappears, bool &changed)
void removeCylinder(const std::string &name)
vpMbtPolygon & getPolygon()
bool computeCovariance
Flag used to specify if the covariance matrix has to be computed or not.
void loadConfigFile(const std::string &configFile)
vpMe me
The moving edges parameters.
void updateMovingEdge(const vpImage< unsigned char > &I)
std::vector< std::list< vpMbtDistanceLine * > > lines
Vector of list of all the lines tracked (each line is linked to a list of moving edges). Each element of the vector is for a scale (element 0 = level 0 = no subsampling).
unsigned int getNbPoints(const unsigned int level=0) const
void setNearClippingDistance(const double &dist)
vpPoint * p1
The first extremity on the axe.
void initInteractionMatrixError()
unsigned int nbFeature
The number of moving edges.
void downScale(const unsigned int _scale)
bool hasNearClippingDistance() const
Class that defines what is a point.
vpMatrix L
The interaction matrix.
vpMeSiteState getState() const
vpCameraParameters cam
The camera parameters.
unsigned int setVisible(const vpImage< unsigned char > &I, const vpCameraParameters &cam, const vpHomogeneousMatrix &cMo, const double &angle, bool &changed)
static Type maximum(const Type &a, const Type &b)
virtual void setNearClippingDistance(const double &dist)
double getFarClippingDistance() const
void initOgre(const vpCameraParameters &cam=vpCameraParameters())
unsigned int nbFeaturel1
The number of moving edges on line 1.
double distFarClip
Distance for near clipping.
bool hasFarClippingDistance() const
vpAROgre * getOgreContext()
int index_polygon
Index of the face which contains the cylinder.
void reInitModel(const vpImage< unsigned char > &I, const std::string &cad_name, const vpHomogeneousMatrix &cMo_, const bool verbose=false)
virtual void setMinPolygonAreaThresh(const double minPolygonAreaThresh, const std::string &name="")
void reinitMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
Manage a circle used in the model-based tracker.
vpMatrix oJo
The Degrees of Freedom to estimate.
std::vector< bool > scales
Vector of scale level to use for the multi-scale tracking.
bool Reinit
Indicates if the circle has to be reinitialized.
void getLline(std::list< vpMbtDistanceLine * > &linesList, const unsigned int level=0)
Error that can be emited by the vpTracker class and its derivates.
double getAngleDisappear() const
Implementation of a polygon of the model used by the model-based tracker.
void initMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &_cMo)
void setName(const std::string &circle_name)
std::string getName() const
vpPoint * p2
The second extremity.
void reinitMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
vpVelocityTwistMatrix buildFrom(const vpTranslationVector &t, const vpRotationMatrix &R)
static double sqr(double x)
double minLineLengthThresholdGeneral
Minimum line length threshold for LOD mode (general setting)
void setAngleDisappear(const double &adisappear)
vpColVector error
The error vector.
void trackMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
vpColVector m_error
Error s-s*.
double getMinPolygonAreaThreshold() const
Generic class defining intrinsic camera parameters.
void computeInteractionMatrixError(const vpHomogeneousMatrix &cMo)
double get_oZ() const
Get the point Z coordinate in the object frame.
void setIndex(const unsigned int i)
double percentageGdPt
Percentage of good points over total number of points below which tracking is supposed to have failed...
void initPyramid(const vpImage< unsigned char > &_I, std::vector< const vpImage< unsigned char > * > &_pyramid)
void cleanPyramid(std::vector< const vpImage< unsigned char > * > &_pyramid)
void updateMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
bool initMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
vpMbtMeLine * meline1
The moving edge containers (first line of the cylinder)
void setVisible(bool _isvisible)
void reinitMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
virtual void setFarClippingDistance(const double &dist)
static Type minimum(const Type &a, const Type &b)
Class that consider the particular case of twist transformation matrix that allows to transform a vel...
void setCameraParameters(const vpCameraParameters &_cam)
double angleAppears
Angle used to detect a face appearance.
void setState(const vpMeSiteState &flag)
void reinitMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &_cMo)
void displayMovingEdges(const vpImage< unsigned char > &I)
std::string getName() const
static double rad(double deg)
void addCylinder(const vpPoint &P1, const vpPoint &P2, const double r, int idFace=-1, const std::string &name="")
virtual void setMinLineLengthThresh(const double minLineLengthThresh, const std::string &name="")
void parse(const char *filename)
void setMeanWeight1(const double wmean)
bool initMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
void setMovingEdge(vpMe *Me)
void diag(const vpColVector &A)
void setVisible(bool _isvisible)
void computeCovarianceMatrix(const vpHomogeneousMatrix &cMoPrev, const vpColVector &deltaS, const vpMatrix &Ls, const vpMatrix &W)
bool samePoint(const vpPoint &P1, const vpPoint &P2)
virtual void initFaceFromLines(vpMbtPolygon &polygon)
void setScales(const std::vector< bool > &_scales)
vpPoint * p2
The second extremity on the axe.
void getLcircle(std::list< vpMbtDistanceCircle * > &circlesList, const unsigned int level=0)
void setCameraParameters(const vpCameraParameters &camera)
double get_oX() const
Get the point X coordinate in the object frame.
virtual void initCylinder(const vpPoint &p1, const vpPoint &p2, const double radius, const int idFace=0, const std::string &name="")
bool closeToImageBorder(const vpImage< unsigned char > &I, const unsigned int threshold)
void setIndex(const unsigned int i)
double minPolygonAreaThresholdGeneral
Minimum polygon area threshold for LOD mode (general setting)
static double deg(double rad)
void initInteractionMatrixError()
bool displayFeatures
If true, the features are displayed.
virtual void loadModel(const char *modelFile, const bool verbose=false)
void buildFrom(const vpPoint &_p1, const vpPoint &_p2, const double r)
bool applyLodSettingInConfig
True if the CAO model is loaded before the call to loadConfigFile, (deduced by the number of polygons...
Class that provides a data structure for the column vectors as well as a set of operations on these v...
std::vector< std::list< vpMbtDistanceCylinder * > > cylinders
Vector of the tracked cylinders.
void setAngleAppear(const double &aappear)
void setMovingEdge(vpMe *Me)
void computeInteractionMatrixError(const vpHomogeneousMatrix &cMo)
virtual void initCircle(const vpPoint &p1, const vpPoint &p2, const vpPoint &p3, const double radius, const int idFace=0, const std::string &name="")
vpHomogeneousMatrix inverse() const
vpMbHiddenFaces< vpMbtPolygon > * hiddenface
Pointer to the list of faces.
static vpHomogeneousMatrix direct(const vpColVector &v)
void setMeanWeight(const double _wmean)
bool isVisible(const unsigned int i)
Contains an M-Estimator and various influence function.
unsigned int nbvisiblepolygone
Number of polygon (face) currently visible.
double angleDisappears
Angle used to detect a face disappearance.
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)
virtual unsigned int getNbPolygon() const
void visibleFace(const vpImage< unsigned char > &_I, const vpHomogeneousMatrix &_cMo, bool &newvisibleline)
unsigned int getHeight() const
void setMeanWeight(const double w_mean)
vpColVector error
The error vector.
vpMatrix pseudoInverse(double svThreshold=1e-6) const
Compute the pseudo inverse of the matrix using the SVD.
virtual void setClipping(const unsigned int &flags)
bool Reinit
Indicates if the line has to be reinitialized.
double radius
The radius of the cylinder.
unsigned int clippingFlag
Flags specifying which clipping to used.
unsigned int getNbPoint() const
unsigned int nline
Index of the polygon to add, and total number of polygon extracted so far.
void addPolygon(vpMbtPolygon &p)
void setName(const std::string line_name)
void trackMovingEdge(const vpImage< unsigned char > &I)
void displayOgre(const vpHomogeneousMatrix &cMo)
double getAngleAppear() const
virtual void setClipping(const unsigned int &flags)
unsigned int nbFeaturel2
The number of moving edges on line 2.
void setThreshold(const double noise_threshold)
unsigned int getRows() const
Return the number of rows of the matrix.
double radius
The radius of the circle.
virtual void setFarClippingDistance(const double &dist)
void setName(const std::string &cyl_name)
static int sign(double x)
vpMbtMeLine * meline2
The moving edge containers (second line of the cylinder)
void removeLine(const std::string &name)
bool getFovClipping() const
void setIteration(const unsigned int iter)
Set iteration.
double distNearClip
Distance for near clipping.
bool useLodGeneral
True if LOD mode is enabled.
vpMatrix L
The interaction matrix.
void addCircle(const vpPoint &P1, const vpPoint &P2, const vpPoint &P3, const double r, int idFace=-1, const std::string &name="")
void computeInteractionMatrixError(const vpHomogeneousMatrix &cMo, const vpImage< unsigned char > &I)
bool initMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
void initInteractionMatrixError()
void setMovingEdge(const vpMe &_ecm)
bool isoJoIdentity
Boolean to know if oJo is identity (for fast computation)
std::string getName() const
vpMbtMeLine * meline
The moving edge container.
vpPoint * p1
The center of the circle.
void buildFrom(vpPoint &_p1, vpPoint &_p2)
double getMinLineLengthThreshold() const
void resize(const unsigned int i, const bool flagNullify=true)
vpColVector m_w
Weights used in the robust scheme.
virtual void setLod(const bool useLod, const std::string &name="")
virtual void setNearClippingDistance(const double &dist)
vpPoint * p
corners in the object frame