Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrections to Windows unit tests. #2596

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions features/include/pcl/features/fpfh_omp.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ namespace pcl
* In Proceedings of the 22nd IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS),
* St. Louis, MO, USA, October 11-15 2009.
*
* \attention
* \attention
* The convention for FPFH features is:
* - if a query point's nearest neighbors cannot be estimated, the FPFH feature will be set to NaN
* - if a query point's nearest neighbors cannot be estimated, the FPFH feature will be set to NaN
* (not a number)
* - it is impossible to estimate a FPFH descriptor for a point that
* doesn't have finite 3D coordinates. Therefore, any point that contains
Expand Down Expand Up @@ -95,24 +95,26 @@ namespace pcl
/** \brief Initialize the scheduler and set the number of threads to use.
* \param[in] nr_threads the number of hardware threads to use (0 sets the value back to automatic)
*/
FPFHEstimationOMP (unsigned int nr_threads = 0) : nr_bins_f1_ (11), nr_bins_f2_ (11), nr_bins_f3_ (11), threads_ (nr_threads)
FPFHEstimationOMP (unsigned int nr_threads = 0) : nr_bins_f1_ (11), nr_bins_f2_ (11), nr_bins_f3_ (11)
{
feature_name_ = "FPFHEstimationOMP";

setNumberOfThreads(nr_threads);
}

/** \brief Initialize the scheduler and set the number of threads to use.
* \param[in] nr_threads the number of hardware threads to use (0 sets the value back to automatic)
*/
inline void
setNumberOfThreads (unsigned int nr_threads = 0) { threads_ = nr_threads; }
void
setNumberOfThreads (unsigned int nr_threads = 0);

private:
/** \brief Estimate the Fast Point Feature Histograms (FPFH) descriptors at a set of points given by
* <setInputCloud (), setIndices ()> using the surface in setSearchSurface () and the spatial locator in
* setSearchMethod ()
* \param[out] output the resultant point cloud model dataset that contains the FPFH feature estimates
*/
void
void
computeFeature (PointCloudOut &output);

public:
Expand Down
14 changes: 14 additions & 0 deletions features/include/pcl/features/impl/fpfh_omp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@

#include <pcl/features/fpfh_omp.h>

//////////////////////////////////////////////////////////////////////////////////////////////
template <typename PointInT, typename PointNT, typename PointOutT> void
pcl::FPFHEstimationOMP<PointInT, PointNT, PointOutT>::setNumberOfThreads (unsigned int nr_threads)
{
if (nr_threads == 0)
#ifdef _OPENMP
threads_ = omp_get_num_procs();
#else
threads_ = 1;
#endif
else
threads_ = nr_threads;
}

//////////////////////////////////////////////////////////////////////////////////////////////
template <typename PointInT, typename PointNT, typename PointOutT> void
pcl::FPFHEstimationOMP<PointInT, PointNT, PointOutT>::computeFeature (PointCloudOut &output)
Expand Down
14 changes: 14 additions & 0 deletions features/include/pcl/features/impl/normal_3d_omp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@

#include <pcl/features/normal_3d_omp.h>

///////////////////////////////////////////////////////////////////////////////////////////
template <typename PointInT, typename PointOutT> void
pcl::NormalEstimationOMP<PointInT, PointOutT>::setNumberOfThreads (unsigned int nr_threads)
{
if (nr_threads == 0)
#ifdef _OPENMP
threads_ = omp_get_num_procs();
#else
threads_ = 1;
#endif
else
threads_ = nr_threads;
}

///////////////////////////////////////////////////////////////////////////////////////////
template <typename PointInT, typename PointOutT> void
pcl::NormalEstimationOMP<PointInT, PointOutT>::computeFeature (PointCloudOut &output)
Expand Down
18 changes: 16 additions & 2 deletions features/include/pcl/features/impl/shot_lrf_omp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,22 @@
#include <pcl/features/shot_lrf_omp.h>
#include <pcl/features/shot_lrf.h>

template<typename PointInT, typename PointOutT>
void
//////////////////////////////////////////////////////////////////////////////////////////////
template<typename PointInT, typename PointOutT> void
pcl::SHOTLocalReferenceFrameEstimationOMP<PointInT, PointOutT>::setNumberOfThreads (unsigned int nr_threads)
{
if (nr_threads == 0)
#ifdef _OPENMP
threads_ = omp_get_num_procs();
#else
threads_ = 1;
#endif
else
threads_ = nr_threads;
}

