Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 #include <pcl/correspondence.h>
00040 #include <algorithm>
00041 #include <iterator>
00042 
00044 void
00045 pcl::getRejectedQueryIndices (const pcl::Correspondences &correspondences_before,
00046                               const pcl::Correspondences &correspondences_after,
00047                               std::vector<int>& indices,
00048                               bool presorting_required)
00049 {
00050   indices.clear();
00051 
00052   const int nr_correspondences_before = static_cast<int> (correspondences_before.size ());
00053   const int nr_correspondences_after = static_cast<int> (correspondences_after.size ());
00054 
00055   if (nr_correspondences_before == 0)
00056     return;
00057   else if (nr_correspondences_after == 0)
00058   {
00059     indices.resize(nr_correspondences_before);
00060     for (int i = 0; i < nr_correspondences_before; ++i)
00061       indices[i] = correspondences_before[i].index_query;
00062     return;
00063   }
00064 
00065   std::vector<int> indices_before (nr_correspondences_before);
00066   for (int i = 0; i < nr_correspondences_before; ++i)
00067     indices_before[i] = correspondences_before[i].index_query;
00068 
00069   std::vector<int> indices_after (nr_correspondences_after);
00070   for (int i = 0; i < nr_correspondences_after; ++i)
00071     indices_after[i] = correspondences_after[i].index_query;
00072 
00073   if (presorting_required)
00074   {
00075     std::sort (indices_before.begin (), indices_before.end ());
00076     std::sort (indices_after.begin (), indices_after.end ());
00077   }
00078 
00079   set_difference (
00080       indices_before.begin (), indices_before.end (),
00081       indices_after.begin (),  indices_after.end (),
00082       inserter (indices, indices.begin ()));
00083 }
00084 
00085 namespace pcl
00086 {
00087   std::ostream&
00088   operator << (std::ostream& os, const Correspondence& c)
00089   {
00090     os << c.index_query << " " << c.index_match << " " << c.distance;
00091     return (os);
00092   }
00093 }
00094