@@ -94,8 +94,12 @@ void vpRBSilhouetteCCDTracker::extractFeatures(const vpRBFeatureTrackerInput &fr
94
94
// std::cout << sp.j << ", " << sp.i << std::endl;
95
95
int ii = sp.i , jj = sp.j ;
96
96
97
+ if (ii < 4 || jj < 4 || static_cast <unsigned int >(ii) > frame.I .getHeight () - 4 || static_cast <unsigned int >(jj) > frame.I .getWidth () - 4 ) {
98
+ continue ;
99
+ }
97
100
vpRBSilhouetteControlPoint pccd;
98
101
pccd.buildSilhouettePoint (ii, jj, sp.Z , sp.orientation , sp.normal , cMo, oMc, frame.cam );
102
+
99
103
pccd.detectSilhouette (frame.renders .depth );
100
104
if (pccd.isSilhouette () && !std::isnan (sp.orientation ) && pccd.isValid ()) {
101
105
m_controlPoints.push_back (std::move (pccd));
@@ -373,7 +377,7 @@ void vpRBSilhouetteCCDTracker::computeLocalStatistics(const vpImage<vpRGBa> &I,
373
377
normalized_param[kk][1 ] += vic_ptr[10 * negative_normal + 7 ];
374
378
}
375
379
376
- }
380
+ }
377
381
#ifdef VISP_HAVE_OPENMP
378
382
#pragma omp parallel for
379
383
#endif
@@ -489,7 +493,7 @@ void vpRBSilhouetteCCDTracker::computeLocalStatistics(const vpImage<vpRGBa> &I,
489
493
}
490
494
491
495
}
492
- }
496
+ }
493
497
494
498
void vpRBSilhouetteCCDTracker::computeErrorAndInteractionMatrix ()
495
499
{
@@ -647,10 +651,14 @@ void vpRBSilhouetteCCDTracker::computeErrorAndInteractionMatrix()
647
651
648
652
m_LTL = m_hessian;
649
653
m_LTR = -m_gradient;
650
-
651
- vpMatrix hessian_E_inv = m_hessian.inverseByCholesky ();
652
- // m_sigma = /*m_sigma +*/ 2*hessian_E_inv;
653
- m_sigma = m_ccdParameters.covarianceIterDecreaseFactor * m_sigma + 2.0 * (1.0 - m_ccdParameters.covarianceIterDecreaseFactor ) * hessian_E_inv;
654
+ try {
655
+ vpMatrix hessian_E_inv = m_hessian.inverseByCholesky ();
656
+ // m_sigma = /*m_sigma +*/ 2*hessian_E_inv;
657
+ m_sigma = m_ccdParameters.covarianceIterDecreaseFactor * m_sigma + 2.0 * (1.0 - m_ccdParameters.covarianceIterDecreaseFactor ) * hessian_E_inv;
658
+ }
659
+ catch (vpException &e) {
660
+ std::cerr << " Inversion issues in CCD tracker" << std::endl;
661
+ }
654
662
655
663
}
656
664
0 commit comments