fixed voxelize assertion with c++ rgbd mapping example

This commit is contained in:
matlabbe
2017-07-26 16:00:02 -04:00
parent 3443c3b8ea
commit 0491125e92
2 changed files with 10 additions and 3 deletions

View File

@@ -428,7 +428,7 @@ void DBDriverSqlite3::disconnectDatabaseQuery(bool save, const std::string & out
} }
if(outputFile.empty()) if(outputFile.empty())
{ {
UERROR("Database was initialized with an empty url (in memory). To save it " UERROR("Database was initialized with an empty url (in memory). To save it, "
"the output url should not be empty. The database is thus closed without being saved!"); "the output url should not be empty. The database is thus closed without being saved!");
} }
else else

View File

@@ -38,6 +38,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdio.h> #include <stdio.h>
#include <pcl/io/pcd_io.h> #include <pcl/io/pcd_io.h>
#include <pcl/io/ply_io.h> #include <pcl/io/ply_io.h>
#include <pcl/filters/filter.h>
#include "MapBuilder.h" #include "MapBuilder.h"
@@ -216,8 +217,14 @@ int main(int argc, char * argv[])
node.sensorData(), node.sensorData(),
4, // image decimation before creating the clouds 4, // image decimation before creating the clouds
4.0f, // maximum depth of the cloud 4.0f, // maximum depth of the cloud
0.01f); // Voxel grid filtering 0.0f);
*cloud += *util3d::transformPointCloud(tmp, iter->second); // transform the point cloud to its pose pcl::PointCloud<pcl::PointXYZRGB>::Ptr tmpNoNaN(new pcl::PointCloud<pcl::PointXYZRGB>);
std::vector<int> index;
pcl::removeNaNFromPointCloud(*tmp, *tmpNoNaN, index);
if(!tmpNoNaN->empty())
{
*cloud += *util3d::transformPointCloud(tmpNoNaN, iter->second); // transform the point cloud to its pose
}
} }
if(cloud->size()) if(cloud->size())
{ {