//////////////////////////////////////////////////////////////////////////////////////////////
template<typename PointInT, typename PointOutT> void
pcl::SHOTLocalReferenceFrameEstimationOMP<PointInT, PointOutT>::computeFeature (PointCloudOut &output)
{
//check whether used with search radius or search k-neighbors
Expand Down
28 changes: 28 additions & 0 deletions features/include/pcl/features/impl/shot_omp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,20 @@ pcl::SHOTColorEstimationOMP<PointInT, PointNT, PointOutT, PointRFT>::initCompute
return (true);
}

//////////////////////////////////////////////////////////////////////////////////////////////
template<typename PointInT, typename PointNT, typename PointOutT, typename PointRFT> void
pcl::SHOTEstimationOMP<PointInT, PointNT, PointOutT, PointRFT>::setNumberOfThreads (unsigned int nr_threads)
{
if (nr_threads == 0)
#ifdef _OPENMP
threads_ = omp_get_num_procs();
#else
threads_ = 1;
#endif
else
threads_ = nr_threads;
}

//////////////////////////////////////////////////////////////////////////////////////////////
template<typename PointInT, typename PointNT, typename PointOutT, typename PointRFT> void
pcl::SHOTEstimationOMP<PointInT, PointNT, PointOutT, PointRFT>::computeFeature (PointCloudOut &output)
Expand Down Expand Up @@ -189,6 +203,20 @@ pcl::SHOTEstimationOMP<PointInT, PointNT, PointOutT, PointRFT>::computeFeature (
}
}

//////////////////////////////////////////////////////////////////////////////////////////////
template <typename PointInT, typename PointNT, typename PointOutT, typename PointRFT> void
pcl::SHOTColorEstimationOMP<PointInT, PointNT, PointOutT, PointRFT>::setNumberOfThreads (unsigned int nr_threads)
{
if (nr_threads == 0)
#ifdef _OPENMP
threads_ = omp_get_num_procs();
#else
threads_ = 1;
#endif
else
threads_ = nr_threads;
}

//////////////////////////////////////////////////////////////////////////////////////////////
template <typename PointInT, typename PointNT, typename PointOutT, typename PointRFT> void
pcl::SHOTColorEstimationOMP<PointInT, PointNT, PointOutT, PointRFT>::computeFeature (PointCloudOut &output)
Expand Down
10 changes: 6 additions & 4 deletions features/include/pcl/features/normal_3d_omp.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,18 @@ namespace pcl
/** \brief Initialize the scheduler and set the number of threads to use.
* \param nr_threads the number of hardware threads to use (0 sets the value back to automatic)
*/
NormalEstimationOMP (unsigned int nr_threads = 0) : threads_ (nr_threads)
NormalEstimationOMP (unsigned int nr_threads = 0)
{
feature_name_ = "NormalEstimationOMP";

setNumberOfThreads(nr_threads);
}

/** \brief Initialize the scheduler and set the number of threads to use.
* \param nr_threads the number of hardware threads to use (0 sets the value back to automatic)
*/
inline void
setNumberOfThreads (unsigned int nr_threads = 0) { threads_ = nr_threads; }
void
setNumberOfThreads (unsigned int nr_threads = 0);

protected:
/** \brief The number of threads the scheduler should use. */
Expand All @@ -94,7 +96,7 @@ namespace pcl
* setSearchSurface () and the spatial locator in setSearchMethod ()
* \param output the resultant point cloud model dataset that contains surface normals and curvatures
*/
void
void
computeFeature (PointCloudOut &output);
};
}
Expand Down
10 changes: 6 additions & 4 deletions features/include/pcl/features/shot_lrf_omp.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,21 @@ namespace pcl
typedef boost::shared_ptr<SHOTLocalReferenceFrameEstimationOMP<PointInT, PointOutT> > Ptr;
typedef boost::shared_ptr<const SHOTLocalReferenceFrameEstimationOMP<PointInT, PointOutT> > ConstPtr;
/** \brief Constructor */
SHOTLocalReferenceFrameEstimationOMP () : threads_ (0)
SHOTLocalReferenceFrameEstimationOMP ()
{
feature_name_ = "SHOTLocalReferenceFrameEstimationOMP";

setNumberOfThreads(0);
}

