Point Cloud Library (PCL)
1.7.0
|
00001 /* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Point Cloud Library (PCL) - www.pointclouds.org 00005 * Copyright (c) 2012, Willow Garage, Inc. 00006 * Copyright (c) 2012-, Open Perception, Inc. 00007 * 00008 * All rights reserved. 00009 * 00010 * Redistribution and use in source and binary forms, with or without 00011 * modification, are permitted provided that the following conditions 00012 * are met: 00013 * 00014 * * Redistributions of source code must retain the above copyright 00015 * notice, this list of conditions and the following disclaimer. 00016 * * Redistributions in binary form must reproduce the above 00017 * copyright notice, this list of conditions and the following 00018 * disclaimer in the documentation and/or other materials provided 00019 * with the distribution. 00020 * * Neither the name of the copyright holder(s) nor the names of its 00021 * contributors may be used to endorse or promote products derived 00022 * from this software without specific prior written permission. 00023 * 00024 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00025 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00026 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00027 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00028 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00029 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00030 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00031 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00032 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00033 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00034 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00035 * POSSIBILITY OF SUCH DAMAGE. 00036 * 00037 * $Id$ 00038 */ 00039 00040 #ifndef PCL_FEATURES_IMPL_SHOT_LRF_OMP_H_ 00041 #define PCL_FEATURES_IMPL_SHOT_LRF_OMP_H_ 00042 00043 #include <utility> 00044 #include <pcl/features/shot_lrf_omp.h> 00045 #include <pcl/features/shot_lrf.h> 00046 00047 template<typename PointInT, typename PointOutT> 00048 void 00049 pcl::SHOTLocalReferenceFrameEstimationOMP<PointInT, PointOutT>::computeFeature (PointCloudOut &output) 00050 { 00051 //check whether used with search radius or search k-neighbors 00052 if (this->getKSearch () != 0) 00053 { 00054 PCL_ERROR( 00055 "[pcl::%s::computeFeature] Error! Search method set to k-neighborhood. Call setKSearch(0) and setRadiusSearch( radius ) to use this class.\n", 00056 getClassName().c_str ()); 00057 return; 00058 } 00059 tree_->setSortedResults (true); 00060 00061 int data_size = static_cast<int> (indices_->size ()); 00062 #ifdef _OPENMP 00063 #pragma omp parallel for num_threads(threads_) 00064 #endif 00065 for (int i = 0; i < data_size; ++i) 00066 { 00067 // point result 00068 Eigen::Matrix3f rf; 00069 PointOutT& output_rf = output[i]; 00070 00071 //output_rf.confidence = getLocalRF ((*indices_)[i], rf); 00072 //if (output_rf.confidence == std::numeric_limits<float>::max ()) 00073 00074 std::vector<int> n_indices; 00075 std::vector<float> n_sqr_distances; 00076 this->searchForNeighbors ((*indices_)[i], search_parameter_, n_indices, n_sqr_distances); 00077 if (getLocalRF ((*indices_)[i], rf) == std::numeric_limits<float>::max ()) 00078 { 00079 output.is_dense = false; 00080 } 00081 00082 for (int d = 0; d < 3; ++d) 00083 { 00084 output_rf.x_axis[d] = rf.row (0)[d]; 00085 output_rf.y_axis[d] = rf.row (1)[d]; 00086 output_rf.z_axis[d] = rf.row (2)[d]; 00087 } 00088 } 00089 00090 } 00091 00092 #define PCL_INSTANTIATE_SHOTLocalReferenceFrameEstimationOMP(T,OutT) template class PCL_EXPORTS pcl::SHOTLocalReferenceFrameEstimationOMP<T,OutT>; 00093 00094 #endif // PCL_FEATURES_IMPL_SHOT_LRF_H_