mirror of
https://github.com/introlab/rtabmap.git
synced 2026-10-06 01:57:45 +08:00
RegVis: fixed Vis/MaxDepth and Vis/MinDepth ignored when features are already extracted.
This commit is contained in:
+4
-28
@@ -4469,34 +4469,10 @@ Signature * Memory::createSignature(const SensorData & inputData, const Transfor
|
||||
(!data.rightRaw().empty() && data.stereoCameraModel().isValidForProjection())))
|
||||
{
|
||||
keypoints3D = _feature2D->generateKeypoints3D(data, keypoints);
|
||||
if(_feature2D->getMinDepth() > 0.0f || _feature2D->getMaxDepth() > 0.0f)
|
||||
{
|
||||
UDEBUG("");
|
||||
//remove all keypoints/descriptors with no valid 3D points
|
||||
UASSERT((int)keypoints.size() == descriptors.rows &&
|
||||
keypoints3D.size() == keypoints.size());
|
||||
std::vector<cv::KeyPoint> validKeypoints(keypoints.size());
|
||||
std::vector<cv::Point3f> validKeypoints3D(keypoints.size());
|
||||
cv::Mat validDescriptors(descriptors.size(), descriptors.type());
|
||||
|
||||
int oi=0;
|
||||
for(unsigned int i=0; i<keypoints3D.size(); ++i)
|
||||
{
|
||||
if(util3d::isFinite(keypoints3D[i]))
|
||||
{
|
||||
validKeypoints[oi] = keypoints[i];
|
||||
validKeypoints3D[oi] = keypoints3D[i];
|
||||
descriptors.row(i).copyTo(validDescriptors.row(oi));
|
||||
++oi;
|
||||
}
|
||||
}
|
||||
UDEBUG("Removed %d invalid 3D points", (int)keypoints3D.size()-oi);
|
||||
validKeypoints.resize(oi);
|
||||
validKeypoints3D.resize(oi);
|
||||
keypoints = validKeypoints;
|
||||
keypoints3D = validKeypoints3D;
|
||||
descriptors = validDescriptors.rowRange(0, oi).clone();
|
||||
}
|
||||
}
|
||||
if(_feature2D->getMinDepth() > 0.0f || _feature2D->getMaxDepth() > 0.0f)
|
||||
{
|
||||
_feature2D->filterKeypointsByDepth(keypoints, descriptors, keypoints3D, _feature2D->getMinDepth(), _feature2D->getMaxDepth());
|
||||
}
|
||||
t = timer.ticks();
|
||||
if(stats) stats->addStatistic(Statistics::kTimingMemKeypoints_3D(), t*1000.0f);
|
||||
|
||||
Reference in New Issue
Block a user