/** \brief Empty destructor */
virtual ~SHOTLocalReferenceFrameEstimationOMP () {}

/** \brief Initialize the scheduler and set the number of threads to use.
* \param nr_threads the number of hardware threads to use (0 sets the value back to automatic)
*/
inline void
setNumberOfThreads (unsigned int nr_threads = 0) { threads_ = nr_threads; }
void
setNumberOfThreads (unsigned int nr_threads = 0);

protected:
using Feature<PointInT, PointOutT>::feature_name_;
Expand Down
18 changes: 11 additions & 7 deletions features/include/pcl/features/shot_omp.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,16 @@ namespace pcl
typedef typename Feature<PointInT, PointOutT>::PointCloudIn PointCloudIn;

/** \brief Empty constructor. */
SHOTEstimationOMP (unsigned int nr_threads = 0) : SHOTEstimation<PointInT, PointNT, PointOutT, PointRFT> (), threads_ (nr_threads)
{ };
SHOTEstimationOMP (unsigned int nr_threads = 0) : SHOTEstimation<PointInT, PointNT, PointOutT, PointRFT> ()
{
setNumberOfThreads(nr_threads);
};

/** \brief Initialize the scheduler and set the number of threads to use.
* \param nr_threads the number of hardware threads to use (0 sets the value back to automatic)
*/
inline void
setNumberOfThreads (unsigned int nr_threads = 0) { threads_ = nr_threads; }
void
setNumberOfThreads (unsigned int nr_threads = 0);

protected:

Expand Down Expand Up @@ -178,15 +181,16 @@ namespace pcl
SHOTColorEstimationOMP (bool describe_shape = true,
bool describe_color = true,
unsigned int nr_threads = 0)
: SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT> (describe_shape, describe_color), threads_ (nr_threads)
: SHOTColorEstimation<PointInT, PointNT, PointOutT, PointRFT> (describe_shape, describe_color)
{
setNumberOfThreads(nr_threads);
}

/** \brief Initialize the scheduler and set the number of threads to use.
* \param nr_threads the number of hardware threads to use (0 sets the value back to automatic)
*/
inline void
setNumberOfThreads (unsigned int nr_threads = 0) { threads_ = nr_threads; }
void
setNumberOfThreads (unsigned int nr_threads = 0);

protected:

Expand Down
13 changes: 7 additions & 6 deletions filters/include/pcl/filters/fast_bilateral_omp.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,27 +68,28 @@ namespace pcl
typedef typename Filter<PointT>::PointCloud PointCloud;

public:

typedef boost::shared_ptr< FastBilateralFilterOMP<PointT> > Ptr;
typedef boost::shared_ptr< const FastBilateralFilterOMP<PointT> > ConstPtr;

/** \brief Empty constructor. */
FastBilateralFilterOMP (unsigned int nr_threads = 0)
: threads_ (nr_threads)
{ }
{
setNumberOfThreads(nr_threads);
}

/** \brief Initialize the scheduler and set the number of threads to use.
* \param nr_threads the number of hardware threads to use (0 sets the value back to automatic)
*/
inline void
setNumberOfThreads (unsigned int nr_threads = 0) { threads_ = nr_threads; }
void
setNumberOfThreads (unsigned int nr_threads = 0);

/** \brief Filter the input data and store the results into output.
* \param[out] output the resultant point cloud
*/
void
applyFilter (PointCloud &output);

protected:
/** \brief The number of threads the scheduler should use. */
unsigned int threads_;
Expand Down
14 changes: 14 additions & 0 deletions filters/include/pcl/filters/impl/fast_bilateral_omp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@
#include <pcl/console/time.h>
#include <assert.h>

//////////////////////////////////////////////////////////////////////////////////////////////
template <typename PointT> void
pcl::FastBilateralFilterOMP<PointT>::setNumberOfThreads (unsigned int nr_threads)
{
if (nr_threads == 0)
#ifdef _OPENMP
threads_ = omp_get_num_procs();
#else
threads_ = 1;
#endif
else
threads_ = nr_threads;
}

