mirror of
https://github.com/introlab/rtabmap.git
synced 2026-10-05 09:37:46 +08:00
Added coverage report
This commit is contained in:
@@ -420,7 +420,10 @@ unsigned long BayesFilter::getMemoryUsed() const
|
||||
{
|
||||
long memoryUsage = sizeof(BayesFilter);
|
||||
memoryUsage += _posterior.size() * (sizeof(float)+sizeof(int)+sizeof(std::map<int, float>::iterator)) + sizeof(std::map<int, float>);
|
||||
memoryUsage += _prediction.total() * _prediction.elemSize();
|
||||
if(!_prediction.empty())
|
||||
{
|
||||
memoryUsage += _prediction.total() * _prediction.elemSize();
|
||||
}
|
||||
memoryUsage += _predictionLC.size() * sizeof(double);
|
||||
memoryUsage += _neighborsIndex.size() * (sizeof(int)+sizeof(std::map<int, int>)+sizeof(std::map<int, std::map<int, int> >::iterator)) + sizeof(std::map<int, std::map<int, int> >);
|
||||
for(std::map<int, std::map<int, int> >::const_iterator iter=_neighborsIndex.begin(); iter!=_neighborsIndex.end(); ++iter)
|
||||
|
||||
@@ -331,6 +331,10 @@ std::string uncompressString(const cv::Mat & bytes)
|
||||
|
||||
std::string compressedDepthFormat(const cv::Mat & bytes)
|
||||
{
|
||||
if(bytes.empty())
|
||||
{
|
||||
return std::string();
|
||||
}
|
||||
return compressedDepthFormat(bytes.data, bytes.rows * bytes.cols * bytes.elemSize());
|
||||
}
|
||||
std::string compressedDepthFormat(const std::vector<unsigned char> & bytes)
|
||||
|
||||
+33
-15
@@ -36,6 +36,23 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
namespace rtabmap
|
||||
{
|
||||
|
||||
namespace {
|
||||
bool isOccupancyGridLayerFormatSupported(const cv::Mat & layer)
|
||||
{
|
||||
if(layer.empty())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return layer.type() == CV_32FC2 ||
|
||||
layer.type() == CV_32FC3 ||
|
||||
layer.type() == CV_32FC(4) ||
|
||||
layer.type() == CV_32FC(5) ||
|
||||
layer.type() == CV_32FC(6) ||
|
||||
layer.type() == CV_32FC(7) ||
|
||||
(layer.type() == CV_8UC1 && layer.rows == 1);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
// empty constructor
|
||||
SensorData::SensorData() :
|
||||
_id(0),
|
||||
@@ -582,6 +599,19 @@ void SensorData::setOccupancyGrid(
|
||||
_emptyCellsRaw = cv::Mat();
|
||||
_emptyCellsCompressed = cv::Mat();
|
||||
|
||||
if(!ground.empty() && !isOccupancyGridLayerFormatSupported(ground))
|
||||
{
|
||||
UFATAL("Unsupported local occupancy grid format for ground cells: OpenCV type=%d size=%dx%d", ground.type(), ground.cols, ground.rows);
|
||||
}
|
||||
if(!obstacles.empty() && !isOccupancyGridLayerFormatSupported(obstacles))
|
||||
{
|
||||
UFATAL("Unsupported local occupancy grid format for obstacle cells: OpenCV type=%d size=%dx%d", obstacles.type(), obstacles.cols, obstacles.rows);
|
||||
}
|
||||
if(!empty.empty() && !isOccupancyGridLayerFormatSupported(empty))
|
||||
{
|
||||
UFATAL("Unsupported local occupancy grid format for empty cells: OpenCV type=%d size=%dx%d", empty.type(), empty.cols, empty.rows);
|
||||
}
|
||||
|
||||
CompressionThread ctGround(ground);
|
||||
CompressionThread ctObstacles(obstacles);
|
||||
CompressionThread ctEmpty(empty);
|
||||
@@ -593,14 +623,10 @@ void SensorData::setOccupancyGrid(
|
||||
_groundCellsRaw = ground;
|
||||
ctGround.start();
|
||||
}
|
||||
else if(ground.type() == CV_8UC1 && ground.rows == 1)
|
||||
else // CV_8UC1 && rows == 1
|
||||
{
|
||||
_groundCellsCompressed = ground;
|
||||
}
|
||||
else
|
||||
{
|
||||
UFATAL("Unsupported local occupancy grid format for ground cells: OpenCV type=%d size=%dx%d", ground.type(), ground.cols, ground.rows);
|
||||
}
|
||||
}
|
||||
if(!obstacles.empty())
|
||||
{
|
||||
@@ -609,14 +635,10 @@ void SensorData::setOccupancyGrid(
|
||||
_obstacleCellsRaw = obstacles;
|
||||
ctObstacles.start();
|
||||
}
|
||||
else if(obstacles.type() == CV_8UC1 && obstacles.rows == 1)
|
||||
else // CV_8UC1 && rows == 1
|
||||
{
|
||||
_obstacleCellsCompressed = obstacles;
|
||||
}
|
||||
else
|
||||
{
|
||||
UFATAL("Unsupported local occupancy grid format for obstacle cells: OpenCV type=%d size=%dx%d", obstacles.type(), obstacles.cols, obstacles.rows);
|
||||
}
|
||||
}
|
||||
if(!empty.empty())
|
||||
{
|
||||
@@ -625,14 +647,10 @@ void SensorData::setOccupancyGrid(
|
||||
_emptyCellsRaw = empty;
|
||||
ctEmpty.start();
|
||||
}
|
||||
else if(empty.type() == CV_8UC1 && empty.rows == 1)
|
||||
else // CV_8UC1 && rows == 1
|
||||
{
|
||||
_emptyCellsCompressed = empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
UFATAL("Unsupported local occupancy grid format for empty cells: OpenCV type=%d size=%dx%d", empty.type(), empty.cols, empty.rows);
|
||||
}
|
||||
}
|
||||
ctGround.join();
|
||||
ctObstacles.join();
|
||||
|
||||
@@ -377,7 +377,10 @@ unsigned long VWDictionary::getMemoryUsed() const
|
||||
{
|
||||
long memoryUsage = sizeof(VWDictionary);
|
||||
memoryUsage += getIndexMemoryUsed();
|
||||
memoryUsage += _dataTree.total()*_dataTree.elemSize();
|
||||
if(!_dataTree.empty())
|
||||
{
|
||||
memoryUsage += _dataTree.total()*_dataTree.elemSize();
|
||||
}
|
||||
if(!_visualWords.empty())
|
||||
{
|
||||
memoryUsage += _visualWords.size()*(sizeof(int) + _visualWords.rbegin()->second->getMemoryUsed() + sizeof(std::map<int, VisualWord *>::iterator)) + sizeof(std::map<int, VisualWord *>);
|
||||
|
||||
@@ -47,6 +47,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <pcl/surface/mls.h>
|
||||
#include <pcl18/surface/texture_mapping.h>
|
||||
#include <pcl/features/integral_image_normal.h>
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef RTABMAP_ALICE_VISION
|
||||
#include <aliceVision/sfmData/SfMData.hpp>
|
||||
@@ -91,6 +92,23 @@ namespace rtabmap
|
||||
namespace util3d
|
||||
{
|
||||
|
||||
namespace {
|
||||
float pcaEigenvalueAt(const cv::Mat & eigenvalues, int index)
|
||||
{
|
||||
if(eigenvalues.empty())
|
||||
{
|
||||
return 0.f;
|
||||
}
|
||||
if(eigenvalues.rows == 1)
|
||||
{
|
||||
index = std::min(index, eigenvalues.cols - 1);
|
||||
return eigenvalues.at<float>(0, index);
|
||||
}
|
||||
index = std::min(index, eigenvalues.rows - 1);
|
||||
return eigenvalues.at<float>(index, 0);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void createPolygonIndexes(
|
||||
const std::vector<pcl::Vertices> & polygons,
|
||||
int cloudSize,
|
||||
@@ -3218,7 +3236,7 @@ float computeNormalsComplexity(
|
||||
}
|
||||
if(oi>1)
|
||||
{
|
||||
cv::PCA pca_analysis(cv::Mat(data_normals, cv::Range(0, oi*2)), cv::Mat(), CV_PCA_DATA_AS_ROW);
|
||||
cv::PCA pca_analysis(cv::Mat(data_normals, cv::Range(0, oi)), cv::Mat(), CV_PCA_DATA_AS_ROW);
|
||||
|
||||
if(pcaEigenVectors)
|
||||
{
|
||||
@@ -3230,7 +3248,7 @@ float computeNormalsComplexity(
|
||||
}
|
||||
UASSERT((is2d && pca_analysis.eigenvalues.total()>=2) || (!is2d && pca_analysis.eigenvalues.total()>=3));
|
||||
// Get last eigen value, scale between 0 and 1: 0=low complexity, 1=high complexity
|
||||
return pca_analysis.eigenvalues.at<float>(0, is2d?1:2)*(is2d?2.0f:3.0f);
|
||||
return pcaEigenvalueAt(pca_analysis.eigenvalues, is2d?1:2)*(is2d?2.0f:3.0f);
|
||||
}
|
||||
}
|
||||
else if(!scan.isEmpty())
|
||||
@@ -3279,7 +3297,7 @@ float computeNormalsComplexity(
|
||||
}
|
||||
if(oi>1)
|
||||
{
|
||||
cv::PCA pca_analysis(cv::Mat(data_normals, cv::Range(0, oi*2)), cv::Mat(), CV_PCA_DATA_AS_ROW);
|
||||
cv::PCA pca_analysis(cv::Mat(data_normals, cv::Range(0, oi)), cv::Mat(), CV_PCA_DATA_AS_ROW);
|
||||
|
||||
if(pcaEigenVectors)
|
||||
{
|
||||
@@ -3291,7 +3309,7 @@ float computeNormalsComplexity(
|
||||
}
|
||||
|
||||
// Get last eigen value, scale between 0 and 1: 0=low complexity, 1=high complexity
|
||||
return pca_analysis.eigenvalues.at<float>(0, is2d?1:2)*(is2d?2.0f:3.0f);
|
||||
return pcaEigenvalueAt(pca_analysis.eigenvalues, is2d?1:2)*(is2d?2.0f:3.0f);
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
@@ -3335,7 +3353,7 @@ float computeNormalsComplexity(
|
||||
}
|
||||
if(oi>1)
|
||||
{
|
||||
cv::PCA pca_analysis(cv::Mat(data_normals, cv::Range(0, oi*2)), cv::Mat(), CV_PCA_DATA_AS_ROW);
|
||||
cv::PCA pca_analysis(cv::Mat(data_normals, cv::Range(0, oi)), cv::Mat(), CV_PCA_DATA_AS_ROW);
|
||||
|
||||
if(pcaEigenVectors)
|
||||
{
|
||||
@@ -3347,7 +3365,7 @@ float computeNormalsComplexity(
|
||||
}
|
||||
|
||||
// Get last eigen value, scale between 0 and 1: 0=low complexity, 1=high complexity
|
||||
return pca_analysis.eigenvalues.at<float>(0, is2d?1:2)*(is2d?2.0f:3.0f);
|
||||
return pcaEigenvalueAt(pca_analysis.eigenvalues, is2d?1:2)*(is2d?2.0f:3.0f);
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
@@ -3391,7 +3409,7 @@ float computeNormalsComplexity(
|
||||
}
|
||||
if(oi>1)
|
||||
{
|
||||
cv::PCA pca_analysis(cv::Mat(data_normals, cv::Range(0, oi*2)), cv::Mat(), CV_PCA_DATA_AS_ROW);
|
||||
cv::PCA pca_analysis(cv::Mat(data_normals, cv::Range(0, oi)), cv::Mat(), CV_PCA_DATA_AS_ROW);
|
||||
|
||||
if(pcaEigenVectors)
|
||||
{
|
||||
@@ -3403,7 +3421,7 @@ float computeNormalsComplexity(
|
||||
}
|
||||
|
||||
// Get last eigen value, scale between 0 and 1: 0=low complexity, 1=high complexity
|
||||
return pca_analysis.eigenvalues.at<float>(0, is2d?1:2)*(is2d?2.0f:3.0f);
|
||||
return pcaEigenvalueAt(pca_analysis.eigenvalues, is2d?1:2)*(is2d?2.0f:3.0f);
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
@@ -3447,7 +3465,7 @@ float computeNormalsComplexity(
|
||||
}
|
||||
if(oi>1)
|
||||
{
|
||||
cv::PCA pca_analysis(cv::Mat(data_normals, cv::Range(0, oi*2)), cv::Mat(), CV_PCA_DATA_AS_ROW);
|
||||
cv::PCA pca_analysis(cv::Mat(data_normals, cv::Range(0, oi)), cv::Mat(), CV_PCA_DATA_AS_ROW);
|
||||
|
||||
if(pcaEigenVectors)
|
||||
{
|
||||
@@ -3459,7 +3477,7 @@ float computeNormalsComplexity(
|
||||
}
|
||||
|
||||
// Get last eigen value, scale between 0 and 1: 0=low complexity, 1=high complexity
|
||||
return pca_analysis.eigenvalues.at<float>(0, is2d?1:2)*(is2d?2.0f:3.0f);
|
||||
return pcaEigenvalueAt(pca_analysis.eigenvalues, is2d?1:2)*(is2d?2.0f:3.0f);
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user