mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-03 01:50:24 +08:00
Fixed PCL extract indices filter workaround for PointNormal type (not defined in current released PCL). Compression: Fixed OpenCV memory leak when converting uncompressed depth image to 32F format.
This commit is contained in:
@@ -139,7 +139,11 @@ cv::Mat uncompressImage(const cv::Mat & bytes)
|
||||
#endif
|
||||
if(image.type() == CV_8UC4)
|
||||
{
|
||||
image = cv::Mat(image.size(), CV_32FC1, image.data).clone();
|
||||
// Using clone() or copyTo() caused a memory leak !?!?
|
||||
// image = cv::Mat(image.size(), CV_32FC1, image.data).clone();
|
||||
cv::Mat depth(image.size(), CV_32FC1);
|
||||
memcpy(depth.data, image.data, image.total()*image.elemSize());
|
||||
image = depth;
|
||||
}
|
||||
}
|
||||
return image;
|
||||
|
||||
@@ -277,12 +277,7 @@ void OccupancyGrid::createLocalMap(
|
||||
// update viewpoint
|
||||
viewPoint = cv::Point3f(t.x(), t.y(), t.z());
|
||||
|
||||
if(scan.channels() == 6)
|
||||
{
|
||||
pcl::PointCloud<pcl::PointNormal>::Ptr cloud = util3d::laserScanToPointCloudNormal(scan, t);
|
||||
createLocalMap<pcl::PointNormal>(cloud, node.getPose(), groundCells, obstacleCells, emptyCells, viewPoint);
|
||||
}
|
||||
else if(scan.channels() == 7)
|
||||
if(scan.channels() == 6 || scan.channels() == 7)
|
||||
{
|
||||
pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr cloud = util3d::laserScanToPointCloudRGBNormal(scan, t);
|
||||
createLocalMap<pcl::PointXYZRGBNormal>(cloud, node.getPose(), groundCells, obstacleCells, emptyCells, viewPoint);
|
||||
|
||||
@@ -427,6 +427,10 @@ SensorData::SensorData(
|
||||
}
|
||||
}
|
||||
|
||||
SensorData::~SensorData()
|
||||
{
|
||||
}
|
||||
|
||||
void SensorData::setUserDataRaw(const cv::Mat & userDataRaw)
|
||||
{
|
||||
if(!userDataRaw.empty() && !_userDataRaw.empty())
|
||||
|
||||
@@ -1420,10 +1420,11 @@ pcl::IndicesPtr extractIndices(const pcl::PointCloud<pcl::PointXYZ>::Ptr & cloud
|
||||
{
|
||||
return extractIndicesImpl<pcl::PointXYZ>(cloud, indices, negative);
|
||||
}
|
||||
pcl::IndicesPtr extractIndices(const pcl::PointCloud<pcl::PointNormal>::Ptr & cloud, const pcl::IndicesPtr & indices, bool negative)
|
||||
{
|
||||
return extractIndicesImpl<pcl::PointNormal>(cloud, indices, negative);
|
||||
}
|
||||
// PCL default lacks of pcl::PointNormal type support
|
||||
//pcl::IndicesPtr extractIndices(const pcl::PointCloud<pcl::PointNormal>::Ptr & cloud, const pcl::IndicesPtr & indices, bool negative)
|
||||
//{
|
||||
// return extractIndicesImpl<pcl::PointNormal>(cloud, indices, negative);
|
||||
//}
|
||||
pcl::IndicesPtr extractIndices(const pcl::PointCloud<pcl::PointXYZRGB>::Ptr & cloud, const pcl::IndicesPtr & indices, bool negative)
|
||||
{
|
||||
return extractIndicesImpl<pcl::PointXYZRGB>(cloud, indices, negative);
|
||||
@@ -1457,10 +1458,11 @@ pcl::PointCloud<pcl::PointXYZRGB>::Ptr extractIndices(const pcl::PointCloud<pcl:
|
||||
{
|
||||
return extractIndicesImpl<pcl::PointXYZRGB>(cloud, indices, negative, keepOrganized);
|
||||
}
|
||||
pcl::PointCloud<pcl::PointNormal>::Ptr extractIndices(const pcl::PointCloud<pcl::PointNormal>::Ptr & cloud, const pcl::IndicesPtr & indices, bool negative, bool keepOrganized)
|
||||
{
|
||||
return extractIndicesImpl<pcl::PointNormal>(cloud, indices, negative, keepOrganized);
|
||||
}
|
||||
// PCL default lacks of pcl::PointNormal type support
|
||||
//pcl::PointCloud<pcl::PointNormal>::Ptr extractIndices(const pcl::PointCloud<pcl::PointNormal>::Ptr & cloud, const pcl::IndicesPtr & indices, bool negative, bool keepOrganized)
|
||||
//{
|
||||
// return extractIndicesImpl<pcl::PointNormal>(cloud, indices, negative, keepOrganized);
|
||||
//}
|
||||
pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr extractIndices(const pcl::PointCloud<pcl::PointXYZRGBNormal>::Ptr & cloud, const pcl::IndicesPtr & indices, bool negative, bool keepOrganized)
|
||||
{
|
||||
return extractIndicesImpl<pcl::PointXYZRGBNormal>(cloud, indices, negative, keepOrganized);
|
||||
|
||||
Reference in New Issue
Block a user