+ fix for pcl 1.6

This commit is contained in:
wmayer 2014-08-28 00:02:58 +02:00
parent eb734eb6f4
commit a579bdce72
2 changed files with 55 additions and 9 deletions

View File

@ -471,3 +471,39 @@ SET(PYSIDE_INCLUDE_DIR ${FREECAD_LIBPACK_DIR}/include/PySide-1.2.1)
SET(PYSIDE_LIBRARY optimized ${FREECAD_LIBPACK_DIR}/lib/pyside-python2.7.lib debug ${FREECAD_LIBPACK_DIR}/lib/pyside-python2.7_d.lib)
SET(PYSIDE_PYTHONPATH ${FREECAD_LIBPACK_DIR}/pyside/Lib/site-packages)
SET(PYSIDE_TYPESYSTEMS ${FREECAD_LIBPACK_DIR}/pyside/share/PySide/typesystems)
# Pointscloud library
set(PCL_INCLUDE_DIRS ${FREECAD_LIBPACK_DIR}/include/pcl-1.6)
set(PCL_LIBRARIES
debug pcl_common_debug.lib
optimized pcl_common_release.lib
debug pcl_features_debug.lib
optimized pcl_features_release.lib
debug pcl_filters_debug.lib
optimized pcl_filters_release.lib
debug pcl_io_debug.lib
debug pcl_io_ply_debug.lib
optimized pcl_io_ply_release.lib
optimized pcl_io_release.lib
debug pcl_kdtree_debug.lib
optimized pcl_kdtree_release.lib
debug pcl_keypoints_debug.lib
optimized pcl_keypoints_release.lib
debug pcl_octree_debug.lib
optimized pcl_octree_release.lib
debug pcl_registration_debug.lib
optimized pcl_registration_release.lib
debug pcl_sample_consensus_debug.lib
optimized pcl_sample_consensus_release.lib
debug pcl_search_debug.lib
optimized pcl_search_release.lib
debug pcl_segmentation_debug.lib
optimized pcl_segmentation_release.lib
debug pcl_surface_debug.lib
optimized pcl_surface_release.lib
debug pcl_tracking_debug.lib
optimized pcl_tracking_release.lib
)
set(PCL_FOUND TRUE)
set(FLANN_INCLUDE_DIRS ${FREECAD_LIBPACK_DIR}/include/flann-1.7.1)

View File

@ -31,19 +31,24 @@
// http://svn.pointclouds.org/pcl/tags/pcl-1.5.1/test/
#if defined(PCL_FOUND)
#include <pcl/pcl_config.h>
#include <pcl/point_types.h>
#include <pcl/features/normal_3d.h>
#include <pcl/surface/mls.h>
#include <pcl/point_traits.h>
#include <pcl/surface/gp3.h>
#include <pcl/surface/grid_projection.h>
#include <pcl/surface/convex_hull.h>
#include <pcl/surface/concave_hull.h>
//#include <pcl/surface/convex_hull.h>
//#include <pcl/surface/concave_hull.h>
#include <pcl/surface/organized_fast_mesh.h>
#include <pcl/surface/ear_clipping.h>
#include <pcl/common/common.h>
#include <boost/random.hpp>
#ifndef PCL_REVISION_VERSION
#define PCL_REVISION_VERSION 0
#endif
using namespace pcl;
using namespace pcl::io;
using namespace std;
@ -104,10 +109,10 @@ void SurfaceTriangulation::perform()
gp3.reconstruct (mesh);
// number of points
int nr_points = mesh.cloud.width * mesh.cloud.height;
int point_size = mesh.cloud.data.size () / nr_points;
size_t nr_points = mesh.cloud.width * mesh.cloud.height;
size_t point_size = mesh.cloud.data.size () / nr_points;
// number of faces for header
int nr_faces = mesh.polygons.size ();
size_t nr_faces = mesh.polygons.size ();
MeshCore::MeshPointArray points;
points.reserve(nr_points);
@ -116,13 +121,18 @@ void SurfaceTriangulation::perform()
// get vertices
MeshCore::MeshPoint vertex;
for (int i = 0; i < nr_points; ++i) {
for (size_t i = 0; i < nr_points; ++i) {
int xyz = 0;
for (size_t d = 0; d < mesh.cloud.fields.size(); ++d) {
int c = 0;
// adding vertex
if ((mesh.cloud.fields[d].datatype == pcl::PCLPointField::FLOAT32) && (
mesh.cloud.fields[d].name == "x" ||
if ((mesh.cloud.fields[d].datatype ==
#if PCL_VERSION_COMPARE(>,1,6,0)
pcl::PCLPointField::FLOAT32) &&
#else
sensor_msgs::PointField::FLOAT32) &&
#endif
(mesh.cloud.fields[d].name == "x" ||
mesh.cloud.fields[d].name == "y" ||
mesh.cloud.fields[d].name == "z"))
{
@ -138,7 +148,7 @@ void SurfaceTriangulation::perform()
}
// get faces
MeshCore::MeshFacet face;
for(int i = 0; i < nr_faces; i++) {
for (size_t i = 0; i < nr_faces; i++) {
face._aulPoints[0] = mesh.polygons[i].vertices[0];
face._aulPoints[1] = mesh.polygons[i].vertices[1];
face._aulPoints[2] = mesh.polygons[i].vertices[2];