38 #include <visp3/core/vpDebug.h>
39 #include <visp3/core/vpTrackingException.h>
40 #include <visp3/core/vpVelocityTwistMatrix.h>
41 #include <visp3/mbt/vpMbEdgeKltTracker.h>
42 #include <visp3/mbt/vpMbtXmlGenericParser.h>
44 #if defined(VISP_HAVE_MODULE_KLT) && defined(VISP_HAVE_OPENCV) && defined(HAVE_OPENCV_IMGPROC) && defined(HAVE_OPENCV_VIDEO)
47 vpMbEdgeKltTracker::vpMbEdgeKltTracker()
48 : m_thresholdKLT(2.), m_thresholdMBT(2.), m_maxIterKlt(30), m_w_mbt(), m_w_klt(), m_error_hybrid(), m_w_hybrid()
50 computeCovariance =
false;
53 faces.getOgreContext()->setWindowName(
"MBT Hybrid");
64 vpMbEdgeKltTracker::~vpMbEdgeKltTracker() { }
74 vpMbKltTracker::init(I);
76 initPyramid(I, Ipyramid);
80 unsigned int i = (
unsigned int)scales.size();
85 initMovingEdge(*Ipyramid[i], m_cMo);
90 cleanPyramid(Ipyramid);
104 vpMbKltTracker::setPose(I, cdMo);
110 faces.computeClippedPolygons(m_cMo, m_cam);
114 initPyramid(I, Ipyramid);
116 unsigned int i = (
unsigned int)scales.size();
121 initMovingEdge(*Ipyramid[i], m_cMo);
126 cleanPyramid(Ipyramid);
141 vpMbKltTracker::setPose(m_I, cdMo);
146 m_cam.computeFov(m_I.getWidth(), m_I.getHeight());
147 faces.computeClippedPolygons(m_cMo, m_cam);
148 faces.computeScanLineRender(m_cam, m_I.getWidth(), m_I.getHeight());
151 initPyramid(m_I, Ipyramid);
153 unsigned int i = (
unsigned int)scales.size();
158 initMovingEdge(*Ipyramid[i], m_cMo);
163 cleanPyramid(Ipyramid);
170 void vpMbEdgeKltTracker::resetTracker()
173 vpMbKltTracker::resetTracker();
176 unsigned int vpMbEdgeKltTracker::initMbtTracking(
unsigned int lvl)
178 if (lvl >= scales.size() || !scales[lvl]) {
182 unsigned int nbrow = 0;
183 for (std::list<vpMbtDistanceLine *>::iterator it = lines[lvl].begin(); it != lines[lvl].end(); ++it) {
192 for (std::list<vpMbtDistanceCylinder *>::const_iterator it = cylinders[lvl].begin(); it != cylinders[lvl].end();
202 for (std::list<vpMbtDistanceCircle *>::const_iterator it = circles[lvl].begin(); it != circles[lvl].end(); ++it) {
275 void vpMbEdgeKltTracker::loadConfigFile(
const std::string &configFile,
bool verbose)
277 #if defined(VISP_HAVE_PUGIXML)
282 xmlp.setVerbose(verbose);
283 xmlp.setCameraParameters(m_cam);
285 xmlp.setAngleDisappear(
vpMath::deg(angleDisappears));
289 xmlp.setKltMaxFeatures(10000);
290 xmlp.setKltWindowSize(5);
291 xmlp.setKltQuality(0.01);
292 xmlp.setKltMinDistance(5);
293 xmlp.setKltHarrisParam(0.01);
294 xmlp.setKltBlockSize(3);
295 xmlp.setKltPyramidLevels(3);
296 xmlp.setKltMaskBorder(maskBorder);
300 std::cout <<
" *********** Parsing XML for Mb Edge KLT Tracker ************ " << std::endl;
302 xmlp.parse(configFile.c_str());
305 vpERROR_TRACE(
"Can't open XML file \"%s\"\n ", configFile.c_str());
310 xmlp.getCameraParameters(camera);
311 setCameraParameters(camera);
314 angleDisappears =
vpMath::rad(xmlp.getAngleDisappear());
316 if (xmlp.hasNearClippingDistance())
317 setNearClippingDistance(xmlp.getNearClippingDistance());
319 if (xmlp.hasFarClippingDistance())
320 setFarClippingDistance(xmlp.getFarClippingDistance());
322 if (xmlp.getFovClipping()) {
326 useLodGeneral = xmlp.getLodState();
327 minLineLengthThresholdGeneral = xmlp.getLodMinLineLengthThreshold();
328 minPolygonAreaThresholdGeneral = xmlp.getLodMinPolygonAreaThreshold();
330 applyLodSettingInConfig =
false;
331 if (this->getNbPolygon() > 0) {
332 applyLodSettingInConfig =
true;
333 setLod(useLodGeneral);
334 setMinLineLengthThresh(minLineLengthThresholdGeneral);
335 setMinPolygonAreaThresh(minPolygonAreaThresholdGeneral);
339 xmlp.getEdgeMe(meParser);
342 tracker.setMaxFeatures((
int)xmlp.getKltMaxFeatures());
343 tracker.setWindowSize((
int)xmlp.getKltWindowSize());
344 tracker.setQuality(xmlp.getKltQuality());
345 tracker.setMinDistance(xmlp.getKltMinDistance());
346 tracker.setHarrisFreeParameter(xmlp.getKltHarrisParam());
347 tracker.setBlockSize((
int)xmlp.getKltBlockSize());
348 tracker.setPyramidLevels((
int)xmlp.getKltPyramidLevels());
349 maskBorder = xmlp.getKltMaskBorder();
352 faces.getMbScanLineRenderer().setMaskBorder(maskBorder);
366 postTrackingMbt(w_mbt, lvl);
368 if (displayFeatures) {
370 for (std::list<vpMbtDistanceLine *>::const_iterator it = lines[lvl].begin(); it != lines[lvl].end(); ++it) {
377 for (std::list<vpMbtDistanceCylinder *>::const_iterator it = cylinders[lvl].begin(); it != cylinders[lvl].end();
385 for (std::list<vpMbtDistanceCircle *>::const_iterator it = circles[lvl].begin(); it != circles[lvl].end(); ++it) {
394 bool reInit = vpMbKltTracker::postTracking(I, w_klt);
398 faces.computeClippedPolygons(m_cMo, m_cam);
407 if (computeProjError)
422 postTrackingMbt(w_mbt, lvl);
424 if (displayFeatures) {
426 for (std::list<vpMbtDistanceLine *>::const_iterator it = lines[lvl].begin(); it != lines[lvl].end(); ++it) {
433 for (std::list<vpMbtDistanceCylinder *>::const_iterator it = cylinders[lvl].begin(); it != cylinders[lvl].end();
441 for (std::list<vpMbtDistanceCircle *>::const_iterator it = circles[lvl].begin(); it != circles[lvl].end(); ++it) {
450 bool reInit = vpMbKltTracker::postTracking(m_I, w_klt);
453 m_cam.computeFov(m_I.getWidth(), m_I.getHeight());
454 faces.computeClippedPolygons(m_cMo, m_cam);
455 faces.computeScanLineRender(m_cam, m_I.getWidth(), m_I.getHeight());
463 if (computeProjError)
482 void vpMbEdgeKltTracker::postTrackingMbt(
vpColVector &w,
unsigned int lvl)
484 if (lvl >= scales.size() || !scales[lvl]) {
490 for (std::list<vpMbtDistanceLine *>::const_iterator it = lines[lvl].begin(); it != lines[lvl].end(); ++it) {
491 if ((*it)->isTracked()) {
493 unsigned int indexLine = 0;
496 for (
size_t a = 0; a < l->
meline.size(); a++) {
497 std::list<vpMeSite>::iterator itListLine;
499 itListLine = l->
meline[a]->getMeList().begin();
501 for (
unsigned int i = 0; i < l->
nbFeature[a]; i++) {
502 wmean += w[n + indexLine];
504 if (w[n + indexLine] < 0.5) {
530 for (std::list<vpMbtDistanceCylinder *>::const_iterator it = cylinders[lvl].begin(); it != cylinders[lvl].end();
532 if ((*it)->isTracked()) {
535 std::list<vpMeSite>::iterator itListCyl1;
536 std::list<vpMeSite>::iterator itListCyl2;
538 itListCyl1 = cy->
meline1->getMeList().begin();
539 itListCyl2 = cy->
meline2->getMeList().begin();
543 for (
unsigned int i = 0; i < cy->
nbFeaturel1; i++) {
546 if (w[n + i] < 0.5) {
567 for (
unsigned int i = cy->
nbFeaturel1; i < cy->nbFeature; i++) {
570 if (w[n + i] < 0.5) {
596 for (std::list<vpMbtDistanceCircle *>::const_iterator it = circles[lvl].begin(); it != circles[lvl].end(); ++it) {
597 if ((*it)->isTracked()) {
600 std::list<vpMeSite>::iterator itListCir;
603 itListCir = ci->
meEllipse->getMeList().begin();
607 for (
unsigned int i = 0; i < ci->
nbFeature; i++) {
610 if (w[n + i] < 0.5) {
645 void vpMbEdgeKltTracker::computeVVS(
const vpImage<unsigned char> &I,
const unsigned int &nbInfos,
unsigned int &nbrow,
646 unsigned int lvl,
double *edge_residual,
double *klt_residual)
649 nbrow = trackFirstLoop(I, factor, lvl);
651 if (nbrow < 4 && nbInfos < 4) {
657 unsigned int totalNbRows = nbrow + 2 * nbInfos;
659 double residu_1 = -1;
660 unsigned int iter = 0;
670 L_mbt.
resize(nbrow, 6,
false,
false);
671 R_mbt.
resize(nbrow,
false);
675 L_klt.
resize(2 * nbInfos, 6,
false,
false);
676 R_klt.
resize(2 * nbInfos,
false);
700 if (edge_residual !=
nullptr)
702 if (klt_residual !=
nullptr)
710 bool isoJoIdentity = m_isoJoIdentity;
715 m_error_hybrid.
resize(totalNbRows,
false);
716 m_w_hybrid.resize(totalNbRows,
false);
719 m_w_mbt.resize(nbrow,
false);
724 m_w_klt.resize(2 * nbInfos,
false);
728 double mu = m_initialMu;
730 while (((
int)((residu - residu_1) * 1e8) != 0) && (iter < m_maxIter)) {
732 trackSecondLoop(I, L_mbt, R_mbt, m_cMo, lvl);
735 unsigned int shift = 0;
737 for (std::list<vpMbtDistanceKltPoints *>::const_iterator it = vpMbKltTracker::kltPolygons.begin();
738 it != vpMbKltTracker::kltPolygons.end(); ++it) {
739 vpMbtDistanceKltPoints *kltpoly = *it;
740 if (kltpoly->polygon->isVisible() && kltpoly->isTracked() && kltpoly->hasEnoughPoints()) {
741 vpSubColVector subR(R_klt, shift, 2 * kltpoly->getCurrentNumberPoints());
742 vpSubMatrix subL(L_klt, shift, 0, 2 * kltpoly->getCurrentNumberPoints(), 6);
743 kltpoly->computeHomography(ctTc0, H);
744 kltpoly->computeInteractionMatrixAndResidu(subR, subL);
745 shift += 2 * kltpoly->getCurrentNumberPoints();
749 for (std::list<vpMbtDistanceKltCylinder *>::const_iterator it = kltCylinders.begin(); it != kltCylinders.end();
751 vpMbtDistanceKltCylinder *kltPolyCylinder = *it;
753 if (kltPolyCylinder->isTracked() && kltPolyCylinder->hasEnoughPoints()) {
754 vpSubColVector subR(R_klt, shift, 2 * kltPolyCylinder->getCurrentNumberPoints());
755 vpSubMatrix subL(L_klt, shift, 0, 2 * kltPolyCylinder->getCurrentNumberPoints(), 6);
757 kltPolyCylinder->computeInteractionMatrixAndResidu(ctTc0, subR, subL);
763 shift += 2 * kltPolyCylinder->getCurrentNumberPoints();
770 m_error_hybrid.insert(0, R_mbt);
774 m_error_hybrid.insert(nbrow, R_klt);
777 unsigned int cpt = 0;
778 while (cpt < (nbrow + 2 * nbInfos)) {
779 if (cpt < (
unsigned)nbrow) {
780 m_w_hybrid[cpt] = ((m_w_mbt[cpt] * factor[cpt]) * factorMBT);
783 m_w_hybrid[cpt] = (m_w_klt[cpt - nbrow] * factorKLT);
788 bool reStartFromLastIncrement =
false;
789 computeVVSCheckLevenbergMarquardt(iter, m_error_hybrid, m_error_prev, cMoPrev, mu, reStartFromLastIncrement,
791 if (reStartFromLastIncrement) {
795 if (!reStartFromLastIncrement) {
798 if (edge_residual !=
nullptr) {
800 for (
unsigned int i = 0; i < R_mbt.
getRows(); i++)
801 *edge_residual += fabs(R_mbt[i]);
802 *edge_residual /= R_mbt.
getRows();
808 L.insert(L_mbt, 0, 0);
812 if (klt_residual !=
nullptr) {
814 for (
unsigned int i = 0; i < R_klt.
getRows(); i++)
815 *klt_residual += fabs(R_klt[i]);
816 *klt_residual /= R_klt.
getRows();
822 L.insert(L_klt, nbrow, 0);
826 while (cpt < (nbrow + 2 * nbInfos)) {
827 if (cpt < (
unsigned)nbrow) {
828 m_w_hybrid[cpt] = ((m_w_mbt[cpt] * factor[cpt]) * factorMBT);
831 m_w_hybrid[cpt] = (m_w_klt[cpt - nbrow] * factorKLT);
836 if (computeCovariance) {
838 if (!isoJoIdentity) {
841 LVJ_true = (L * cVo * oJo);
850 for (
unsigned int i = 0; i < weighted_error.getRows(); i++) {
851 num += m_w_hybrid[i] *
vpMath::sqr(m_error_hybrid[i]);
852 den += m_w_hybrid[i];
854 weighted_error[i] = m_error_hybrid[i] * m_w_hybrid[i];
855 if (m_computeInteraction) {
856 for (
unsigned int j = 0; j < 6; j += 1) {
857 L[i][j] *= m_w_hybrid[i];
862 residu = sqrt(num / den);
864 computeVVSPoseEstimation(isoJoIdentity, iter, L, LTL, weighted_error, m_error_hybrid, m_error_prev, LTR, mu, v,
865 &m_w_hybrid, &m_w_prev);
870 m_cMo = ctTc0 * c0Mo;
876 computeCovarianceMatrixVVS(isoJoIdentity, m_w_hybrid, cMoPrev, L_true, LVJ_true, m_error_hybrid);
879 void vpMbEdgeKltTracker::computeVVSInit()
884 void vpMbEdgeKltTracker::computeVVSInteractionMatrixAndResidu()
887 "computeVVSInteractionMatrixAndR"
888 "esidu() should not be called!");
901 vpMbKltTracker::preTracking(I);
906 if (m_nbInfos >= 4) {
907 unsigned int old_maxIter = m_maxIter;
908 m_maxIter = m_maxIterKlt;
909 vpMbKltTracker::computeVVS();
910 m_maxIter = old_maxIter;
919 unsigned int nbrow = 0;
920 computeVVS(I, m_nbInfos, nbrow);
922 if (postTracking(I, m_w_mbt, m_w_klt)) {
923 vpMbKltTracker::reinit(I);
943 if (displayFeatures) {
944 m_featuresToBeDisplayedKlt = getFeaturesForDisplayKlt();
959 vpMbKltTracker::preTracking(m_I);
964 if (m_nbInfos >= 4) {
965 unsigned int old_maxIter = m_maxIter;
966 m_maxIter = m_maxIterKlt;
967 vpMbKltTracker::computeVVS();
968 m_maxIter = old_maxIter;
977 unsigned int nbrow = 0;
978 computeVVS(m_I, m_nbInfos, nbrow);
980 if (postTracking(I_color, m_w_mbt, m_w_klt)) {
981 vpMbKltTracker::reinit(m_I);
1001 if (displayFeatures) {
1002 m_featuresToBeDisplayedKlt = getFeaturesForDisplayKlt();
1012 if (lvl >= scales.size() || !scales[lvl]) {
1016 unsigned int nbrow = initMbtTracking(lvl);
1024 factor.
resize(nbrow,
false);
1028 for (std::list<vpMbtDistanceLine *>::const_iterator it = lines[lvl].begin(); it != lines[lvl].end(); ++it) {
1029 if ((*it)->isTracked()) {
1036 int index = *itindex;
1047 for (
size_t a = 0; a < l->
meline.size(); a++) {
1048 std::list<vpMeSite>::const_iterator itListLine;
1049 if (l->
meline[a] !=
nullptr) {
1050 itListLine = l->
meline[a]->getMeList().begin();
1052 for (
unsigned int i = 0; i < l->
nbFeature[a]; i++) {
1053 factor[n + i] = fac;
1056 factor[n + i] = 0.2;
1065 for (std::list<vpMbtDistanceCylinder *>::const_iterator it = cylinders[lvl].begin(); it != cylinders[lvl].end();
1067 if ((*it)->isTracked()) {
1072 std::list<vpMeSite>::const_iterator itCyl1;
1073 std::list<vpMeSite>::const_iterator itCyl2;
1075 itCyl1 = cy->
meline1->getMeList().begin();
1076 itCyl2 = cy->
meline2->getMeList().begin();
1079 for (
unsigned int i = 0; i < cy->
nbFeature; i++) {
1080 factor[n + i] = fac;
1082 if (i < cy->nbFeaturel1) {
1091 factor[n + i] = 0.2;
1098 for (std::list<vpMbtDistanceCircle *>::const_iterator it = circles[lvl].begin(); it != circles[lvl].end(); ++it) {
1099 if ((*it)->isTracked()) {
1104 std::list<vpMeSite>::const_iterator itCir;
1106 itCir = ci->
meEllipse->getMeList().begin();
1109 for (
unsigned int i = 0; i < ci->
nbFeature; i++) {
1110 factor[n + i] = fac;
1113 factor[n + i] = 0.2;
1132 for (std::list<vpMbtDistanceLine *>::const_iterator it = lines[lvl].begin(); it != lines[lvl].end(); ++it) {
1133 if ((*it)->isTracked()) {
1137 for (
unsigned int j = 0; j < 6; j++) {
1138 L[n + i][j] = l->
L[i][j];
1139 error[n + i] = l->
error[i];
1146 for (std::list<vpMbtDistanceCylinder *>::const_iterator it = cylinders[lvl].begin(); it != cylinders[lvl].end();
1148 if ((*it)->isTracked()) {
1151 for (
unsigned int i = 0; i < cy->
nbFeature; i++) {
1152 for (
unsigned int j = 0; j < 6; j++) {
1153 L[n + i][j] = cy->
L[i][j];
1154 error[n + i] = cy->
error[i];
1160 for (std::list<vpMbtDistanceCircle *>::const_iterator it = circles[lvl].begin(); it != circles[lvl].end(); ++it) {
1161 if ((*it)->isTracked()) {
1164 for (
unsigned int i = 0; i < ci->
nbFeature; i++) {
1165 for (
unsigned int j = 0; j < 6; j++) {
1166 L[n + i][j] = ci->
L[i][j];
1167 error[n + i] = ci->
error[i];
1186 vpMbKltTracker::setCameraParameters(m_cam);
1195 void vpMbEdgeKltTracker::initFaceFromCorners(
vpMbtPolygon &polygon)
1198 vpMbKltTracker::initFaceFromCorners(polygon);
1206 void vpMbEdgeKltTracker::initFaceFromLines(
vpMbtPolygon &polygon)
1209 vpMbKltTracker::initFaceFromLines(polygon);
1222 void vpMbEdgeKltTracker::initCircle(
const vpPoint &p1,
const vpPoint &p2,
const vpPoint &p3,
double radius,
int idFace,
1223 const std::string &name)
1238 void vpMbEdgeKltTracker::initCylinder(
const vpPoint &p1,
const vpPoint &p2,
double radius,
int idFace,
1239 const std::string &name)
1242 vpMbKltTracker::initCylinder(p1, p2, radius, idFace, name);
1258 bool displayFullModel)
1260 std::vector<std::vector<double> > models =
1261 vpMbEdgeKltTracker::getModelForDisplay(I.
getWidth(), I.
getHeight(), cMo, cam, displayFullModel);
1263 for (
size_t i = 0; i < models.size(); i++) {
1271 double n20 = models[i][3];
1272 double n11 = models[i][4];
1273 double n02 = models[i][5];
1278 if (displayFeatures) {
1279 for (
size_t i = 0; i < m_featuresToBeDisplayedKlt.size(); i++) {
1281 vpImagePoint ip1(m_featuresToBeDisplayedKlt[i][1], m_featuresToBeDisplayedKlt[i][2]);
1284 vpImagePoint ip2(m_featuresToBeDisplayedKlt[i][3], m_featuresToBeDisplayedKlt[i][4]);
1285 double id = m_featuresToBeDisplayedKlt[i][5];
1286 std::stringstream ss;
1293 #ifdef VISP_HAVE_OGRE
1295 faces.displayOgre(cMo);
1312 bool displayFullModel)
1314 std::vector<std::vector<double> > models =
1317 for (
size_t i = 0; i < models.size(); i++) {
1325 double n20 = models[i][3];
1326 double n11 = models[i][4];
1327 double n02 = models[i][5];
1332 if (displayFeatures) {
1333 for (
size_t i = 0; i < m_featuresToBeDisplayedKlt.size(); i++) {
1335 vpImagePoint ip1(m_featuresToBeDisplayedKlt[i][1], m_featuresToBeDisplayedKlt[i][2]);
1338 vpImagePoint ip2(m_featuresToBeDisplayedKlt[i][3], m_featuresToBeDisplayedKlt[i][4]);
1339 double id = m_featuresToBeDisplayedKlt[i][5];
1340 std::stringstream ss;
1347 #ifdef VISP_HAVE_OGRE
1349 faces.displayOgre(cMo);
1353 std::vector<std::vector<double> > vpMbEdgeKltTracker::getModelForDisplay(
unsigned int width,
unsigned int height,
1356 bool displayFullModel)
1358 std::vector<std::vector<double> > models;
1360 for (
unsigned int i = 0; i < scales.size(); i += 1) {
1362 for (std::list<vpMbtDistanceLine *>::const_iterator it = lines[scaleLevel].begin(); it != lines[scaleLevel].end();
1364 std::vector<std::vector<double> > currentModel =
1365 (*it)->getModelForDisplay(width, height, cMo, cam, displayFullModel);
1366 models.insert(models.end(), currentModel.begin(), currentModel.end());
1369 for (std::list<vpMbtDistanceCylinder *>::const_iterator it = cylinders[scaleLevel].begin();
1370 it != cylinders[scaleLevel].end(); ++it) {
1371 std::vector<std::vector<double> > currentModel =
1372 (*it)->getModelForDisplay(width, height, cMo, cam, displayFullModel);
1373 models.insert(models.end(), currentModel.begin(), currentModel.end());
1376 for (std::list<vpMbtDistanceCircle *>::const_iterator it = circles[scaleLevel].begin();
1377 it != circles[scaleLevel].end(); ++it) {
1378 std::vector<double> paramsCircle = (*it)->getModelForDisplay(cMo, cam, displayFullModel);
1379 models.push_back(paramsCircle);
1386 #ifdef VISP_HAVE_OGRE
1388 faces.displayOgre(cMo);
1412 for (std::list<vpMbtDistanceKltPoints *>::const_iterator it = kltPolygons.begin(); it != kltPolygons.end(); ++it) {
1413 vpMbtDistanceKltPoints *kltpoly = *it;
1414 if (kltpoly !=
nullptr) {
1419 kltPolygons.clear();
1421 for (std::list<vpMbtDistanceKltCylinder *>::const_iterator it = kltCylinders.begin(); it != kltCylinders.end();
1423 vpMbtDistanceKltCylinder *kltPolyCylinder = *it;
1424 if (kltPolyCylinder !=
nullptr) {
1425 delete kltPolyCylinder;
1427 kltPolyCylinder =
nullptr;
1429 kltCylinders.clear();
1433 for (std::list<vpMbtDistanceCircle *>::const_iterator it = circles_disp.begin(); it != circles_disp.end(); ++it) {
1435 if (ci !=
nullptr) {
1441 circles_disp.clear();
1443 firstInitialisation =
true;
1449 for (
unsigned int i = 0; i < scales.size(); i += 1) {
1451 for (std::list<vpMbtDistanceLine *>::const_iterator it = lines[i].begin(); it != lines[i].end(); ++it) {
1458 for (std::list<vpMbtDistanceCylinder *>::const_iterator it = cylinders[i].begin(); it != cylinders[i].end();
1466 for (std::list<vpMbtDistanceCircle *>::const_iterator it = circles[i].begin(); it != circles[i].end(); ++it) {
1474 cylinders[i].clear();
1484 nbvisiblepolygone = 0;
1489 loadModel(cad_name, verbose, T);
1495 #elif !defined(VISP_BUILD_SHARED_LIBS)
1498 void dummy_vpMbEdgeKltTracker() { };
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true, bool recopy_=true)
unsigned int getRows() const
Generic class defining intrinsic camera parameters.
Implementation of column vector and the associated operations.
void resize(unsigned int i, bool flagNullify=true)
Class to define RGB colors available for display functionalities.
static void displayLine(const vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1, bool segment=true)
static void displayEllipse(const vpImage< unsigned char > &I, const vpImagePoint ¢er, const double &coef1, const double &coef2, const double &coef3, bool use_normalized_centered_moments, const vpColor &color, unsigned int thickness=1, bool display_center=false, bool display_arc=false)
static void displayCross(const vpImage< unsigned char > &I, const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness=1)
static void displayText(const vpImage< unsigned char > &I, const vpImagePoint &ip, const std::string &s, const vpColor &color)
error that can be emitted by ViSP classes.
@ dimensionError
Bad dimension.
static vpHomogeneousMatrix direct(const vpColVector &v)
Implementation of an homogeneous matrix and operations on such kind of matrices.
vpHomogeneousMatrix inverse() const
Implementation of an homography and operations on homographies.
static void convert(const vpImage< unsigned char > &src, vpImage< vpRGBa > &dest)
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
unsigned int getWidth() const
unsigned int getHeight() const
void init(unsigned int h, unsigned int w, Type value)
static double rad(double deg)
static double sqr(double x)
static bool equal(double x, double y, double threshold=0.001)
static double deg(double rad)
Implementation of a matrix and operations on matrices.
void computeProjectionError(const vpImage< unsigned char > &_I)
void initMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &_cMo)
virtual void initFaceFromLines(vpMbtPolygon &polygon) VP_OVERRIDE
void trackMovingEdge(const vpImage< unsigned char > &I)
virtual void initFaceFromCorners(vpMbtPolygon &polygon) VP_OVERRIDE
void updateMovingEdge(const vpImage< unsigned char > &I)
void reinitMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &_cMo)
void resetTracker() VP_OVERRIDE
virtual void initCylinder(const vpPoint &p1, const vpPoint &p2, double radius, int idFace=0, const std::string &name="") VP_OVERRIDE
void setMovingEdge(const vpMe &me)
virtual void setCameraParameters(const vpCameraParameters &cam) VP_OVERRIDE
virtual void initCircle(const vpPoint &p1, const vpPoint &p2, const vpPoint &p3, double radius, int idFace=0, const std::string &name="") VP_OVERRIDE
bool isAppearing(unsigned int i)
unsigned int clippingFlag
Flags specifying which clipping to used.
virtual void loadConfigFile(const std::string &configFile, bool verbose=true)
Manage a circle used in the model-based tracker.
vpColVector error
The error vector.
unsigned int nbFeature
The number of moving edges.
vpMatrix L
The interaction matrix.
void computeInteractionMatrixError(const vpHomogeneousMatrix &cMo)
void setMeanWeight(double _wmean)
void displayMovingEdges(const vpImage< unsigned char > &I)
bool Reinit
Indicates if the circle has to be reinitialized.
void initInteractionMatrixError()
vpMbtMeEllipse * meEllipse
The moving edge containers.
Manage a cylinder used in the model-based tracker.
void setMeanWeight1(double wmean)
void computeInteractionMatrixError(const vpHomogeneousMatrix &cMo, const vpImage< unsigned char > &I)
vpMbtMeLine * meline2
The moving edge containers (second line of the cylinder)
vpMatrix L
The interaction matrix.
unsigned int nbFeaturel2
The number of moving edges on line 2.
bool Reinit
Indicates if the line has to be reinitialized.
void initInteractionMatrixError()
void setMeanWeight2(double wmean)
unsigned int nbFeaturel1
The number of moving edges on line 1.
vpColVector error
The error vector.
void displayMovingEdges(const vpImage< unsigned char > &I)
unsigned int nbFeature
The number of moving edges.
vpMbtMeLine * meline1
The moving edge containers (first line of the cylinder)
Manage the line of a polygon used in the model-based tracker.
std::vector< unsigned int > nbFeature
The number of moving edges.
void displayMovingEdges(const vpImage< unsigned char > &I)
void computeInteractionMatrixError(const vpHomogeneousMatrix &cMo)
void initInteractionMatrixError()
std::list< int > Lindex_polygon
Index of the faces which contain the line.
unsigned int nbFeatureTotal
The number of moving edges.
bool Reinit
Indicates if the line has to be reinitialized.
vpColVector error
The error vector.
vpMbHiddenFaces< vpMbtPolygon > * hiddenface
Pointer to the list of faces.
bool closeToImageBorder(const vpImage< unsigned char > &I, const unsigned int threshold)
std::vector< vpMbtMeLine * > meline
The moving edge container.
vpMatrix L
The interaction matrix.
void setMeanWeight(double w_mean)
Implementation of a polygon of the model used by the model-based tracker.
Parse an Xml file to extract configuration parameters of a mbtConfig object.
Performs search in a given direction(normal) for a given distance(pixels) for a given 'site'....
@ M_ESTIMATOR
Point detected as an outlier during virtual visual-servoing.
@ NO_SUPPRESSION
Point successfully tracked.
vpMeSiteState getState() const
void setState(const vpMeSiteState &flag)
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
Contains an M-estimator and various influence function.
@ TUKEY
Tukey influence function.
void MEstimator(const vpRobustEstimatorType method, const vpColVector &residues, vpColVector &weights)
void setMinMedianAbsoluteDeviation(double mad_min)
Definition of the vpSubMatrix class that provides a mask on a vpMatrix. All properties of vpMatrix ar...
Error that can be emitted by the vpTracker class and its derivatives.
@ notEnoughPointError
Not enough point to track.
@ fatalError
Tracker fatal error.
vpVelocityTwistMatrix & buildFrom(const vpTranslationVector &t, const vpRotationMatrix &R)