|
Point Cloud Library (PCL)
1.5.1
|
00001 /* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Point Cloud Library (PCL) - www.pointclouds.org 00005 * Copyright (c) 2010-2011, Willow Garage, Inc. 00006 * 00007 * All rights reserved. 00008 * 00009 * Redistribution and use in source and binary forms, with or without 00010 * modification, are permitted provided that the following conditions 00011 * are met: 00012 * 00013 * * Redistributions of source code must retain the above copyright 00014 * notice, this list of conditions and the following disclaimer. 00015 * * Redistributions in binary form must reproduce the above 00016 * copyright notice, this list of conditions and the following 00017 * disclaimer in the documentation and/or other materials provided 00018 * with the distribution. 00019 * * Neither the name of Willow Garage, Inc. nor the names of its 00020 * contributors may be used to endorse or promote products derived 00021 * from this software without specific prior written permission. 00022 * 00023 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00024 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00025 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00026 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00027 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00028 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00029 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00030 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00031 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00032 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00033 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00034 * POSSIBILITY OF SUCH DAMAGE. 00035 * 00036 * $Id: correspondence.h 4702 2012-02-23 09:39:33Z gedikli $ 00037 */ 00038 #ifndef PCL_COMMON_CORRESPONDENCE_H_ 00039 #define PCL_COMMON_CORRESPONDENCE_H_ 00040 00041 #include <Eigen/Core> 00042 #include <boost/shared_ptr.hpp> 00043 #include <Eigen/Geometry> 00044 #include <vector> 00045 00046 namespace pcl 00047 { 00054 struct Correspondence 00055 { 00057 int index_query; 00059 int index_match; 00061 union 00062 { 00063 float distance; 00064 float weight; 00065 }; 00066 00070 inline Correspondence () : index_query (0), index_match (-1), 00071 distance (std::numeric_limits<float>::max ()) 00072 {} 00073 00075 inline Correspondence (int _index_query, int _index_match, float _distance) : 00076 index_query (_index_query), index_match (_index_match), distance (_distance) 00077 {} 00078 00080 virtual ~Correspondence () {} 00081 00082 EIGEN_MAKE_ALIGNED_OPERATOR_NEW 00083 }; 00084 00086 inline std::ostream& 00087 operator << (std::ostream& os, const Correspondence& c) 00088 { 00089 os << c.index_query << " " << c.index_match << " " << c.distance; 00090 return (os); 00091 } 00092 00093 typedef std::vector< pcl::Correspondence, Eigen::aligned_allocator<pcl::Correspondence> > Correspondences; 00094 typedef boost::shared_ptr<Correspondences> CorrespondencesPtr; 00095 typedef boost::shared_ptr<const Correspondences > CorrespondencesConstPtr; 00096 00110 void 00111 getRejectedQueryIndices (const pcl::Correspondences &correspondences_before, 00112 const pcl::Correspondences &correspondences_after, 00113 std::vector<int>& indices, 00114 bool presorting_required = true); 00115 00121 struct PointCorrespondence3D : public Correspondence 00122 { 00123 Eigen::Vector3f point1; 00124 Eigen::Vector3f point2; 00125 00127 virtual ~PointCorrespondence3D () {} 00128 00129 EIGEN_MAKE_ALIGNED_OPERATOR_NEW 00130 }; 00131 typedef std::vector<PointCorrespondence3D, Eigen::aligned_allocator<PointCorrespondence3D> > PointCorrespondences3DVector; 00132 00138 struct PointCorrespondence6D : public PointCorrespondence3D 00139 { 00140 Eigen::Affine3f transformation; 00141 00142 00143 virtual ~PointCorrespondence6D () {} 00144 00145 EIGEN_MAKE_ALIGNED_OPERATOR_NEW 00146 }; 00147 typedef std::vector<PointCorrespondence6D, Eigen::aligned_allocator<PointCorrespondence6D> > PointCorrespondences6DVector; 00148 00154 inline bool 00155 isBetterCorrespondence (const Correspondence &pc1, const Correspondence &pc2) 00156 { 00157 return (pc1.distance > pc2.distance); 00158 } 00159 } 00160 00161 #endif /* PCL_COMMON_CORRESPONDENCE_H_ */
1.8.0