sac_model_parallel_lines.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2009, Willow Garage, Inc.
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions are met:
00007  *
00008  *     * Redistributions of source code must retain the above copyright
00009  *       notice, this list of conditions and the following disclaimer.
00010  *     * Redistributions in binary form must reproduce the above copyright
00011  *       notice, this list of conditions and the following disclaimer in the
00012  *       documentation and/or other materials provided with the distribution.
00013  *     * Neither the name of Willow Garage, Inc. nor the names of its
00014  *       contributors may be used to endorse or promote products derived
00015  *       from this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00018  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00021  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00022  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00023  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00024  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00025  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00026  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00027  * POSSIBILITY OF SUCH DAMAGE.
00028  *
00029  * $Id$
00030  *
00031  */
00032 
00035 #ifndef _SAMPLE_CONSENSUS_SACMODELPARALLELLINES_H_
00036 #define _SAMPLE_CONSENSUS_SACMODELPARALLELLINES_H_
00037 
00038 #include <door_handle_detector/sample_consensus/sac_model.h>
00039 #include <door_handle_detector/sample_consensus/model_types.h>
00040 
00042 #define MAX_ITERATIONS_UNIQUE 10000
00043 
00044 namespace sample_consensus
00045 {
00048   class SACModelParallelLines : public SACModel
00049   {
00050     public:
00052 
00053       SACModelParallelLines (double min_line_sep_m, double max_line_sep_m)
00054       {
00055         min_line_sep_m_ = min_line_sep_m;
00056         max_line_sep_m_ = max_line_sep_m;
00057       }
00058 
00060 
00061       virtual ~SACModelParallelLines () { }
00062 
00063       virtual void getSamples (int &iterations, std::vector<int> &samples);
00064 
00066 
00070       bool testModelCoefficients (const std::vector<double> &model_coefficients) { return true; }
00071 
00072       virtual bool computeModelCoefficients (const std::vector<int> &samples);
00073 
00074       virtual void refitModel (const std::vector<int> &inliers, std::vector<double> &refit_coefficients);
00075       virtual void getDistancesToModel (const std::vector<double> &model_coefficients, std::vector<double> &distances);
00076       virtual void selectWithinDistance (const std::vector<double> &model_coefficients, double threshold, std::vector<int> &inliers);
00077 
00078       virtual void projectPoints (const std::vector<int> &inliers, const std::vector<double> &model_coefficients, sensor_msgs::PointCloud &projected_points);
00079 
00080       virtual void projectPointsInPlace (const std::vector<int> &inliers, const std::vector<double> &model_coefficients);
00081       virtual bool doSamplesVerifyModel (const std::set<int> &indices, double threshold);
00082 
00084 
00085       virtual int getModelType () { return (SACMODEL_PARALLEL_LINES); }
00086 
00087       void closestLine (const std::vector<int> &indices, const std::vector<double> &model_coefficients,
00088                         std::vector<int> *closest_line, std::vector<double> *closest_dist);
00089       void closestLine (const std::set<int> &indices, const std::vector<double> &model_coefficients,
00090                         std::vector<int> *closest_line, std::vector<double> *closest_dist);
00091       double pointToLineSquareDistance (const geometry_msgs::Point32 &line_point1, const geometry_msgs::Point32 &line_point2, const geometry_msgs::Point32 &point);
00092 
00093       double min_line_sep_m_;
00094       double max_line_sep_m_;
00095   };
00096 }
00097 
00098 #endif


door_handle_detector
Author(s): Radu Bogdan Rusu, Marius
autogenerated on Wed Dec 11 2013 14:17:01