//////////////////////////////////////////////////////////////////////////////////////////////
template <typename PointT> void
pcl::FastBilateralFilterOMP<PointT>::applyFilter (PointCloud &output)
Expand Down
3 changes: 3 additions & 0 deletions outofcore/src/outofcore_base_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ namespace pcl
void
OutofcoreOctreeBaseMetadata::serializeMetadataToDisk ()
{
if (LOD_num_points_.empty ())
return;

// Create JSON object
boost::shared_ptr<cJSON> idx (cJSON_CreateObject (), cJSON_Delete);

Expand Down
13 changes: 5 additions & 8 deletions test/common/test_wrappers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,28 +89,25 @@ TEST (PointCloud, constructor_with_allocation)

TEST (PointCloud, constructor_with_allocation_valued)
{
PointXYZ nan_point (0.1f, 0.2f, 0.3f);
PointXYZ nan_point (0.1f, 0.2f, 0.3f);
PointCloud<PointXYZ> cloud2 (5, 80, nan_point);
EXPECT_EQ (cloud2.width, 5);
EXPECT_EQ (cloud2.height, 80);
EXPECT_EQ (cloud2.size (), 5*80);
for (PointCloud<PointXYZ>::const_iterator pit = cloud2.begin ();
pit != cloud2.end ();
++pit)
for (PointCloud<PointXYZ>::const_iterator pit = cloud2.begin (); pit != cloud2.end (); ++pit)
{
EXPECT_NEAR (pit->x, 0.1, 1e-3);
EXPECT_NEAR (pit->y, 0.2, 1e-3);
EXPECT_NEAR (pit->z, 0.3, 1e-3);
}

}

TEST (PointCloud, iterators)
{
EXPECT_EQ_VECTORS (cloud.begin ()->getVector3fMap (),
EXPECT_EQ_VECTORS (cloud.begin ()->getVector3fMap (),
cloud.points.begin ()->getVector3fMap ());
EXPECT_EQ_VECTORS (cloud.end ()->getVector3fMap (),
cloud.points.end ()->getVector3fMap ());
EXPECT_EQ_VECTORS ((--cloud.end ())->getVector3fMap (),
(--cloud.points.end ())->getVector3fMap ());
PointCloud<PointXYZ>::const_iterator pit = cloud.begin ();
PointCloud<PointXYZ>::VectorType::const_iterator pit2 = cloud.points.begin ();
for (; pit < cloud.end (); ++pit2, ++pit)
Expand Down
2 changes: 1 addition & 1 deletion test/recognition/test_recognition_cg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ TEST (PCL, Hough3DGrouping)
clusterer.setSceneRf (scene_rf);
clusterer.setModelSceneCorrespondences (model_scene_corrs_);
clusterer.setHoughBinSize (0.03);
clusterer.setHoughThreshold (13);
clusterer.setHoughThreshold (10);
EXPECT_TRUE (clusterer.recognize (rototranslations));

//Assertions
Expand Down
5 changes: 5 additions & 0 deletions test/sample_consensus/test_sample_consensus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ TEST (SampleConsensus, InfiniteLoop)
cloud.points[idx].z = 0.0;
}

#if defined(DEBUG) || defined(_DEBUG)
boost::posix_time::time_duration delay (0, 0, 15, 0);
#else
boost::posix_time::time_duration delay (0, 0, 1, 0);
#endif

boost::function<bool ()> sac_function;
SampleConsensusModelSpherePtr model (new SampleConsensusModelSphere<PointXYZ> (cloud.makeShared ()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@

#include <pcl/tracking/kld_adaptive_particle_filter_omp.h>

//////////////////////////////////////////////////////////////////////////////////////////////
template <typename PointInT, typename StateT> void
pcl::tracking::KLDAdaptiveParticleFilterOMPTracker<PointInT, StateT>::setNumberOfThreads (unsigned int nr_threads)
{
if (nr_threads == 0)
#ifdef _OPENMP
threads_ = omp_get_num_procs();
#else
threads_ = 1;
#endif
else
threads_ = nr_threads;
}

//////////////////////////////////////////////////////////////////////////////////////////////
template <typename PointInT, typename StateT> void
pcl::tracking::KLDAdaptiveParticleFilterOMPTracker<PointInT, StateT>::weight ()
{
Expand Down
Loading