Point Cloud Library (PCL)  1.9.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
ransac.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2009, Willow Garage, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Willow Garage, Inc. nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *
34  * $Id$
35  *
36  */
37 
38 #ifndef PCL_CUDA_SAMPLE_CONSENSUS_RANSAC_H_
39 #define PCL_CUDA_SAMPLE_CONSENSUS_RANSAC_H_
40 
41 #include <pcl/cuda/sample_consensus/sac.h>
42 #include <pcl/cuda/sample_consensus/sac_model.h>
43 
44 namespace pcl
45 {
46  namespace cuda
47  {
48  /** \brief @b RandomSampleConsensus represents an implementation of the
49  * RANSAC (RAndom SAmple Consensus) algorithm, as described in: "Random
50  * Sample Consensus: A Paradigm for Model Fitting with Applications to Image
51  * Analysis and Automated Cartography", Martin A. Fischler and Robert C. Bolles,
52  * Comm. Of the ACM 24: 381–395, June 1981.
53  * \author Radu Bogdan Rusu
54  */
55  template <template <typename> class Storage>
56  class RandomSampleConsensus : public SampleConsensus<Storage>
57  {
67 
68  typedef typename SampleConsensusModel<Storage>::Ptr SampleConsensusModelPtr;
69  typedef typename SampleConsensusModel<Storage>::Coefficients Coefficients;
70  typedef typename SampleConsensusModel<Storage>::Indices Indices;
71  typedef typename SampleConsensusModel<Storage>::Hypotheses Hypotheses;
72 
73  public:
74  /** \brief RANSAC (RAndom SAmple Consensus) main constructor
75  * \param model a Sample Consensus model
76  */
77  RandomSampleConsensus (const SampleConsensusModelPtr &model) :
78  SampleConsensus<Storage> (model)
79  {
80  // Maximum number of trials before we give up.
81  max_iterations_ = 10000;
82  }
83 
84  /** \brief RANSAC (RAndom SAmple Consensus) main constructor
85  * \param model a Sample Consensus model
86  * \param threshold distance to model threshold
87  */
88  RandomSampleConsensus (const SampleConsensusModelPtr &model, float threshold) :
89  SampleConsensus<Storage> (model, threshold)
90  {
91  // Maximum number of trials before we give up.
92  max_iterations_ = 10000;
93  }
94 
95  /** \brief Compute the actual model and find the inliers
96  * \param debug_verbosity_level enable/disable on-screen debug
97  * information and set the verbosity level
98  */
99  bool
100  computeModel (int debug_verbosity_level = 0);
101  };
102  } // namespace
103 } // namespace
104 
105 #endif //#ifndef PCL_CUDA_SAMPLE_CONSENSUS_RANSAC_H_
106 
This file defines compatibility wrappers for low level I/O functions.
Definition: convolution.h:45
RandomSampleConsensus represents an implementation of the RANSAC (RAndom SAmple Consensus) algorithm...
Definition: ransac.h:56
RandomSampleConsensus(const SampleConsensusModelPtr &model, float threshold)
RANSAC (RAndom SAmple Consensus) main constructor.
Definition: ransac.h:88
Storage< float >::type Coefficients
Definition: sac_model.h:102
Storage< int >::type Indices
Definition: sac_model.h:98
RandomSampleConsensus(const SampleConsensusModelPtr &model)
RANSAC (RAndom SAmple Consensus) main constructor.
Definition: ransac.h:77
Storage< float4 >::type Hypotheses
Definition: sac_model.h:106
boost::shared_ptr< SampleConsensusModel > Ptr
Definition: sac_model.h:95
int max_iterations_
Maximum number of iterations before giving up.
Definition: sac.h:196
bool computeModel(int debug_verbosity_level=0)
Compute the actual model and find the inliers.