45 #include <visp3/core/vpConfig.h>
47 #if (defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100))
49 #include <visp3/core/vpTrackingException.h>
50 #include <visp3/core/vpVelocityTwistMatrix.h>
51 #include <visp3/mbt/vpMbEdgeKltMultiTracker.h>
59 compute_interaction(true), lambda(0.8), m_factorKLT(0.65), m_factorMBT(0.35),
60 thresholdKLT(2.), thresholdMBT(2.), maxIter(200),
61 m_mapOfCameraTransformationMatrix(), m_referenceCameraName(
"Camera") {
73 compute_interaction(true), lambda(0.8), m_factorKLT(0.65), m_factorMBT(0.35),
74 thresholdKLT(2.), thresholdMBT(2.), maxIter(200),
75 m_mapOfCameraTransformationMatrix(), m_referenceCameraName(
"Camera") {
79 }
else if(nbCameras == 1) {
82 }
else if(nbCameras == 2) {
90 for(
unsigned int i = 1; i <= nbCameras; i++) {
110 compute_interaction(true), lambda(0.8), m_factorKLT(0.65), m_factorMBT(0.35),
111 thresholdKLT(2.), thresholdMBT(2.), maxIter(200),
112 m_mapOfCameraTransformationMatrix(), m_referenceCameraName(
"Camera") {
121 std::map<std::string, unsigned int> &mapOfNumberOfRows, std::map<std::string, unsigned int> &mapOfNbInfos,
128 std::vector<FeatureType> indexOfFeatures;
129 std::map<std::string, unsigned int> mapOfNumberOfLines;
130 std::map<std::string, unsigned int> mapOfNumberOfCylinders;
131 std::map<std::string, unsigned int> mapOfNumberOfCircles;
134 unsigned int nbrow =
trackFirstLoop(mapOfImages, factor, indexOfFeatures,
135 mapOfNumberOfRows, mapOfNumberOfLines, mapOfNumberOfCylinders, mapOfNumberOfCircles, lvl);
138 unsigned int nbInfos = 0;
139 for(std::map<std::string, unsigned int>::const_iterator it = mapOfNbInfos.begin(); it != mapOfNbInfos.end(); ++it) {
140 nbInfos += it->second;
143 if(nbInfos < 4 && nbrow < 4) {
145 }
else if(nbrow < 4) {
162 std::cerr <<
"There are less than 4 KLT features, set factorKLT = 1. !" << std::endl;
167 std::cerr <<
"There are less than 4 moving edges, set factorMBT = 1. !" << std::endl;
181 std::map<std::string, vpVelocityTwistMatrix> mapOfVelocityTwist;
186 mapOfVelocityTwist[it->first] = cVo;
191 std::map<std::string, vpRobust> mapOfEdgeRobustLines;
192 std::map<std::string, vpRobust> mapOfEdgeRobustCylinders;
193 std::map<std::string, vpRobust> mapOfEdgeRobustCircles;
195 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
197 mapOfEdgeRobustLines[it->first] =
vpRobust(mapOfNumberOfLines[it->first]);
198 mapOfEdgeRobustLines[it->first].setIteration(0);
200 mapOfEdgeRobustCylinders[it->first] =
vpRobust(mapOfNumberOfCylinders[it->first]);
201 mapOfEdgeRobustCylinders[it->first].setIteration(0);
203 mapOfEdgeRobustCircles[it->first] =
vpRobust(mapOfNumberOfCircles[it->first]);
204 mapOfEdgeRobustCircles[it->first].setIteration(0);
208 std::map<std::string, vpRobust> mapOfKltRobusts;
209 for(std::map<std::string, vpMbKltTracker*>::const_iterator it =
m_mapOfKltTrackers.begin();
211 mapOfKltRobusts[it->first] =
vpRobust(2*mapOfNbInfos[it->first]);
225 std::map<std::string, vpColVector> mapOfWeightLines;
226 std::map<std::string, vpColVector> mapOfWeightCylinders;
227 std::map<std::string, vpColVector> mapOfWeightCircles;
231 double residu_1 = -1;
232 unsigned int iter = 0;
246 while( ((
int)((residu - residu_1)*1e8) !=0 ) && (iter<
maxIter) ){
252 error_cylinders.
resize(0);
255 std::map<std::string, vpColVector> mapOfErrorLines;
256 std::map<std::string, vpColVector> mapOfErrorCylinders;
257 std::map<std::string, vpColVector> mapOfErrorCircles;
262 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
264 vpMatrix L_tmp(mapOfNumberOfRows[it->first], 6);
265 vpColVector error_lines_tmp(mapOfNumberOfLines[it->first]);
266 vpColVector error_cylinders_tmp(mapOfNumberOfCylinders[it->first]);
267 vpColVector error_circles_tmp(mapOfNumberOfCircles[it->first]);
273 R_tmp.
resize(mapOfNumberOfRows[it->first]);
274 it->second->computeVVSSecondPhase(*mapOfImages[it->first], L_tmp, error_lines_tmp,
275 error_cylinders_tmp, error_circles_tmp, R_tmp, 0);
277 it->second->m_w = R_tmp;
278 L_tmp = L_tmp*mapOfVelocityTwist[it->first];
285 error_lines.
stack(error_lines_tmp);
286 error_cylinders.
stack(error_cylinders_tmp);
287 error_circles.
stack(error_circles_tmp);
289 mapOfErrorLines[it->first] = error_lines_tmp;
290 mapOfErrorCylinders[it->first] = error_cylinders_tmp;
291 mapOfErrorCircles[it->first] = error_circles_tmp;
298 for(std::map<std::string, vpMbKltTracker*>::const_iterator it1 =
m_mapOfKltTrackers.begin();
300 if(mapOfNbInfos[it1->first] > 0) {
301 unsigned int shift = 0;
306 R_current.
resize(2 * mapOfNbInfos[it1->first]);
307 L_current.
resize(2 * mapOfNbInfos[it1->first], 6, 0);
314 it1->second->kltPolygons, it1->second->kltCylinders,
ctTc0);
319 it1->second->kltPolygons, it1->second->kltCylinders, c_curr_tTc_curr0);
323 L_current = L_current*mapOfVelocityTwist[it1->first];
326 R_klt.
stack(R_current);
327 L_klt.
stack(L_current);
332 bool reStartFromLastIncrement =
false;
345 reStartFromLastIncrement =
true;
353 w_true.
resize(nbrow + 2*nbInfos);
356 if(!reStartFromLastIncrement) {
364 mapOfNumberOfCylinders, mapOfNumberOfCircles, mapOfWeightLines, mapOfWeightCylinders, mapOfWeightCircles,
365 mapOfErrorLines, mapOfErrorCylinders, mapOfErrorCircles, mapOfEdgeRobustLines, mapOfEdgeRobustCylinders,
368 for(
unsigned int cpt = 0, cpt_lines = 0, cpt_cylinders = 0, cpt_circles = 0; cpt < nbrow; cpt++) {
369 switch(indexOfFeatures[cpt]) {
371 w_mbt[cpt] = w_lines[cpt_lines];
376 w_mbt[cpt] = w_cylinders[cpt_cylinders];
381 w_mbt[cpt] = w_circles[cpt_circles];
386 std::cerr <<
"Problem with feature type !" << std::endl;
412 unsigned int cpt = 0;
413 while( cpt < (nbrow + 2*nbInfos) ) {
414 if(cpt < (
unsigned int) nbrow) {
415 m_w[cpt] = ((w_mbt[cpt] * factor[cpt]) * factorMBT);
418 m_w[cpt] = (w_klt[cpt-nbrow] * factorKLT);
429 LVJ_true = ( (*L)*cVo*
oJo );
437 for (
unsigned int i = 0; i < R->
getRows(); i++) {
444 for (
unsigned int j = 0; j < 6; j++) {
445 (*L)[i][j] *=
m_w[i];
450 residu = sqrt(num/den);
491 vpMatrix LTLmuI = LVJTLVJ + (LMA*mu);
551 const bool displayFullModel) {
556 for(std::map<std::string, vpMbKltTracker*>::const_iterator it_klt =
m_mapOfKltTrackers.begin();
560 for(std::list<vpMbtDistanceKltPoints*>::const_iterator it_pts = it_klt->second->kltPolygons.begin();
561 it_pts != it_klt->second->kltPolygons.end(); ++it_pts){
569 for(std::list<vpMbtDistanceKltCylinder*>::const_iterator it_cyl = it_klt->second->kltCylinders.begin();
570 it_cyl != it_klt->second->kltCylinders.end(); ++it_cyl){
571 kltPolyCylinder = *it_cyl;
590 const bool displayFullModel) {
595 for(std::map<std::string, vpMbKltTracker*>::const_iterator it_klt =
m_mapOfKltTrackers.begin();
599 for(std::list<vpMbtDistanceKltPoints*>::const_iterator it_pts = it_klt->second->kltPolygons.begin();
600 it_pts != it_klt->second->kltPolygons.end(); ++it_pts){
608 for(std::list<vpMbtDistanceKltCylinder*>::const_iterator it_cyl = it_klt->second->kltCylinders.begin();
609 it_cyl != it_klt->second->kltCylinders.end(); ++it_cyl){
610 kltPolyCylinder = *it_cyl;
633 const bool displayFullModel) {
639 for(std::map<std::string, vpMbKltTracker*>::const_iterator it_klt =
m_mapOfKltTrackers.begin();
642 for(std::list<vpMbtDistanceKltPoints*>::const_iterator it_pts = it_klt->second->kltPolygons.begin();
643 it_pts != it_klt->second->kltPolygons.end(); ++it_pts){
655 for(std::list<vpMbtDistanceKltCylinder*>::const_iterator it_cyl = it_klt->second->kltCylinders.begin();
656 it_cyl != it_klt->second->kltCylinders.end(); ++it_cyl){
657 kltPolyCylinder = *it_cyl;
687 const bool displayFullModel) {
693 for(std::map<std::string, vpMbKltTracker*>::const_iterator it_klt =
m_mapOfKltTrackers.begin();
696 for(std::list<vpMbtDistanceKltPoints*>::const_iterator it_pts = it_klt->second->kltPolygons.begin();
697 it_pts != it_klt->second->kltPolygons.end(); ++it_pts){
709 for(std::list<vpMbtDistanceKltCylinder*>::const_iterator it_cyl = it_klt->second->kltCylinders.begin();
710 it_cyl != it_klt->second->kltCylinders.end(); ++it_cyl){
711 kltPolyCylinder = *it_cyl;
736 const std::map<std::string, vpHomogeneousMatrix> &mapOfCameraPoses,
737 const std::map<std::string, vpCameraParameters> &mapOfCameraParameters,
738 const vpColor& col,
const unsigned int thickness,
const bool displayFullModel) {
743 for(std::map<std::string, vpMbKltTracker*>::const_iterator it_klt =
m_mapOfKltTrackers.begin();
746 std::map<std::string, const vpImage<unsigned char> *>::const_iterator it_img = mapOfImages.find(it_klt->first);
747 if(it_img != mapOfImages.end()) {
749 for(std::list<vpMbtDistanceKltPoints*>::const_iterator it_pts = it_klt->second->kltPolygons.begin();
750 it_pts != it_klt->second->kltPolygons.end(); ++it_pts) {
758 for(std::list<vpMbtDistanceKltCylinder*>::const_iterator it_cyl = it_klt->second->kltCylinders.begin();
759 it_cyl != it_klt->second->kltCylinders.end(); ++it_cyl) {
760 kltPolyCylinder = *it_cyl;
779 const std::map<std::string, vpHomogeneousMatrix> &mapOfCameraPoses,
780 const std::map<std::string, vpCameraParameters> &mapOfCameraParameters,
781 const vpColor& col,
const unsigned int thickness,
const bool displayFullModel) {
786 for(std::map<std::string, vpMbKltTracker*>::const_iterator it_klt =
m_mapOfKltTrackers.begin();
789 std::map<std::string, const vpImage<vpRGBa> *>::const_iterator it_img = mapOfImages.find(it_klt->first);
790 if(it_img != mapOfImages.end()) {
792 for(std::list<vpMbtDistanceKltPoints*>::const_iterator it_pts = it_klt->second->kltPolygons.begin();
793 it_pts != it_klt->second->kltPolygons.end(); ++it_pts){
801 for(std::list<vpMbtDistanceKltCylinder*>::const_iterator it_cyl = it_klt->second->kltCylinders.begin();
802 it_cyl != it_klt->second->kltCylinders.end(); ++it_cyl){
803 kltPolyCylinder = *it_cyl;
858 mapOfCameraParameters.clear();
871 std::map<std::string, vpMbKltTracker *>::const_iterator it =
m_mapOfKltTrackers.find(cameraName);
875 return it->second->getClipping();
877 std::cerr <<
"Cannot find camera: " << cameraName << std::endl;
884 std::cerr <<
"Return the wrong faces reference !" << std::endl;
885 std::cerr <<
"Use vpMbEdgeKltMultiTracker::getEdgeFaces or "
886 "vpMbEdgeKltMultiTracker::getKltFaces instead !" << std::endl;
928 std::cerr <<
"Use vpMbEdgeKltMultiTracker::getEdgeMultiNbPolygon or "
929 "vpMbEdgeKltMultiTracker::getKltMultiNbPolygon instead !" << std::endl;
982 mapOfCameraPoses.clear();
994 #ifdef VISP_HAVE_MODULE_GUI
1005 const std::string &displayFile) {
1069 const std::string& initFile1,
const std::string& initFile2,
const bool displayHelp,
const bool firstCameraIsReference) {
1074 std::map<std::string, vpMbKltTracker *>::const_iterator it_klt =
m_mapOfKltTrackers.begin();
1075 if(firstCameraIsReference) {
1077 it_klt->second->getPose(c2Mo);
1079 it_klt->second->getPose(c2Mo);
1108 const std::string &initFile,
const bool displayHelp) {
1112 std::map<std::string, vpHomogeneousMatrix> mapOfCameraPoses;
1143 const std::map<std::string, std::string> &mapOfInitFiles,
const bool displayHelp) {
1147 std::map<std::string, vpHomogeneousMatrix> mapOfCameraPoses;
1154 #endif //#ifdef VISP_HAVE_MODULE_GUI
1157 const std::string &) {
1158 std::cerr <<
"The method initCircle is not used in vpMbEdgeKltMultiTracker !" << std::endl;
1162 const std::string &) {
1163 std::cerr <<
"The method initCylinder is not used in vpMbEdgeKltMultiTracker !" << std::endl;
1167 std::cerr <<
"The method initFaceFromCorners is not used in vpMbEdgeKltMultiTracker !" << std::endl;
1171 std::cerr <<
"The method initFaceFromLines is not used in vpMbEdgeKltMultiTracker !" << std::endl;
1198 char s[FILENAME_MAX];
1199 std::fstream finit ;
1202 std::string ext =
".pos";
1203 size_t pos = initFile.rfind(ext);
1205 if( pos == initFile.size()-ext.size() && pos != 0)
1206 sprintf(s,
"%s", initFile.c_str());
1208 sprintf(s,
"%s.pos", initFile.c_str());
1210 finit.open(s,std::ios::in) ;
1212 std::cerr <<
"cannot read " << s << std::endl;
1216 for (
unsigned int i = 0; i < 6; i += 1){
1217 finit >> init_pos[i];
1287 const std::map<std::string, vpHomogeneousMatrix> &mapOfCameraPoses) {
1293 std::map<std::string, unsigned int> &mapOfNumberOfRows,
1294 std::map<std::string, unsigned int> &mapOfNumberOfLines,
1295 std::map<std::string, unsigned int> &mapOfNumberOfCylinders,
1296 std::map<std::string, unsigned int> &mapOfNumberOfCircles) {
1297 unsigned int nbrow = 0;
1298 unsigned int nberrors_lines = 0;
1299 unsigned int nberrors_cylinders = 0;
1300 unsigned int nberrors_circles = 0;
1302 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it1 =
m_mapOfEdgeTrackers.begin();
1304 unsigned int nrows = 0;
1305 unsigned int nlines = 0;
1306 unsigned int ncylinders = 0;
1307 unsigned int ncircles = 0;
1309 nrows = it1->second->initMbtTracking(nlines, ncylinders, ncircles);
1311 mapOfNumberOfRows[it1->first] = nrows;
1312 mapOfNumberOfLines[it1->first] = nlines;
1313 mapOfNumberOfCylinders[it1->first] = ncylinders;
1314 mapOfNumberOfCircles[it1->first] = ncircles;
1317 nberrors_lines += nlines;
1318 nberrors_cylinders += ncylinders;
1319 nberrors_circles += ncircles;
1321 for(
unsigned int i = 0; i < nlines; i++) {
1322 indexOfFeatures.push_back(
LINE);
1325 for(
unsigned int i = 0; i < ncylinders; i++) {
1326 indexOfFeatures.push_back(
CYLINDER);
1329 for(
unsigned int i = 0; i < ncircles; i++) {
1330 indexOfFeatures.push_back(
CIRCLE);
1403 const bool firstCameraIsReference) {
1459 std::map<std::string, unsigned int> &mapOfNbInfos,
const unsigned int lvl) {
1461 unsigned int cpt = 0;
1462 for(std::map<std::string, unsigned int>::const_iterator it = mapOfNumberOfRows.begin(); it != mapOfNumberOfRows.end(); ++it) {
1463 for(
unsigned int i = 0; i < mapOfNumberOfRows[it->first]; i++) {
1468 cpt += mapOfNumberOfRows[it->first];
1472 for(std::map<std::string, vpMbEdgeTracker*>::const_iterator it =
m_mapOfEdgeTrackers.begin();
1474 it->second->displayFeaturesOnImage(*mapOfImages[it->first], lvl);
1482 bool newvisibleface =
false;
1483 for(std::map<std::string, vpMbEdgeTracker*>::const_iterator it =
m_mapOfEdgeTrackers.begin();
1485 it->second->visibleFace(*mapOfImages[it->first], it->second->cMo, newvisibleface);
1489 for(std::map<std::string, vpMbEdgeTracker*>::const_iterator it =
m_mapOfEdgeTrackers.begin();
1491 it->second->faces.computeClippedPolygons(it->second->cMo, it->second->cam);
1492 it->second->faces.computeScanLineRender(it->second->cam, mapOfImages[it->first]->getWidth(),
1493 mapOfImages[it->first]->getHeight());
1498 for(std::map<std::string, vpMbEdgeTracker*>::const_iterator it =
m_mapOfEdgeTrackers.begin();
1500 it->second->updateMovingEdge(*mapOfImages[it->first]);
1506 for(std::map<std::string, vpMbEdgeTracker*>::const_iterator it =
m_mapOfEdgeTrackers.begin();
1508 it->second->initMovingEdge(*mapOfImages[it->first], it->second->cMo);
1511 it->second->reinitMovingEdge(*mapOfImages[it->first], it->second->cMo);
1514 it->second->computeProjectionError(*mapOfImages[it->first]);
1553 const bool verbose,
const bool firstCameraIsReference) {
1568 const std::string &cad_name,
const std::map<std::string, vpHomogeneousMatrix> &mapOfCameraPoses,
1569 const bool verbose) {
1631 const bool firstCameraIsReference) {
1635 if(firstCameraIsReference) {
1636 this->
cam = camera1;
1638 this->
cam = camera2;
1666 for(std::map<std::string, vpCameraParameters>::const_iterator it = mapOfCameraParameters.begin();
1667 it != mapOfCameraParameters.end(); ++it) {
1669 this->
cam = it->second;
1687 it->second = cameraTransformationMatrix;
1689 std::cerr <<
"Cannot find camera: " << cameraName <<
" !" << std::endl;
1700 const std::map<std::string, vpHomogeneousMatrix> &mapOfTransformationMatrix) {
1780 #ifdef VISP_HAVE_OGRE
1858 const std::string &name) {
1885 const std::string &name) {
1935 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
1937 it->second->setOgreVisibilityTest(v);
1940 #ifdef VISP_HAVE_OGRE
1941 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
1943 it->second->faces.getOgreContext()->setWindowName(
"Multi Edge MBT Hybrid (" + it->first +
")");
1949 for(std::map<std::string, vpMbKltTracker *>::const_iterator it =
m_mapOfKltTrackers.begin();
1951 it->second->setOgreVisibilityTest(v);
1954 #ifdef VISP_HAVE_OGRE
1955 for(std::map<std::string, vpMbKltTracker *>::const_iterator it =
m_mapOfKltTrackers.begin();
1957 it->second->faces.getOgreContext()->setWindowName(
"Multi KLT MBT Hybrid (" + it->first +
")");
1983 std::cerr <<
"This method requires only 1 camera !" << std::endl;
1988 it_edge->second->setPose(I, cMo_);
1989 it_klt->second->setPose(I, cMo_);
2040 const std::map<std::string, vpHomogeneousMatrix> &mapOfCameraPoses) {
2055 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2057 it->second->setProjectionErrorComputation(flag);
2092 std::cerr <<
"The method vpMbEdgeKltMultiTracker::testTracking is not used !" << std::endl;
2109 std::map<std::string, const vpImage<unsigned char> *> mapOfImages;
2113 std::stringstream ss;
2134 std::map<std::string, vpMbKltTracker *>::const_iterator it =
m_mapOfKltTrackers.begin();
2135 std::map<std::string, const vpImage<unsigned char> *> mapOfImages;
2137 mapOfImages[it->first] = &I1;
2140 mapOfImages[it->first] = &I2;
2143 std::stringstream ss;
2144 ss <<
"Require two cameras ! There are " <<
m_mapOfKltTrackers.size() <<
" cameras !";
2162 for(std::map<std::string, vpMbEdgeTracker*>::const_iterator it_edge =
m_mapOfEdgeTrackers.begin();
2164 std::map<std::string, const vpImage<unsigned char>* >::const_iterator it_img = mapOfImages.find(it_edge->first);
2166 if(it_img == mapOfImages.end()) {
2172 for(std::map<std::string, vpMbKltTracker*>::const_iterator it_klt =
m_mapOfKltTrackers.begin();
2174 std::map<std::string, const vpImage<unsigned char>* >::const_iterator it_img = mapOfImages.find(it_klt->first);
2176 if(it_img == mapOfImages.end()) {
2181 std::map<std::string, unsigned int> mapOfNbInfos;
2182 std::map<std::string, unsigned int> mapOfNbFaceUsed;
2196 std::map<std::string, unsigned int> mapOfNumberOfRows;
2197 computeVVS(mapOfImages, mapOfNumberOfRows, mapOfNbInfos, w_mbt, w_klt);
2199 postTracking(mapOfImages, w_mbt, w_klt, mapOfNumberOfRows, mapOfNbInfos, 0);
2207 vpColVector &factor, std::vector<FeatureType> &indexOfFeatures,
2208 std::map<std::string, unsigned int> &mapOfNumberOfRows,
2209 std::map<std::string, unsigned int> &mapOfNumberOfLines,
2210 std::map<std::string, unsigned int> &mapOfNumberOfCylinders,
2211 std::map<std::string, unsigned int> &mapOfNumberOfCircles,
const unsigned int lvl) {
2214 unsigned int nbrow =
initMbtTracking(indexOfFeatures, mapOfNumberOfRows, mapOfNumberOfLines,
2215 mapOfNumberOfCylinders, mapOfNumberOfCircles);
2222 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it =
m_mapOfEdgeTrackers.begin();
2229 factor_tmp.
resize(mapOfNumberOfRows[it->first]);
2231 it->second->computeVVSFirstPhaseFactor(*mapOfImages[it->first], factor_tmp, lvl);
2233 factor.
stack(factor_tmp);
2240 for(std::map<std::string, vpMbEdgeTracker *>::const_iterator it1 =
m_mapOfEdgeTrackers.begin();
2244 it1->second->trackMovingEdge(*mapOfImages[it1->first]);
2246 std::cerr <<
"Error in moving edge tracking" << std::endl;
2252 #elif !defined(VISP_BUILD_SHARED_LIBS)
2254 void dummy_vpMbEdgeKltMultiTracker() {};
2255 #endif //VISP_HAVE_OPENCV
bool computeProjError
Flag used to specify if the gradient error criteria has to be computed or not.
void setGoodNbRayCastingAttemptsRatio(const double &ratio)
virtual void trackMovingEdges(std::map< std::string, const vpImage< unsigned char > * > &mapOfImages)
virtual void initClick(const vpImage< unsigned char > &I, const std::vector< vpPoint > &points3D_list, const std::string &displayFile="")
Implementation of a matrix and operations on matrices.
vpMatrix covarianceMatrix
Covariance matrix.
virtual void loadModel(const std::string &modelFile, const bool verbose=false)
void displayPrimitive(const vpImage< unsigned char > &_I)
virtual void setMinLineLengthThresh(const double minLineLengthThresh, const std::string &name="")
virtual void setFarClippingDistance(const double &dist)
virtual void setFarClippingDistance(const double &dist)
virtual void setNearClippingDistance(const double &dist)
double lambda
The gain of the virtual visual servoing stage.
virtual void initFromPose(const vpImage< unsigned char > &I, const std::string &initFile)
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="")
double thresholdMBT
The threshold used in the robust estimation of MBT.
virtual void setOgreVisibilityTest(const bool &v)
virtual void setCovarianceComputation(const bool &flag)
virtual unsigned int getClipping() const
std::map< std::string, vpMbHiddenFaces< vpMbtPolygon > > getEdgeFaces() const
virtual void setPose(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
void stack(const double &d)
void resize(const unsigned int nrows, const unsigned int ncols, const bool flagNullify=true)
virtual void computeVVS(std::map< std::string, const vpImage< unsigned char > * > &mapOfImages, std::map< std::string, unsigned int > &mapOfNumberOfRows, std::map< std::string, unsigned int > &mapOfNbInfos, vpColVector &w_mbt, vpColVector &w_klt, const unsigned int lvl=0)
vpMbHiddenFaces< vpMbtPolygon > faces
Set of faces describing the object.
virtual void setOptimizationMethod(const vpMbtOptimizationMethod &opt)
virtual void resetTracker()
virtual void computeProjectionError()
virtual void computeVVSWeights(const unsigned int iter, const unsigned int nbInfos, std::map< std::string, unsigned int > &mapOfNbInfos, vpColVector &R, vpColVector &w_true, vpColVector &w, std::map< std::string, vpRobust > &mapOfRobusts, double threshold)
void setNbRayCastingAttemptsForVisibility(const unsigned int &attempts)
virtual void setAngleDisappear(const double &a)
std::map< std::string, vpHomogeneousMatrix > m_mapOfCameraTransformationMatrix
Map of camera transformation matrix between the current camera frame to the reference camera frame (c...
virtual void setDisplayFeatures(const bool displayF)
virtual void loadConfigFile(const std::string &configFile)
Implementation of an homogeneous matrix and operations on such kind of matrices.
virtual void preTracking(std::map< std::string, const vpImage< unsigned char > * > &mapOfImages, std::map< std::string, unsigned int > &mapOfNbInfos, std::map< std::string, unsigned int > &mapOfNbFaceUsed)
virtual void setPose(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
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 setLod(const bool useLod, const std::string &name="")
virtual void setFarClippingDistance(const double &dist)
vpHomogeneousMatrix cMo
The current pose.
void stack(const vpMatrix &A)
bool hasEnoughPoints() const
double m_factorMBT
Factor for edge trackers.
void setGoodNbRayCastingAttemptsRatio(const double &ratio)
virtual void setDisplayFeatures(const bool displayF)
virtual void loadConfigFile(const std::string &configFile)
virtual void setDisplayFeatures(const bool displayF)
virtual void setCameraTransformationMatrix(const std::string &cameraName, const vpHomogeneousMatrix &cameraTransformationMatrix)
bool modelInitialised
Flag used to ensure that the CAD model is loaded before the initialisation.
vpMbEdgeKltMultiTracker()
virtual void setMinPolygonAreaThresh(const double minPolygonAreaThresh, const std::string &name="")
error that can be emited by ViSP classes.
virtual void setThresholdAcceptation(const double th)
virtual vpMbHiddenFaces< vpMbtPolygon > & getFaces()
virtual void setCovarianceComputation(const bool &flag)
virtual void setClipping(const unsigned int &flags)
virtual void setOgreShowConfigDialog(const bool showConfigDialog)
virtual void init(const vpImage< unsigned char > &I)
virtual void setAngleAppear(const double &a)
virtual void setAngleDisappear(const double &a)
virtual void getCameraParameters(vpCameraParameters &camera) const
bool useOgre
Use Ogre3d for visibility tests.
virtual void setLod(const bool useLod, const std::string &name="")
unsigned int getCols() const
Return the number of columns of the 2D array.
virtual void initFaceFromCorners(vpMbtPolygon &polygon)
virtual void setMinPolygonAreaThresh(const double minPolygonAreaThresh, const std::string &name="")
virtual void loadConfigFile(const std::string &configFile)
bool computeCovariance
Flag used to specify if the covariance matrix has to be computed or not.
virtual void loadModel(const std::string &modelFile, const bool verbose=false)
virtual void setReferenceCameraName(const std::string &referenceCameraName)
virtual void setNearClippingDistance(const double &dist)
Implementation of a polygon of the model containing points of interest. It is used by the model-based...
Class that defines what is a point.
double thresholdKLT
The threshold used in the robust estimation of KLT.
vpCameraParameters cam
The camera parameters.
virtual std::map< std::string, unsigned int > getEdgeMultiNbPolygon() const
virtual ~vpMbEdgeKltMultiTracker()
vpHomogeneousMatrix ctTc0
The estimated displacement of the pose between the current instant and the initial position...
virtual void setReferenceCameraName(const std::string &referenceCameraName)
void computeJTR(const vpMatrix &J, const vpColVector &R, vpColVector &JTR) const
double projectionError
Error angle between the gradient direction of the model features projected at the resulting pose and ...
Implementation of an homography and operations on homographies.
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)
virtual void initFaceFromLines(vpMbtPolygon &polygon)
void computeVVSInteractionMatrixAndResidu(unsigned int shift, vpColVector &R, vpMatrix &L, vpHomography &H, std::list< vpMbtDistanceKltPoints * > &kltPolygons_, std::list< vpMbtDistanceKltCylinder * > &kltCylinders_, const vpHomogeneousMatrix &ctTc0_)
virtual void track(const vpImage< unsigned char > &I)
void setGoodNbRayCastingAttemptsRatio(const double &ratio)
vpMatrix oJo
The Degrees of Freedom to estimate.
Error that can be emited by the vpTracker class and its derivates.
Implementation of a polygon of the model used by the model-based tracker.
virtual vpMbHiddenFaces< vpMbtPolygon > & getFaces()
virtual unsigned int trackFirstLoop(std::map< std::string, const vpImage< unsigned char > * > &mapOfImages, vpColVector &factor, std::vector< FeatureType > &indexOfFeatures, std::map< std::string, unsigned int > &mapOfNumberOfRows, std::map< std::string, unsigned int > &mapOfNumberOfLines, std::map< std::string, unsigned int > &mapOfNumberOfCylinders, std::map< std::string, unsigned int > &mapOfNumberOfCircles, const unsigned int lvl)
virtual void setClipping(const unsigned int &flags)
bool compute_interaction
If true, compute the interaction matrix at each iteration of the minimization. Otherwise, compute it only on the first iteration.
virtual vpHomogeneousMatrix getPose() const
void displayPrimitive(const vpImage< unsigned char > &_I)
void diag(const double &val=1.0)
virtual void setOgreShowConfigDialog(const bool showConfigDialog)
bool useScanLine
Use Scanline for visibility tests.
vpVelocityTwistMatrix buildFrom(const vpTranslationVector &t, const vpRotationMatrix &R)
static double sqr(double x)
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*.
virtual void reInitModel(const vpImage< unsigned char > &I, const std::string &cad_name, const vpHomogeneousMatrix &cMo_, const bool verbose=false)
Generic class defining intrinsic camera parameters.
virtual void setCameraTransformationMatrix(const std::string &cameraName, const vpHomogeneousMatrix &cameraTransformationMatrix)
Implementation of a polygon of the model containing points of interest. It is used by the model-based...
virtual void setMinPolygonAreaThresh(const double minPolygonAreaThresh, const std::string &name="")
bool hasEnoughPoints() const
virtual void setAngleAppear(const double &a)
Implementation of a velocity twist matrix and operations on such kind of matrices.
virtual unsigned int initMbtTracking(std::vector< FeatureType > &indexOfFeatures, std::map< std::string, unsigned int > &mapOfNumberOfRows, std::map< std::string, unsigned int > &mapOfNumberOfLines, std::map< std::string, unsigned int > &mapOfNumberOfCylinders, std::map< std::string, unsigned int > &mapOfNumberOfCircles)
vpMbtOptimizationMethod m_optimizationMethod
Optimization method used.
unsigned int getRows() const
Return the number of rows of the 2D array.
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)
virtual bool isVisible(const vpHomogeneousMatrix &cMo, const double alpha, const bool &modulo=false, const vpCameraParameters &cam=vpCameraParameters(), const vpImage< unsigned char > &I=vpImage< unsigned char >())
virtual void setCovarianceComputation(const bool &flag)
virtual void postTracking(std::map< std::string, const vpImage< unsigned char > * > &mapOfImages, std::map< std::string, unsigned int > &mapOfNbInfos, vpColVector &w_klt)
void buildFrom(const vpTranslationVector &t, const vpRotationMatrix &R)
virtual void resetTracker()
std::map< std::string, vpMbKltTracker * > m_mapOfKltTrackers
Map of Model-based klt trackers.
virtual void setThresholdAcceptation(const double th)
virtual void initFromPose(const vpImage< unsigned char > &I, const std::string &initFile)
virtual void setNearClippingDistance(const double &dist)
virtual void setCameraParameters(const vpCameraParameters &camera)
void setNbRayCastingAttemptsForVisibility(const unsigned int &attempts)
bool displayFeatures
If true, the features are displayed.
virtual std::map< std::string, unsigned int > getKltMultiNbPolygon() const
virtual void getCameraParameters(vpCameraParameters &camera) const
virtual void initCylinder(const vpPoint &, const vpPoint &, const double, const int, const std::string &name="")
Implementation of column vector and the associated operations.
virtual void loadModel(const std::string &modelFile, const bool verbose=false)
virtual void setCameraParameters(const vpCameraParameters &camera)
Implementation of a pose vector and operations on poses.
vpHomogeneousMatrix inverse() const
virtual vpMbHiddenFaces< vpMbtPolygon > & getFaces()
static vpHomogeneousMatrix direct(const vpColVector &v)
virtual void reInitModel(const vpImage< unsigned char > &I, const std::string &cad_name, const vpHomogeneousMatrix &cMo_, const bool verbose=false)
Contains an M-Estimator and various influence function.
std::string m_referenceCameraName
Name of the reference camera.
virtual void setOgreShowConfigDialog(const bool showConfigDialog)
virtual std::vector< std::string > getCameraNames() const
vpMbtPolygon * polygon
Pointer to the polygon that define a face.
virtual void postTracking(std::map< std::string, const vpImage< unsigned char > * > &mapOfImages, vpColVector &w_mbt, vpColVector &w_klt, std::map< std::string, unsigned int > &mapOfNumberOfRows, std::map< std::string, unsigned int > &mapOfNbInfos, const unsigned int lvl)
virtual std::vector< std::string > getCameraNames() const
unsigned int maxIter
The maximum iteration of the virtual visual servoing stage.
virtual void setScanLineVisibilityTest(const bool &v)
vpMatrix pseudoInverse(double svThreshold=1e-6) const
Compute the pseudo inverse of the matrix using the SVD.
void setNbRayCastingAttemptsForVisibility(const unsigned int &attempts)
virtual void setAngleDisappear(const double &a)
virtual void initClick(const vpImage< unsigned char > &I, const std::vector< vpPoint > &points3D_list, const std::string &displayFile="")
virtual void setClipping(const unsigned int &flags)
double m_factorKLT
Factor for KLT trackers.
virtual void setCameraTransformationMatrix(const std::string &cameraName, const vpHomogeneousMatrix &cameraTransformationMatrix)
std::map< std::string, vpMbEdgeTracker * > m_mapOfEdgeTrackers
Map of Model-based edge trackers.
virtual void setMinLineLengthThresh(const double minLineLengthThresh, const std::string &name="")
Make the complete stereo (or more) tracking of an object by using its CAD model.
virtual void setProjectionErrorComputation(const bool &flag)
virtual void resetTracker()
virtual void setOptimizationMethod(const vpMbtOptimizationMethod &opt)
virtual void setReferenceCameraName(const std::string &referenceCameraName)
virtual void reInitModel(const vpImage< unsigned char > &I, const std::string &cad_name, const vpHomogeneousMatrix &cMo_, const bool verbose=false)
virtual void initCircle(const vpPoint &, const vpPoint &, const vpPoint &, const double, const int, const std::string &name="")
bool isoJoIdentity
Boolean to know if oJo is identity (for fast computation)
Model based stereo (or more) tracker using only KLT.
vpHomogeneousMatrix c0Mo
Initial pose.
virtual std::map< std::string, unsigned int > getMultiNbPolygon() const
std::map< std::string, vpMbHiddenFaces< vpMbtPolygon > > getKltFaces() const
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 setOptimizationMethod(const vpMbtOptimizationMethod &opt)
virtual unsigned int getNbPolygon() const
virtual void testTracking()
virtual void setScanLineVisibilityTest(const bool &v)
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)