@@ -60,13 +60,13 @@ void vpRBDenseDepthTracker::extractFeatures(const vpRBFeatureTrackerInput &frame
60
60
const vpHomogeneousMatrix &cMo = frame.renders .cMo ;
61
61
vpHomogeneousMatrix oMc = cMo.inverse ();
62
62
vpRotationMatrix cRo = cMo.getRotationMatrix ();
63
+ vpTranslationVector co = oMc.getTranslationVector ();
63
64
bool useMask = m_useMask && frame.hasMask ();
64
65
m_depthPoints.clear ();
65
66
m_depthPoints.reserve (static_cast <size_t >(bb.getArea () / (m_step * m_step * 2 )));
66
67
vpDepthPoint point;
67
68
for (unsigned int i = static_cast <unsigned int >(bb.getTop ()); i < static_cast <unsigned int >(bb.getBottom ()); i += m_step) {
68
69
for (unsigned int j = static_cast <unsigned int >(bb.getLeft ()); j < static_cast <unsigned int >(bb.getRight ()); j += m_step) {
69
- // if (renderDepth[i][j] > frame.renders.zNear && renderDepth[i][j] < frame.renders.zFar && depthMap[i][j] > frame.renders.zNear * 0.33 && depthMap[i][j] < frame.renders.zFar * 3.0) {
70
70
double Z = renderDepth[i][j];
71
71
double currZ = depthMap[i][j];
72
72
if (Z > 0 .f && currZ > 0 .f ) {
@@ -80,14 +80,16 @@ void vpRBDenseDepthTracker::extractFeatures(const vpRBFeatureTrackerInput &frame
80
80
point.objectNormal [1 ] = frame.renders .normals [i][j].G ;
81
81
point.objectNormal [2 ] = frame.renders .normals [i][j].B ;
82
82
83
- // fastRotationMatmul(cRo, frame.renders.normals[i][j], point.objectNormal);
84
- // vpColVector cameraNormal = cRo * objectNormal;
85
- // if (acos(cameraNormal * vpColVector({ 0.0, 0.0, -1.0 })) > vpMath::rad(70.0)) {
86
- // continue;
87
- // }
83
+ fastProjection (oMc, x * Z, y * Z, Z, point.oP );
84
+
85
+ vpColVector cameraRay ({ co[0 ] - point.oP .get_oX (), co[1 ] - point.oP .get_oY (), co[2 ] - point.oP .get_oZ () });
86
+ cameraRay.normalize ();
87
+
88
+ if (acos (cameraRay * point.objectNormal ) > vpMath::rad (85.0 )) {
89
+ continue ;
90
+ }
88
91
// vpColVector cp({ x * Z, y * Z, Z, 1 });
89
92
// vpColVector oP = oMc * cp;
90
- fastProjection (oMc, x * Z, y * Z, Z, point.oP );
91
93
// point.oP = vpPoint(oP);
92
94
point.pixelPos .set_ij (i, j);
93
95
point.currentPoint [0 ] = x * currZ;
@@ -136,7 +138,7 @@ void vpRBDenseDepthTracker::computeVVSIter(const vpRBFeatureTrackerInput &/*fram
136
138
}
137
139
138
140
// m_weights = 0.0;
139
- // m_robust.setMinMedianAbsoluteDeviation(1e-3);
141
+ m_robust.setMinMedianAbsoluteDeviation (1e-3 );
140
142
m_robust.MEstimator (vpRobust::TUKEY, m_error, m_weights);
141
143
for (unsigned int i = 0 ; i < m_depthPoints.size (); ++i) {
142
144
m_weighted_error[i] = m_error[i] * m_weights[i];
0 commit comments