so habe ich diesen Code, in dem ich die Punktwolke-Bibliothek zu verwenden, versuchen einige Deskriptoren übereinstimmen ich vorher mit anderen errechnen:C++ in Pointcloud Bibliothek: keine passende Funktion
pcl::KdTreeFLANN<pcl::Narf36> matching = new pcl::KdTreeFLANN<pcl::Narf36>(false);
pcl::KdTree<pcl::Narf36>::PointCloudConstPtr ptr_narf_descriptors(&narf_descriptors);
matching.setInputCloud(ptr_narf_descriptors,NULL);
std::vector<int> correspondence;
// Check every descriptor computed for the scene.
for (size_t i = 0; i < narf_descriptors2.size(); ++i)
{
std::vector<int> neighbors(1);
std::vector<float> squaredDistances(1);
// Ignore NaNs.
if (pcl_isfinite(narf_descriptors2.at(i).descriptor[0]))
{
// Find the nearest neighbor (in descriptor space)...
int neighborCount = matching.nearestKSearch(narf_descriptors2.at(i), 1, neighbors, squaredDistances);
// ...and add a new correspondence if the distance is less than a threshold
// (SHOT distances are between 0 and 1, other descriptors use different metrics).
if (neighborCount == 1 && squaredDistances[0] < 0.25f)
{
//correspondence.push_back(neighbors[0], static_cast<int>(i), squaredDistances[0]);
correspondence.push_back(neighbors[0]);
}
}
}
Aber compilator (machen) sagt:
/home/adrian/PointCloudComparator/src/comparator.cpp: In function ‘void processNARF(std::string, std::string)’:
/home/adrian/PointCloudComparator/src/comparator.cpp:270:50: error: no
matching function for call to ‘pcl::KdTreeFLANN<pcl::Narf36>::setInputCloud(pcl::KdTree<pcl::Narf36>::PointCloudConstPtr&, NULL)’
matching.setInputCloud(ptr_narf_descriptors,NULL);
^
/home/adrian/PointCloudComparator/src/comparator.cpp:270:50: note: candidate is:
In file included from /usr/include/pcl-1.7/pcl/search/kdtree.h:44:0,
from /usr/include/pcl-1.7/pcl/search/pcl_search.h:44,
from /usr/include/pcl-1.7/pcl/features/impl/feature.hpp:44,
from /usr/include/pcl-1.7/pcl/features/feature.h:498,
from /usr/include/pcl-1.7/pcl/features/range_image_border_extractor.h:42,
from /home/adrian/PointCloudComparator/src/comparator.cpp:9:
/usr/include/pcl-1.7/pcl/kdtree/kdtree_flann.h:146:7: note:
void pcl::KdTreeFLANN<PointT, Dist>::setInputCloud(const PointCloudConstPtr&, const IndicesConstPtr&) [with PointT = pcl::Narf36; Dist = flann::L2_Simple<float>; pcl::KdTreeFLANN<PointT,
Dist>::PointCloudConstPtr = boost::shared_ptr<const
pcl::PointCloud<pcl::Narf36> >; pcl::KdTreeFLANN<PointT,
Dist>::IndicesConstPtr = boost::shared_ptr<const std::vector<int> >]
setInputCloud (const PointCloudConstPtr &cloud, const
IndicesConstPtr &indices = IndicesConstPtr());
^
^
make[2]: *** [CMakeFiles/comparator.dir/src/comparator.cpp.o] Error 1
make[1]: *** [CMakeFiles/comparator.dir/all] Error 2
make: *** [all] Error 2
Welche ein bisschen komisch, da in der Klasse ist kdtree_Flann die Definition der Funktion ist:
/** \brief Provide a pointer to the input dataset.
* \param[in] cloud the const boost shared pointer to a PointCloud message
* \param[in] indices the point indices subset that is to be used from \a cloud - if NULL the whole cloud is used
*/
void
setInputCloud (const PointCloudConstPtr &cloud, const IndicesConstPtr &indices = IndicesConstPtr());
Ist es mir, dass ich den Code falsch schreibe? Oder weiß der Compilator nicht, woher die eigentliche Funktionsdefinition kommen soll?
Danke und Gruß!
Arbeits Code - für Version 1.7 von PCL Bibliothek:
pcl::KdTreeFLANN<pcl::Narf36> matching = new pcl::KdTreeFLANN<pcl::Narf36>(false);
pcl::KdTree<pcl::Narf36>::PointCloudConstPtr ptr_narf_descriptors(&narf_descriptors);
matching.setInputCloud(ptr_narf_descriptors);
std::vector<int> correspondence;
'std :: vector correspondence();' remove '()' - Compiler behandelt es als Funktionsdeklaration, nicht als Variable. –
danke, habe ich nicht bemerkt, die(), auch kann versuchen, ich denke den post jetzt aktualisieren –
aktualisiert und mit zweiten problem erklärung –