45 #include <visp3/core/vpDebug.h>
46 #include <visp3/mbt/vpMbEdgeMultiTracker.h>
47 #include <visp3/core/vpExponentialMap.h>
48 #include <visp3/core/vpTrackingException.h>
49 #include <visp3/core/vpVelocityTwistMatrix.h>
56 m_mapOfPyramidalImages(), m_referenceCameraName(
"Camera") {
69 m_mapOfEdgeTrackers(), m_mapOfPyramidalImages(), m_referenceCameraName(
"Camera") {
73 }
else if (nbCameras == 1) {
78 }
else if(nbCameras == 2) {
89 for(
unsigned int i = 1; i <= nbCameras; i++) {
110 m_mapOfEdgeTrackers(), m_mapOfPyramidalImages(), m_referenceCameraName(
"Camera") {
112 if(cameraNames.empty()) {
116 for(std::vector<std::string>::const_iterator it = cameraNames.begin(); it != cameraNames.end(); ++it) {
128 for(std::map<std::string, vpMbEdgeTracker*>::const_iterator it =
m_mapOfEdgeTrackers.begin();
140 it1 != pyramid.end(); ++it1) {
141 if(it1->second.size() > 0){
142 it1->second[0] = NULL;
143 for(
size_t i = 1; i < it1->second.size(); i++) {
144 if(it1->second[i] != NULL) {
145 delete it1->second[i];
146 it1->second[i] = NULL;
156 double rawTotalProjectionError = 0.0;
157 unsigned int nbTotalFeaturesUsed = 0;
158 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
160 double curProjError = it->second->getProjectionError();
161 unsigned int nbFeaturesUsed = it->second->nbFeaturesForProjErrorComputation;
163 if(nbFeaturesUsed > 0) {
164 nbTotalFeaturesUsed += nbFeaturesUsed;
165 rawTotalProjectionError += (
vpMath::rad(curProjError)*nbFeaturesUsed );
169 if(nbTotalFeaturesUsed > 0) {
181 unsigned int nbrow = 0;
186 std::vector<FeatureType> indexOfFeatures;
187 std::map<std::string, unsigned int> mapOfNumberOfRows;
188 std::map<std::string, unsigned int> mapOfNumberOfLines;
189 std::map<std::string, unsigned int> mapOfNumberOfCylinders;
190 std::map<std::string, unsigned int> mapOfNumberOfCircles;
192 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it1 =
m_mapOfEdgeTrackers.begin();
194 unsigned int nrows = 0;
195 unsigned int nlines = 0;
196 unsigned int ncylinders = 0;
197 unsigned int ncircles = 0;
199 nrows = it1->second->initMbtTracking(nlines, ncylinders, ncircles);
201 mapOfNumberOfRows[it1->first] = nrows;
202 mapOfNumberOfLines[it1->first] = nlines;
203 mapOfNumberOfCylinders[it1->first] = ncylinders;
204 mapOfNumberOfCircles[it1->first] = ncircles;
211 for(
unsigned int i = 0; i < nlines; i++) {
212 indexOfFeatures.push_back(
LINE);
215 for(
unsigned int i = 0; i < ncylinders; i++) {
216 indexOfFeatures.push_back(
CYLINDER);
219 for(
unsigned int i = 0; i < ncircles; i++) {
220 indexOfFeatures.push_back(
CIRCLE);
237 unsigned int iter = 0;
240 std::map<std::string, vpColVector> mapOfFactors;
247 std::map<std::string, vpVelocityTwistMatrix> mapOfVelocityTwist;
252 mapOfVelocityTwist[it->first] = cVo;
259 while(reloop ==
true && iter < 10)
264 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
271 weighted_error.
resize(nerror);
273 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
275 it->second->m_w.resize(mapOfNumberOfRows[it->first]);
278 it->second->m_error.resize(mapOfNumberOfRows[it->first]);
280 mapOfFactors[it->first].resize(mapOfNumberOfRows[it->first]);
281 mapOfFactors[it->first] = 1;
292 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
294 vpMatrix L_tmp(mapOfNumberOfRows[it->first], 6);
296 double count_tmp = 0.0;
297 it->second->computeVVSFirstPhase(*mapOfImages[it->first], iter, L_tmp, mapOfFactors[it->first], count_tmp,
298 it->second->m_error, it->second->m_w, lvl);
301 L_tmp = L_tmp*mapOfVelocityTwist[it->first];
304 factor.
stack(mapOfFactors[it->first]);
309 count = count / (double) nbrow;
326 std::map<std::string, vpRobust> mapOfRobustLines;
327 std::map<std::string, vpRobust> mapOfRobustCylinders;
328 std::map<std::string, vpRobust> mapOfRobustCircles;
330 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
332 mapOfRobustLines[it->first] =
vpRobust(mapOfNumberOfLines[it->first]);
333 mapOfRobustLines[it->first].setIteration(0);
335 mapOfRobustCylinders[it->first] =
vpRobust(mapOfNumberOfCylinders[it->first]);
336 mapOfRobustCylinders[it->first].setIteration(0);
338 mapOfRobustCircles[it->first] =
vpRobust(mapOfNumberOfCircles[it->first]);
339 mapOfRobustCircles[it->first].setIteration(0);
346 std::map<std::string, vpColVector> mapOfWeightLines;
347 std::map<std::string, vpColVector> mapOfWeightCylinders;
348 std::map<std::string, vpColVector> mapOfWeightCircles;
365 double residu_1 = 1e3;
369 while(std::fabs((residu_1 - r)*1e8) > std::numeric_limits<double>::epsilon() && (iter<30))
375 error_cylinders.
resize(0);
378 std::map<std::string, vpColVector> mapOfErrorLines;
379 std::map<std::string, vpColVector> mapOfErrorCylinders;
380 std::map<std::string, vpColVector> mapOfErrorCircles;
382 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
384 vpMatrix L_tmp(mapOfNumberOfRows[it->first], 6);
385 vpColVector error_lines_tmp(mapOfNumberOfLines[it->first]);
386 vpColVector error_cylinders_tmp(mapOfNumberOfCylinders[it->first]);
387 vpColVector error_circles_tmp(mapOfNumberOfCircles[it->first]);
392 error_tmp.
resize(mapOfNumberOfRows[it->first]);
394 it->second->computeVVSSecondPhase(*mapOfImages[it->first], L_tmp, error_lines_tmp,
395 error_cylinders_tmp, error_circles_tmp, error_tmp, lvl);
396 L_tmp = L_tmp*mapOfVelocityTwist[it->first];
401 error_lines.
stack(error_lines_tmp);
402 error_cylinders.
stack(error_cylinders_tmp);
403 error_circles.
stack(error_circles_tmp);
405 mapOfErrorLines[it->first] = error_lines_tmp;
406 mapOfErrorCylinders[it->first] = error_cylinders_tmp;
407 mapOfErrorCircles[it->first] = error_circles_tmp;
410 bool reStartFromLastIncrement =
false;
413 if(!reStartFromLastIncrement) {
419 mapOfNumberOfCylinders, mapOfNumberOfCircles, mapOfWeightLines, mapOfWeightCylinders, mapOfWeightCircles,
420 mapOfErrorLines, mapOfErrorCylinders, mapOfErrorCircles, mapOfRobustLines, mapOfRobustCylinders,
421 mapOfRobustCircles, 2.0);
428 for(
unsigned int cpt = 0, cpt_lines = 0, cpt_cylinders = 0, cpt_circles = 0; cpt < nbrow; cpt++) {
429 switch(indexOfFeatures[cpt]) {
431 m_w[cpt] = w_lines[cpt_lines];
436 m_w[cpt] = w_cylinders[cpt_cylinders];
441 m_w[cpt] = w_circles[cpt_circles];
446 std::cerr <<
"Problem with feature type !" << std::endl;
452 weighted_error, mu, m_error_prev, m_w_prev, cMoPrev, residu_1, r);
473 unsigned int cpt = 0;
474 for(std::map<std::string, unsigned int>::const_iterator it = mapOfNumberOfRows.begin(); it != mapOfNumberOfRows.end(); ++it) {
475 for(
unsigned int i = 0; i < mapOfNumberOfRows[it->first]; i++) {
479 cpt += mapOfNumberOfRows[it->first];
485 std::map<std::string, unsigned int> &mapOfNumberOfLines,
486 std::map<std::string, unsigned int> &mapOfNumberOfCylinders, std::map<std::string, unsigned int> &mapOfNumberOfCircles,
487 std::map<std::string, vpColVector> &mapOfWeightLines, std::map<std::string, vpColVector> &mapOfWeightCylinders,
488 std::map<std::string, vpColVector> &mapOfWeightCircles, std::map<std::string, vpColVector> &mapOfErrorLines,
489 std::map<std::string, vpColVector> &mapOfErrorCylinders, std::map<std::string, vpColVector> &mapOfErrorCircles,
490 std::map<std::string, vpRobust> &mapOfRobustLines, std::map<std::string, vpRobust> &mapOfRobustCylinders,
491 std::map<std::string, vpRobust> &mapOfRobustCircles,
double threshold) {
494 weighted_error.
resize(nerror);
497 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
499 mapOfWeightLines[it->first].resize(mapOfNumberOfLines[it->first]);
500 mapOfWeightLines[it->first] = 1;
502 mapOfWeightCylinders[it->first].resize(mapOfNumberOfCylinders[it->first]);
503 mapOfWeightCylinders[it->first] = 1;
505 mapOfWeightCircles[it->first].resize(mapOfNumberOfCircles[it->first]);
506 mapOfWeightCircles[it->first] = 1;
510 for(std::map<std::string, vpRobust>::iterator it = mapOfRobustLines.begin(); it != mapOfRobustLines.end(); ++it) {
513 it->second.setThreshold(threshold / current_cam.
get_px());
516 for(std::map<std::string, vpRobust>::iterator it = mapOfRobustCylinders.begin(); it != mapOfRobustCylinders.end(); ++it) {
519 it->second.setThreshold(threshold / current_cam.
get_px());
522 for(std::map<std::string, vpRobust>::iterator it = mapOfRobustCircles.begin(); it != mapOfRobustCircles.end(); ++it) {
529 for(std::map<std::string, vpColVector>::const_iterator it = mapOfErrorLines.begin();
530 it != mapOfErrorLines.end(); ++it) {
531 if(mapOfNumberOfLines[it->first] > 0) {
532 mapOfRobustLines[it->first].MEstimator(
vpRobust::TUKEY, it->second, mapOfWeightLines[it->first]);
535 w_lines.
stack(mapOfWeightLines[it->first]);
539 for(std::map<std::string, vpColVector>::const_iterator it = mapOfErrorCylinders.begin();
540 it != mapOfErrorCylinders.end(); ++it) {
541 if(mapOfNumberOfCylinders[it->first] > 0) {
542 mapOfRobustCylinders[it->first].MEstimator(
vpRobust::TUKEY, it->second, mapOfWeightCylinders[it->first]);
545 w_cylinders.
stack(mapOfWeightCylinders[it->first]);
549 for(std::map<std::string, vpColVector>::const_iterator it = mapOfErrorCircles.begin();
550 it != mapOfErrorCircles.end(); ++it) {
551 if(mapOfNumberOfCircles[it->first] > 0) {
552 mapOfRobustCircles[it->first].MEstimator(
vpRobust::TUKEY, it->second, mapOfWeightCircles[it->first]);
555 w_circles.
stack(mapOfWeightCircles[it->first]);
562 for(std::map<std::string, vpRobust>::iterator it = mapOfRobustLines.begin(); it != mapOfRobustLines.end(); ++it) {
563 it->second.setIteration(iter);
566 for(std::map<std::string, vpRobust>::iterator it = mapOfRobustCylinders.begin(); it != mapOfRobustCylinders.end(); ++it) {
567 it->second.setIteration(iter);
570 for(std::map<std::string, vpRobust>::iterator it = mapOfRobustCircles.begin(); it != mapOfRobustCircles.end(); ++it) {
571 it->second.setIteration(iter);
575 for(std::map<std::string, vpColVector>::const_iterator it = mapOfErrorLines.begin();
576 it != mapOfErrorLines.end(); ++it) {
577 if(mapOfNumberOfLines[it->first] > 0) {
578 mapOfRobustLines[it->first].MEstimator(
vpRobust::TUKEY, it->second, mapOfWeightLines[it->first]);
581 w_lines.
stack(mapOfWeightLines[it->first]);
585 for(std::map<std::string, vpColVector>::const_iterator it = mapOfErrorCylinders.begin();
586 it != mapOfErrorCylinders.end(); ++it) {
587 if(mapOfNumberOfCylinders[it->first] > 0) {
588 mapOfRobustCylinders[it->first].MEstimator(
vpRobust::TUKEY, it->second, mapOfWeightCylinders[it->first]);
591 w_cylinders.
stack(mapOfWeightCylinders[it->first]);
595 for(std::map<std::string, vpColVector>::const_iterator it = mapOfErrorCircles.begin();
596 it != mapOfErrorCircles.end(); ++it) {
597 if(mapOfNumberOfCircles[it->first] > 0) {
598 mapOfRobustCircles[it->first].MEstimator(
vpRobust::TUKEY, it->second, mapOfWeightCircles[it->first]);
601 w_circles.
stack(mapOfWeightCircles[it->first]);
622 it->second->display(I, cMo_, cam_, col, thickness, displayFullModel);
639 const vpColor& col,
const unsigned int thickness,
const bool displayFullModel) {
643 it->second->display(I, cMo_, cam_, col, thickness, displayFullModel);
668 it->second->display(I1, c1Mo, cam1, col, thickness, displayFullModel);
671 it->second->display(I2, c2Mo, cam2, col, thickness, displayFullModel);
673 std::cerr <<
"This display is only for the stereo case ! There are "
697 it->second->display(I1, c1Mo, cam1, col, thickness, displayFullModel);
700 it->second->display(I2, c2Mo, cam2, col, thickness, displayFullModel);
702 std::cerr <<
"This display is only for the stereo case ! There are "
718 const std::map<std::string, vpHomogeneousMatrix> &mapOfCameraPoses,
719 const std::map<std::string, vpCameraParameters> &mapOfCameraParameters,
720 const vpColor& col,
const unsigned int thickness,
const bool displayFullModel) {
724 it_img != mapOfImages.end(); ++it_img) {
725 std::map<std::string, vpMbEdgeTracker *>::const_iterator it_edge =
m_mapOfEdgeTrackers.find(it_img->first);
726 std::map<std::string, vpHomogeneousMatrix>::const_iterator it_camPose = mapOfCameraPoses.find(it_img->first);
727 std::map<std::string, vpCameraParameters>::const_iterator it_cam = mapOfCameraParameters.find(it_img->first);
729 if(it_edge !=
m_mapOfEdgeTrackers.end() && it_camPose != mapOfCameraPoses.end() && it_cam != mapOfCameraParameters.end()) {
730 it_edge->second->display(*it_img->second, it_camPose->second, it_cam->second, col, thickness, displayFullModel);
732 std::cerr <<
"Missing elements !" << std::endl;
748 const std::map<std::string, vpHomogeneousMatrix> &mapOfCameraPoses,
749 const std::map<std::string, vpCameraParameters> &mapOfCameraParameters,
750 const vpColor& col,
const unsigned int thickness,
const bool displayFullModel) {
753 for(std::map<std::string,
const vpImage<vpRGBa> *>::const_iterator it_img = mapOfImages.begin();
754 it_img != mapOfImages.end(); ++it_img) {
755 std::map<std::string, vpMbEdgeTracker *>::const_iterator it_edge =
m_mapOfEdgeTrackers.find(it_img->first);
756 std::map<std::string, vpHomogeneousMatrix>::const_iterator it_camPose = mapOfCameraPoses.find(it_img->first);
757 std::map<std::string, vpCameraParameters>::const_iterator it_cam = mapOfCameraParameters.find(it_img->first);
759 if(it_edge !=
m_mapOfEdgeTrackers.end() && it_camPose != mapOfCameraPoses.end() && it_cam != mapOfCameraParameters.end()) {
760 it_edge->second->display(*it_img->second, it_camPose->second, it_cam->second, col, thickness, displayFullModel);
762 std::cerr <<
"Missing elements !" << std::endl;
773 std::vector<std::string> cameraNames;
775 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it_edge =
m_mapOfEdgeTrackers.begin();
777 cameraNames.push_back(it_edge->first);
792 it->second->getCameraParameters(camera);
794 std::cerr <<
"The reference camera name: " <<
m_referenceCameraName <<
" does not exist !" << std::endl;
807 it->second->getCameraParameters(cam1);
810 it->second->getCameraParameters(cam2);
812 std::cerr <<
"Problem with the number of cameras ! There are "
824 std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.find(cameraName);
826 it->second->getCameraParameters(camera);
828 std::cerr <<
"The camera: " << cameraName <<
" does not exist !" << std::endl;
839 mapOfCameraParameters.clear();
841 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
844 it->second->getCameraParameters(cam_);
845 mapOfCameraParameters[it->first] = cam_;
856 std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.find(cameraName);
858 return it->second->getClipping();
860 std::cerr <<
"Cannot find camera: " << cameraName << std::endl;
874 return it->second->getFaces();
887 std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.find(cameraName);
889 return it->second->getFaces();
892 std::cerr <<
"The camera: " << cameraName <<
" cannot be found !" << std::endl;
902 std::map<std::string, vpMbHiddenFaces<vpMbtPolygon> > mapOfFaces;
903 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
905 mapOfFaces[it->first] = it->second->faces;
925 it_edge->second->getLcircle(circlesList, level);
943 const unsigned int level)
const {
944 std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.find(cameraName);
946 it->second->getLcircle(circlesList, level);
948 std::cerr <<
"The camera: " << cameraName <<
" does not exist !" << std::endl;
966 it_edge->second->getLcylinder(cylindersList, level);
984 const unsigned int level)
const {
985 std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.find(cameraName);
987 it->second->getLcylinder(cylindersList, level);
989 std::cerr <<
"The camera: " << cameraName <<
" does not exist !" << std::endl;
1007 it_edge->second->getLline(linesList, level);
1025 const unsigned int level)
const {
1026 std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.find(cameraName);
1028 it->second->getLline(linesList, level);
1030 std::cerr <<
"The camera: " << cameraName <<
" does not exist !" << std::endl;
1043 it_edge->second->getMovingEdge(p_me);
1058 it_edge->second->getMovingEdge(me_tmp);
1074 std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.find(cameraName);
1076 it->second->getMovingEdge(p_me);
1078 std::cerr <<
"The camera: " << cameraName <<
" does not exist !" << std::endl;
1110 unsigned int nbGoodPoints = 0;
1113 nbGoodPoints += it_edge->second->getNbPoints(level);
1118 return nbGoodPoints;
1135 std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
1138 return it->second->getNbPoints(level);
1140 std::cerr <<
"The camera: " << cameraName <<
" does not exist !"
1155 return it->second->getNbPolygon();
1158 std::cerr <<
"The reference camera: " <<
m_referenceCameraName <<
" cannot be found !" << std::endl;
1168 std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.find(cameraName);
1170 return it->second->getNbPolygon();
1173 std::cerr <<
"The camera: " << cameraName <<
" cannot be found !" << std::endl;
1183 std::map<std::string, unsigned int> mapOfNbPolygons;
1184 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
1186 mapOfNbPolygons[it->first] = it->second->getNbPolygon();
1189 return mapOfNbPolygons;
1200 std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
1202 it->second->getPose(c1Mo);
1205 it->second->getPose(c2Mo);
1207 std::cerr <<
"Require two cameras ! There are "
1221 std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.find(cameraName);
1223 it->second->getPose(cMo_);
1225 std::cerr <<
"The camera: " << cameraName <<
" does not exist !" << std::endl;
1236 mapOfCameraPoses.clear();
1238 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
1241 it->second->getPose(cMo_);
1242 mapOfCameraPoses[it->first] = cMo_;
1249 #ifdef VISP_HAVE_MODULE_GUI
1260 const std::string &displayFile) {
1269 it->second->initClick(I, points3D_list, displayFile);
1270 it->second->getPose(
cMo);
1272 std::stringstream ss;
1308 it->second->initClick(I, initFile, displayHelp);
1309 it->second->getPose(
cMo);
1311 std::stringstream ss;
1342 const std::string& initFile1,
const std::string& initFile2,
const bool displayHelp,
const bool firstCameraIsReference) {
1344 std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
1345 it->second->initClick(I1, initFile1, displayHelp);
1347 if(firstCameraIsReference) {
1349 it->second->getPose(
cMo);
1352 it->second->getCameraParameters(this->
cam);
1357 it->second->initClick(I2, initFile2, displayHelp);
1359 if(!firstCameraIsReference) {
1361 it->second->getPose(
cMo);
1364 it->second->getCameraParameters(this->
cam);
1367 std::stringstream ss;
1368 ss <<
"Cannot init click ! Require two cameras but there are " <<
m_mapOfEdgeTrackers.size() <<
" cameras !";
1395 const std::string &initFile,
const bool displayHelp) {
1398 std::map<std::string, const vpImage<unsigned char> *>::const_iterator it_img = mapOfImages.find(
m_referenceCameraName);
1400 if(it_img != mapOfImages.end()) {
1402 it_edge->second->initClick(*it_img->second, initFile, displayHelp);
1405 it_edge->second->getPose(
cMo);
1410 it_img = mapOfImages.find(it_edge->first);
1411 std::map<std::string, vpHomogeneousMatrix>::const_iterator it_camTrans =
1416 it_edge->second->setPose(*it_img->second, cCurrentMo);
1418 std::stringstream ss;
1425 std::stringstream ss;
1430 std::stringstream ss;
1459 const std::map<std::string, std::string> &mapOfInitFiles,
const bool displayHelp) {
1461 std::map<std::string, const vpImage<unsigned char>* >::const_iterator it_img = mapOfImages.find(
m_referenceCameraName);
1462 std::map<std::string, std::string>::const_iterator it_initFile = mapOfInitFiles.find(
m_referenceCameraName);
1464 if(it_edge !=
m_mapOfEdgeTrackers.end() && it_img != mapOfImages.end() && it_initFile != mapOfInitFiles.end()) {
1466 it_edge->second->initClick(*it_img->second, it_initFile->second, displayHelp);
1469 it_edge->second->getPose(
cMo);
1475 std::vector<std::string> vectorOfMissingCameraPoses;
1480 it_img = mapOfImages.find(it_edge->first);
1481 it_initFile = mapOfInitFiles.find(it_edge->first);
1483 if(it_img != mapOfImages.end() && it_initFile != mapOfInitFiles.end()) {
1484 it_edge->second->initClick(*it_img->second, it_initFile->second, displayHelp);
1486 vectorOfMissingCameraPoses.push_back(it_edge->first);
1492 for(std::vector<std::string>::const_iterator it1 = vectorOfMissingCameraPoses.begin();
1493 it1 != vectorOfMissingCameraPoses.end(); ++it1) {
1494 it_img = mapOfImages.find(*it1);
1501 std::stringstream ss;
1502 ss <<
"Missing image or missing camera transformation matrix ! Cannot set the pose for camera: " << (*it1) <<
" !";
1507 #endif //#ifdef VISP_HAVE_MODULE_GUI
1533 char s[FILENAME_MAX];
1534 std::fstream finit ;
1537 std::string ext =
".pos";
1538 size_t pos = initFile.rfind(ext);
1540 if( pos == initFile.size()-ext.size() && pos != 0)
1541 sprintf(s,
"%s", initFile.c_str());
1543 sprintf(s,
"%s.pos", initFile.c_str());
1545 finit.open(s,std::ios::in) ;
1547 std::cerr <<
"cannot read " << s << std::endl;
1551 for (
unsigned int i = 0; i < 6; i += 1){
1552 finit >> init_pos[i];
1564 it_ref->second->cMo =
cMo;
1565 it_ref->second->
init(I);
1576 std::stringstream ss;
1577 ss <<
"This method requires exactly one camera, there are " <<
m_mapOfEdgeTrackers.size() <<
" cameras !";
1589 it_ref->second->cMo =
cMo;
1590 it_ref->second->
init(I);
1640 const std::map<std::string, vpHomogeneousMatrix> &mapOfCameraPoses) {
1650 it != mapOfImages.end(); ++it) {
1651 pyramid[it->first].resize(
scales.size());
1711 it->second->loadConfigFile(configFile);
1712 it->second->getCameraParameters(
cam);
1715 this->
me = it->second->getMovingEdge();
1722 std::stringstream ss;
1744 const bool firstCameraIsReference) {
1746 std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
1747 it->second->loadConfigFile(configFile1);
1749 if(firstCameraIsReference) {
1750 it->second->getCameraParameters(
cam);
1753 this->
me = it->second->getMovingEdge();
1762 it->second->loadConfigFile(configFile2);
1764 if(!firstCameraIsReference) {
1765 it->second->getCameraParameters(
cam);
1768 this->
me = it->second->getMovingEdge();
1776 std::stringstream ss;
1777 ss <<
"Cannot loadConfigFile. Require two cameras ! There are " <<
m_mapOfEdgeTrackers.size() <<
" cameras !";
1796 for(std::map<std::string, vpMbEdgeTracker*>::const_iterator it_edge =
m_mapOfEdgeTrackers.begin();
1798 std::map<std::string, std::string>::const_iterator it_config = mapOfConfigFiles.find(it_edge->first);
1799 if(it_config != mapOfConfigFiles.end()) {
1800 it_edge->second->loadConfigFile(it_config->second);
1802 std::stringstream ss;
1803 ss <<
"Missing configuration file for camera: " << it_edge->first <<
" !";
1811 it->second->getCameraParameters(
cam);
1814 this->
me = it->second->getMovingEdge();
1821 std::stringstream ss;
1853 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
1855 it->second->loadModel(modelFile, verbose);
1873 std::stringstream ss;
1874 ss <<
"This method requires exactly one camera, there are " <<
m_mapOfEdgeTrackers.size() <<
" cameras !";
1880 it_edge->second->reInitModel(I, cad_name, cMo_, verbose);
1883 it_edge->second->getPose(
cMo);
1903 const bool verbose,
const bool firstCameraIsReference) {
1905 std::map<std::string, vpMbEdgeTracker *>::const_iterator it_edge =
m_mapOfEdgeTrackers.begin();
1907 it_edge->second->reInitModel(I1, cad_name, c1Mo, verbose);
1909 if(firstCameraIsReference) {
1911 it_edge->second->getPose(
cMo);
1916 it_edge->second->reInitModel(I2, cad_name, c2Mo, verbose);
1918 if(!firstCameraIsReference) {
1920 it_edge->second->getPose(
cMo);
1937 const std::string &cad_name,
const std::map<std::string, vpHomogeneousMatrix> &mapOfCameraPoses,
1938 const bool verbose) {
1940 std::map<std::string, const vpImage<unsigned char> *>::const_iterator it_img = mapOfImages.find(
m_referenceCameraName);
1941 std::map<std::string, vpHomogeneousMatrix>::const_iterator it_camPose = mapOfCameraPoses.find(
m_referenceCameraName);
1943 if(it_edge !=
m_mapOfEdgeTrackers.end() && it_img != mapOfImages.end() && it_camPose != mapOfCameraPoses.end()) {
1944 it_edge->second->reInitModel(*it_img->second, cad_name, it_camPose->second, verbose);
1948 it_edge->second->getPose(
cMo);
1953 std::vector<std::string> vectorOfMissingCameras;
1956 it_img = mapOfImages.find(it_edge->first);
1957 it_camPose = mapOfCameraPoses.find(it_edge->first);
1959 if(it_img != mapOfImages.end() && it_camPose != mapOfCameraPoses.end()) {
1960 it_edge->second->reInitModel(*it_img->second, cad_name, it_camPose->second, verbose);
1962 vectorOfMissingCameras.push_back(it_edge->first);
1967 for(std::vector<std::string>::const_iterator it = vectorOfMissingCameras.begin();
1968 it != vectorOfMissingCameras.end(); ++it) {
1969 it_img = mapOfImages.find(*it);
1987 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
1989 it->second->resetTracker();
1994 #ifdef VISP_HAVE_OGRE
2027 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2029 it->second->setAngleAppear(a);
2045 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2047 it->second->setAngleDisappear(a);
2064 it->second->setCameraParameters(camera);
2069 std::stringstream ss;
2084 const bool firstCameraIsReference) {
2088 std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2089 it->second->setCameraParameters(camera1);
2092 it->second->setCameraParameters(camera2);
2094 if(firstCameraIsReference) {
2095 this->
cam = camera1;
2097 this->
cam = camera2;
2100 std::stringstream ss;
2113 std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.find(cameraName);
2115 it->second->setCameraParameters(camera);
2121 std::stringstream ss;
2122 ss <<
"The camera: " << cameraName <<
" does not exist !";
2133 for(std::map<std::string, vpMbEdgeTracker*>::const_iterator it_edge =
m_mapOfEdgeTrackers.begin();
2135 std::map<std::string, vpCameraParameters>::const_iterator it_cam = mapOfCameraParameters.find(it_edge->first);
2136 if(it_cam != mapOfCameraParameters.end()) {
2137 it_edge->second->setCameraParameters(it_cam->second);
2140 this->
cam = it_cam->second;
2143 std::stringstream ss;
2144 ss <<
"Missing camera parameters for camera: " << it_edge->first <<
" !";
2160 it->second = cameraTransformationMatrix;
2162 std::stringstream ss;
2163 ss <<
"Cannot find camera: " << cameraName <<
" !";
2175 const std::map<std::string, vpHomogeneousMatrix> &mapOfTransformationMatrix) {
2177 for(std::map<std::string, vpMbEdgeTracker*>::const_iterator it_edge =
m_mapOfEdgeTrackers.begin();
2179 std::map<std::string, vpHomogeneousMatrix>::const_iterator it_camTrans = mapOfTransformationMatrix.find(it_edge->first);
2181 if(it_camTrans == mapOfTransformationMatrix.end()) {
2200 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2202 it->second->setClipping(flags);
2216 std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.find(cameraName);
2218 it->second->setClipping(flags);
2220 std::cerr <<
"Camera: " << cameraName <<
" does not exist !" << std::endl;
2232 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2234 it->second->setCovarianceComputation(flag);
2250 for(std::map<std::string, vpMbEdgeTracker*>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2252 it->second->setDisplayFeatures(displayF);
2266 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2268 it->second->setFarClippingDistance(dist);
2279 std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.find(cameraName);
2281 it->second->setFarClippingDistance(dist);
2283 std::cerr <<
"Camera: " << cameraName <<
" does not exist !" << std::endl;
2300 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2302 it->second->setGoodMovingEdgesRatioThreshold(threshold);
2308 #ifdef VISP_HAVE_OGRE
2317 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2319 it->second->setGoodNbRayCastingAttemptsRatio(ratio);
2332 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2334 it->second->setNbRayCastingAttemptsForVisibility(attempts);
2349 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2351 it->second->setLod(useLod, name);
2366 std::map<std::string, vpMbEdgeTracker *>::const_iterator it_edge =
m_mapOfEdgeTrackers.find(cameraName);
2369 it_edge->second->setLod(useLod, name);
2371 std::cerr <<
"The camera: " << cameraName <<
" cannot be found !" << std::endl;
2384 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2386 it->second->setMinLineLengthThresh(minLineLengthThresh, name);
2400 const std::string &name) {
2401 std::map<std::string, vpMbEdgeTracker *>::const_iterator it_edge =
m_mapOfEdgeTrackers.find(cameraName);
2404 it_edge->second->setMinLineLengthThresh(minLineLengthThresh, name);
2406 std::cerr <<
"The camera: " << cameraName <<
" cannot be found !" << std::endl;
2419 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2421 it->second->setMinPolygonAreaThresh(minPolygonAreaThresh, name);
2435 const std::string &name) {
2436 std::map<std::string, vpMbEdgeTracker *>::const_iterator it_edge =
m_mapOfEdgeTrackers.find(cameraName);
2439 it_edge->second->setMinPolygonAreaThresh(minPolygonAreaThresh, name);
2441 std::cerr <<
"The camera: " << cameraName <<
" cannot be found !" << std::endl;
2451 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2453 it->second->setMovingEdge(me);
2464 std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.find(cameraName);
2466 it->second->setMovingEdge(me);
2468 std::cerr <<
"Camera: " << cameraName <<
" does not exist !" << std::endl;
2480 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2482 it->second->setNearClippingDistance(dist);
2493 std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.find(cameraName);
2495 it->second->setNearClippingDistance(dist);
2497 std::cerr <<
"Camera: " << cameraName <<
" does not exist !" << std::endl;
2512 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2514 it->second->setOgreShowConfigDialog(showConfigDialog);
2526 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2528 it->second->setOgreVisibilityTest(v);
2531 #ifdef VISP_HAVE_OGRE
2532 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2534 it->second->faces.getOgreContext()->setWindowName(
"Multi MBT Edge (" + it->first +
")");
2547 for(std::map<std::string, vpMbEdgeTracker*>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2549 it->second->setOptimizationMethod(opt);
2566 it->second->setPose(I, cMo_);
2569 std::stringstream ss;
2574 std::stringstream ss;
2575 ss <<
"You are trying to set the pose with only one image and cMo but there are multiple cameras !";
2593 std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2594 it->second->setPose(I1, c1Mo);
2598 it->second->setPose(I2, c2Mo);
2600 if(firstCameraIsReference) {
2606 std::stringstream ss;
2607 ss <<
"This method requires 2 cameras but there are " <<
m_mapOfEdgeTrackers.size() <<
" cameras !";
2624 std::map<std::string, const vpImage<unsigned char> *>::const_iterator it_img = mapOfImages.find(
m_referenceCameraName);
2626 if(it_img != mapOfImages.end()) {
2628 it_edge->second->setPose(*it_img->second, cMo_);
2636 it_img = mapOfImages.find(it_edge->first);
2637 std::map<std::string, vpHomogeneousMatrix>::const_iterator it_camTrans =
2642 it_edge->second->setPose(*it_img->second, cCurrentMo);
2649 std::stringstream ss;
2654 std::stringstream ss;
2670 const std::map<std::string, vpHomogeneousMatrix> &mapOfCameraPoses) {
2673 std::map<std::string, const vpImage<unsigned char>* >::const_iterator it_img = mapOfImages.find(
m_referenceCameraName);
2674 std::map<std::string, vpHomogeneousMatrix>::const_iterator it_camPose = mapOfCameraPoses.find(
m_referenceCameraName);
2676 if(it_edge !=
m_mapOfEdgeTrackers.end() && it_img != mapOfImages.end() && it_camPose != mapOfCameraPoses.end()) {
2677 it_edge->second->setPose(*it_img->second, it_camPose->second);
2678 it_edge->second->getPose(
cMo);
2684 std::vector<std::string> vectorOfMissingCameraPoses;
2689 it_img = mapOfImages.find(it_edge->first);
2690 it_camPose = mapOfCameraPoses.find(it_edge->first);
2692 if(it_img != mapOfImages.end() && it_camPose != mapOfCameraPoses.end()) {
2694 it_edge->second->setPose(*it_img->second, it_camPose->second);
2696 vectorOfMissingCameraPoses.push_back(it_edge->first);
2701 for(std::vector<std::string>::const_iterator it1 = vectorOfMissingCameraPoses.begin();
2702 it1 != vectorOfMissingCameraPoses.end(); ++it1) {
2703 it_img = mapOfImages.find(*it1);
2710 std::stringstream ss;
2711 ss <<
"Missing image or missing camera transformation matrix ! Cannot set the pose for camera: " << (*it1) <<
" !";
2727 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2729 it->second->setProjectionErrorComputation(flag);
2739 std::map<std::string, vpMbEdgeTracker*>::const_iterator it =
m_mapOfEdgeTrackers.find(referenceCameraName);
2743 std::stringstream ss;
2744 ss <<
"The reference camera: " << referenceCameraName <<
" does not exist !";
2771 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2773 it->second->setScales(scale);
2786 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2788 it->second->setScanLineVisibilityTest(v);
2799 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2801 it->second->setUseEdgeTracking(name, useEdgeTracking);
2818 it->second->track(I);
2819 it->second->getPose(
cMo);
2821 std::stringstream ss;
2843 std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2844 std::map<std::string, const vpImage<unsigned char> *> mapOfImages;
2845 mapOfImages[it->first] = &I1;
2848 mapOfImages[it->first] = &I2;
2851 std::stringstream ss;
2866 for(std::map<std::string, vpMbEdgeTracker*>::const_iterator it_edge =
m_mapOfEdgeTrackers.begin();
2868 std::map<std::string, const vpImage<unsigned char>* >::const_iterator it_img = mapOfImages.find(it_edge->first);
2870 if(it_img == mapOfImages.end()) {
2878 unsigned int lvl = (
unsigned int)
scales.size();
2889 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it1 =
m_mapOfEdgeTrackers.begin();
2892 it1->second->downScale(lvl);
2898 vpTRACE(
"Error in moving edge tracking") ;
2904 std::map<std::string, const vpImage<unsigned char> *> mapOfPyramidImages;
2907 mapOfPyramidImages[it->first] = it->second[lvl];
2918 bool isOneTestTrackingOk =
false;
2919 for(std::map<std::string, vpMbEdgeTracker*>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2925 it->second->testTracking();
2926 isOneTestTrackingOk =
true;
2932 if(!isOneTestTrackingOk) {
2933 std::ostringstream oss;
2934 oss <<
"Not enough moving edges to track the object. Try to reduce the threshold="
2935 <<
percentageGdPt <<
" using setGoodMovingEdgesRatioThreshold()";
2941 for(std::map<std::string, vpMbEdgeTracker*>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2943 it->second->displayFeaturesOnImage(*mapOfImages[it->first], lvl);
2948 bool newvisibleface =
false;
2949 for(std::map<std::string, vpMbEdgeTracker*>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2951 it->second->visibleFace(*mapOfImages[it->first], it->second->cMo, newvisibleface);
2955 for(std::map<std::string, vpMbEdgeTracker*>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2957 it->second->faces.computeClippedPolygons(it->second->cMo, it->second->cam);
2958 it->second->faces.computeScanLineRender(it->second->cam, mapOfImages[it->first]->getWidth(),
2959 mapOfImages[it->first]->getHeight());
2964 for(std::map<std::string, vpMbEdgeTracker*>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2966 it->second->updateMovingEdge(*mapOfImages[it->first]);
2972 for(std::map<std::string, vpMbEdgeTracker*>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2974 it->second->initMovingEdge(*mapOfImages[it->first], it->second->cMo);
2977 it->second->reinitMovingEdge(*mapOfImages[it->first], it->second->cMo);
2981 it->second->computeProjectionError(*mapOfImages[it->first]);
2988 for(std::map<std::string, vpMbEdgeTracker*>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2990 it->second->upScale(lvl);
3000 for(std::map<std::string, vpMbEdgeTracker*>::const_iterator it =
m_mapOfEdgeTrackers.begin();
3002 it->second->cMo = cMo_1;
3003 it->second->reInitLevel(lvl);
3004 it->second->upScale(lvl);
3009 for(std::map<std::string, vpMbEdgeTracker*>::const_iterator it =
m_mapOfEdgeTrackers.begin();
3011 it->second->upScale(lvl);
bool computeProjError
Flag used to specify if the gradient error criteria has to be computed or not.
std::string m_referenceCameraName
Name of the reference camera.
virtual void setCovarianceComputation(const bool &flag)
void computeVVSFirstPhasePoseEstimation(const unsigned int nerror, const unsigned int iter, const vpColVector &factor, vpColVector &weighted_error, vpMatrix &L, bool &isoJoIdentity_)
Implementation of a matrix and operations on matrices.
virtual void setUseEdgeTracking(const std::string &name, const bool &useEdgeTracking)
vpMatrix covarianceMatrix
Covariance matrix.
virtual void loadModel(const std::string &modelFile, const bool verbose=false)
virtual void setMinLineLengthThresh(const double minLineLengthThresh, const std::string &name="")
virtual void setFarClippingDistance(const double &dist)
static vpMatrix computeCovarianceMatrixVVS(const vpHomogeneousMatrix &cMo, const vpColVector &deltaS, const vpMatrix &Ls, const vpMatrix &W)
virtual void setLod(const bool useLod, const std::string &name="")
void upScale(const unsigned int _scale)
virtual unsigned int getClipping() const
void stack(const double &d)
virtual void setAngleDisappear(const double &a)
void resize(const unsigned int nrows, const unsigned int ncols, const bool flagNullify=true)
vpMbHiddenFaces< vpMbtPolygon > faces
Set of faces describing the object.
virtual void computeProjectionError()
void setNbRayCastingAttemptsForVisibility(const unsigned int &attempts)
virtual void setDisplayFeatures(const bool displayF)
Implementation of an homogeneous matrix and operations on such kind of matrices.
double lambda
The gain of the virtual visual servoing stage.
virtual void initFromPose(const vpImage< unsigned char > &I, const std::string &initFile)
virtual std::map< std::string, unsigned int > getMultiNbPolygon() const
Class to define colors available for display functionnalities.
virtual void track(const vpImage< unsigned char > &I)
vpHomogeneousMatrix cMo
The current pose.
void stack(const vpMatrix &A)
virtual void setProjectionErrorComputation(const bool &flag)
virtual void loadConfigFile(const std::string &configFile)
bool modelInitialised
Flag used to ensure that the CAD model is loaded before the initialisation.
virtual void cleanPyramid(std::map< std::string, std::vector< const vpImage< unsigned char > * > > &pyramid)
error that can be emited by ViSP classes.
void reInitLevel(const unsigned int _lvl)
virtual vpMe getMovingEdge() const
virtual void setClipping(const unsigned int &flags)
virtual void setOgreShowConfigDialog(const bool showConfigDialog)
bool useOgre
Use Ogre3d for visibility tests.
bool computeCovariance
Flag used to specify if the covariance matrix has to be computed or not.
vpMe me
The moving edges parameters.
virtual unsigned int getNbPolygon() const
virtual void setReferenceCameraName(const std::string &referenceCameraName)
virtual void setNearClippingDistance(const double &dist)
void downScale(const unsigned int _scale)
void computeVVSSecondPhasePoseEstimation(const unsigned int nerror, vpMatrix &L, vpMatrix &L_true, vpMatrix &LVJ_true, vpColVector &W_true, const vpColVector &factor, const unsigned int iter, const bool isoJoIdentity_, vpColVector &weighted_error, double &mu, vpColVector &m_error_prev, vpColVector &m_w_prev, vpHomogeneousMatrix &cMoPrev, double &residu_1, double &r)
vpCameraParameters cam
The camera parameters.
double projectionError
Error angle between the gradient direction of the model features projected at the resulting pose and ...
virtual 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)
void setGoodNbRayCastingAttemptsRatio(const double &ratio)
std::vector< bool > scales
Vector of scale level to use for the multi-scale tracking.
virtual void initClick(const vpImage< unsigned char > &I, const std::vector< vpPoint > &points3D_list, const std::string &displayFile="")
std::map< std::string, vpHomogeneousMatrix > m_mapOfCameraTransformationMatrix
Map of camera transformation matrix between the current camera frame to the reference camera frame (c...
Error that can be emited by the vpTracker class and its derivates.
void init(const vpImage< unsigned char > &I)
vp_deprecated void init()
virtual vpHomogeneousMatrix getPose() const
virtual void setOgreVisibilityTest(const bool &v)
void diag(const double &val=1.0)
bool useScanLine
Use Scanline for visibility tests.
vpVelocityTwistMatrix buildFrom(const vpTranslationVector &t, const vpRotationMatrix &R)
virtual void computeVVS(std::map< std::string, const vpImage< unsigned char > * > &mapOfImages, const unsigned int lvl)
static double sqr(double x)
void computeVVSSecondPhaseCheckLevenbergMarquardt(const unsigned int iter, const unsigned int nbrow, const vpColVector &m_error_prev, const vpColVector &m_w_prev, const vpHomogeneousMatrix &cMoPrev, double &mu, bool &reStartFromLastIncrement)
virtual void setScanLineVisibilityTest(const bool &v)
virtual void setPose(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
virtual void setCameraParameters(const vpCameraParameters &camera)
vpColVector m_error
Error s-s*.
unsigned int nbFeaturesForProjErrorComputation
Number of features used in the computation of the projection error.
void getLcircle(std::list< vpMbtDistanceCircle * > &circlesList, const unsigned int level=0) const
Generic class defining intrinsic camera parameters.
virtual void setCameraTransformationMatrix(const std::string &cameraName, const vpHomogeneousMatrix &cameraTransformationMatrix)
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 getLline(std::list< vpMbtDistanceLine * > &linesList, const unsigned int level=0) const
virtual void setMinPolygonAreaThresh(const double minPolygonAreaThresh, const std::string &name="")
virtual void setAngleAppear(const double &a)
Implementation of a velocity twist matrix and operations on such kind of matrices.
vpMbtOptimizationMethod m_optimizationMethod
Optimization method used.
unsigned int getRows() const
Return the number of rows of the 2D array.
double angleAppears
Angle used to detect a face appearance.
virtual void setCovarianceComputation(const bool &flag)
void buildFrom(const vpTranslationVector &t, const vpRotationMatrix &R)
static double rad(double deg)
virtual void resetTracker()
virtual void setMovingEdge(const vpMe &me)
virtual void setScales(const std::vector< bool > &scales)
void setScales(const std::vector< bool > &_scales)
std::map< std::string, std::vector< const vpImage< unsigned char > * > > m_mapOfPyramidalImages
Map of pyramidal images for each camera.
static double deg(double rad)
bool displayFeatures
If true, the features are displayed.
virtual void getCameraParameters(vpCameraParameters &camera) const
Implementation of column vector and the associated operations.
Implementation of a pose vector and operations on poses.
virtual vpMbHiddenFaces< vpMbtPolygon > & getFaces()
Contains an M-Estimator and various influence function.
double angleDisappears
Angle used to detect a face disappearance.
void getLcylinder(std::list< vpMbtDistanceCylinder * > &cylindersList, const unsigned int level=0) const
virtual std::vector< std::string > getCameraNames() const
virtual unsigned int getNbPoints(const unsigned int level=0) const
virtual void setScanLineVisibilityTest(const bool &v)
virtual void setClipping(const unsigned int &flags)
virtual void setAngleDisappear(const double &a)
virtual void setGoodMovingEdgesRatioThreshold(const double threshold)
virtual ~vpMbEdgeMultiTracker()
unsigned int clippingFlag
Flags specifying which clipping to used.
virtual void setFarClippingDistance(const double &dist)
std::map< std::string, vpMbEdgeTracker * > m_mapOfEdgeTrackers
Map of Model-based edge trackers.
virtual void setOptimizationMethod(const vpMbtOptimizationMethod &opt)
virtual void reInitModel(const vpImage< unsigned char > &I, const std::string &cad_name, const vpHomogeneousMatrix &cMo_, const bool verbose=false)
bool isoJoIdentity
Boolean to know if oJo is identity (for fast computation)
virtual void setAngleAppear(const double &a)
virtual void computeVVSSecondPhaseWeights(const unsigned int iter, const unsigned int nerror, vpColVector &weighted_error, vpColVector &w_lines, vpColVector &w_cylinders, vpColVector &w_circles, std::map< std::string, unsigned int > &mapOfNumberOfLines, std::map< std::string, unsigned int > &mapOfNumberOfCylinders, std::map< std::string, unsigned int > &mapOfNumberOfCircles, std::map< std::string, vpColVector > &mapOfWeightLines, std::map< std::string, vpColVector > &mapOfWeightCylinders, std::map< std::string, vpColVector > &mapOfWeightCircles, std::map< std::string, vpColVector > &mapOfErrorLines, std::map< std::string, vpColVector > &mapOfErrorCylinders, std::map< std::string, vpColVector > &mapOfErrorCircles, std::map< std::string, vpRobust > &mapOfRobustLines, std::map< std::string, vpRobust > &mapOfRobustCylinders, std::map< std::string, vpRobust > &mapOfRobustCircles, double threshold)
virtual void initPyramid(const std::map< std::string, const vpImage< unsigned char > * > &mapOfImages, std::map< std::string, std::vector< const vpImage< unsigned char > * > > &pyramid)
void resize(const unsigned int i, const bool flagNullify=true)
vpColVector m_w
Weights used in the robust scheme.
virtual void setProjectionErrorComputation(const bool &flag)
virtual void setNearClippingDistance(const double &dist)