38 #ifndef PCL_CUDA_SAMPLE_CONSENSUS_MODEL_H_ 39 #define PCL_CUDA_SAMPLE_CONSENSUS_MODEL_H_ 42 #include <thrust/sequence.h> 43 #include <thrust/count.h> 44 #include <thrust/remove.h> 45 #include <pcl/cuda/point_cloud.h> 46 #include <thrust/random/linear_congruential_engine.h> 48 #include <pcl/pcl_exports.h> 60 template <
typename Tuple> __inline__ __host__ __device__
int 67 __inline__ __host__ __device__
bool 73 __inline__ __host__ __device__
bool 77 return (isnan (pt.
x) | isnan (pt.
y) | isnan (pt.
z)) == 1;
79 return (pcl_isnan (pt.
x) | pcl_isnan (pt.
y) | pcl_isnan (pt.
z)) == 1;
87 template <
template <
typename>
class Storage>
95 typedef boost::shared_ptr<SampleConsensusModel>
Ptr;
96 typedef boost::shared_ptr<const SampleConsensusModel>
ConstPtr;
98 typedef typename Storage<int>::type
Indices;
99 typedef boost::shared_ptr<typename Storage<int>::type>
IndicesPtr;
120 radius_min_ (-FLT_MAX), radius_max_ (FLT_MAX)
123 setInputCloud (cloud);
152 getSamples (
int &iterations, Indices &samples) = 0;
162 computeModelCoefficients (
const Indices &samples, Coefficients &model_coefficients) = 0;
165 generateModelHypotheses (Hypotheses &h,
int max_iterations) = 0;
168 generateModelHypotheses (Hypotheses &h, Samples &s,
int max_iterations) = 0;
172 {
return ((*inliers_stencil)[samples[i]] != -1);};
210 selectWithinDistance (
const Coefficients &model_coefficients,
212 IndicesPtr &inliers, IndicesPtr &inliers_stencil) = 0;
214 selectWithinDistance (
const Hypotheses &h,
int idx,
216 IndicesPtr &inliers, IndicesPtr &inliers_stencil) = 0;
218 selectWithinDistance (Hypotheses &h,
int idx,
220 IndicesPtr &inliers_stencil,
221 float3 ¢roid) = 0;
224 countWithinDistance (
const Coefficients &model_coefficients,
float threshold) = 0;
227 countWithinDistance (
const Hypotheses &h,
int idx,
float threshold) = 0;
230 deleteIndices (
const IndicesPtr &indices_stencil );
232 deleteIndices (
const Hypotheses &h,
int idx, IndicesPtr &inliers,
const IndicesPtr &inliers_delete);
265 setInputCloud (
const PointCloudConstPtr &cloud);
268 inline PointCloudConstPtr
290 if (nr_indices_in_stencil_ != indices_->size())
292 typename Indices::iterator last = thrust::remove_copy (indices_stencil_->begin (), indices_stencil_->end (), indices_->begin (), -1);
293 indices_->erase (last, indices_->end ());
316 radius_min_ = min_radius;
317 radius_max_ = max_radius;
329 min_radius = radius_min_;
330 max_radius = radius_max_;
335 inline boost::shared_ptr<typename Storage<float4>::type>
339 void setNormals (boost::shared_ptr<
typename Storage<float4>::type> normals) { normals_ = normals; }
351 boost::shared_ptr<typename Storage<float4>::type>
normals_;
423 #endif //#ifndef PCL_CUDA_SAMPLE_CONSENSUS_MODEL_H_ PointCloudConstPtr input_
A boost shared pointer to the point cloud data array.
SampleConsensusModel represents the base model class.
IndicesPtr getIndices() const
Get a pointer to the vector of indices used.
boost::shared_ptr< typename Storage< int >::type > IndicesPtr
virtual bool isSampleInlier(IndicesPtr &inliers_stencil, Samples &samples, unsigned int &i)
PointCloudAOS represents an AOS (Array of Structs) PointCloud implementation for CUDA processing...
void setRadiusLimits(float min_radius, float max_radius)
Set the minimum and maximum allowable radius limits for the model (applicable to models that estimate...
__inline__ __host__ __device__ bool operator()(int x)
Storage< int >::type Samples
Check if a certain tuple is a point inlier.
boost::shared_ptr< const typename Storage< int >::type > IndicesConstPtr
Storage< float >::type Coefficients
Storage< int >::type Indices
IndicesPtr indices_
A pointer to the vector of point indices to use.
Storage< float4 >::type Hypotheses
PointCloud::ConstPtr PointCloudConstPtr
boost::shared_ptr< SampleConsensusModel > Ptr
SampleConsensusModel(const PointCloudConstPtr &cloud)
Constructor for base SampleConsensusModel.
Check if a certain tuple is a point inlier.
boost::shared_ptr< typename Storage< float4 >::type > getNormals()
boost::shared_ptr< PointCloudAOS< Storage > > Ptr
boost::shared_ptr< Coefficients > CoefficientsPtr
boost::shared_ptr< const SampleConsensusModel > ConstPtr
__inline__ __host__ __device__ int operator()(const Tuple &t)
thrust::minstd_rand rngl_
Linear-Congruent random number generator engine.
float radius_min_
The minimum and maximum radius limits for the model.
boost::shared_ptr< const PointCloudAOS< Storage > > ConstPtr
PointCloudAOS< Storage > PointCloud
IndicesPtr indices_stencil_
A pointer to the vector of point indices (stencil) to use.
Default point xyz-rgb structure.
unsigned int nr_indices_in_stencil_
number of indices left in indices_stencil_
void setNormals(boost::shared_ptr< typename Storage< float4 >::type > normals)
boost::shared_ptr< typename Storage< float4 >::type > normals_
boost::shared_ptr< const Coefficients > CoefficientsConstPtr
PointCloudConstPtr getInputCloud() const
Get a pointer to the input point cloud dataset.
PointCloud::Ptr PointCloudPtr
virtual ~SampleConsensusModel()
Destructor for base SampleConsensusModel.
void getRadiusLimits(float &min_radius, float &max_radius)
Get the minimum and maximum allowable radius limits for the model as set by the user.