我正在尝试以此计算输入云的筛选关键点
码:

#include <iostream>
#include <boost/thread/thread.hpp>
#include <pcl/range_image/range_image.h>
#include <pcl/io/ply_io.h>
#include <pcl/visualization/range_image_visualizer.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <pcl/features/range_image_border_extractor.h>
#include <pcl/keypoints/narf_keypoint.h>
#include <pcl/features/narf_descriptor.h>
#include <pcl/console/parse.h>
#include <pcl/point_types.h>
#include <pcl/features/pfh.h>
#include <pcl/kdtree/kdtree.h>
#include <pcl/surface/gp3.h>
#include <pcl/features/spin_image.h>
#include <cmath>
#include <pcl/registration/icp.h>
#include <pcl/keypoints/sift_keypoint.h>
void processSift (std::string filename, std::string filename2){
    // ------------------------------------------------------------------
    // -----Read ply file-----
    // ------------------------------------------------------------------
    pcl::PointCloud<PointType>::Ptr cloud_xyz_ptr(
                    new pcl::PointCloud<PointType>);
    pcl::PointCloud<PointType>& cloud_xyz = *cloud_xyz_ptr;
    if (pcl::io::loadPLYFile(filename, cloud_xyz) == -1) {
            cerr << "Was not able to open file \"" << filename << "\".\n";
            printUsage("");
    }

    // Parameters for sift computation
    const float min_scale = 0.01f;
    const int n_octaves = 3;
    const int n_scales_per_octave = 4;
    const float min_contrast = 0.001f;
pcl::SIFTKeypoint<PointType, pcl::PointWithScale> sift;
pcl::search::KdTree<PointType> tree= new pcl::search::KdTree<PointType> ();//new API
pcl::PointCloud<pcl::PointWithScale>::Ptr sifts (new
pcl::PointCloud<pcl::PointWithScale>);
pcl::KdTree<PointType>::PointCloudConstPtr ptr_sift_cloud(&cloud_xyz);
sift.setInputCloud(ptr_sift_cloud);
//sift.setSearchMethod (tree);
sift.setScales(min_scale, n_octaves, n_scales_per_octave);
sift.setMinimumContrast(min_contrast);
sift.compute (*sifts);

cout << "Computed " << (*sifts).size () << " SIFT Keypoints";


现在,问题出在筛选关键点类的内部,因为看起来PointXYZ没有名为“ intensity”的参数。

In file included from
/home/adrian/PointCloudComparator/src/comparator.cpp:21:0:
/usr/include/pcl-1.7/pcl/keypoints/sift_keypoint.h: In instantiation of
‘float pcl::SIFTKeypointFieldSelector<PointT>::operator()(const PointT&)
const [with PointT = pcl::PointXYZ]’:
/usr/include/pcl-1.7/pcl/keypoints/impl/sift_keypoint.hpp:236:82: required
from ‘void pcl::SIFTKeypoint<PointInT, PointOutT>::computeScaleSpace(const
PointCloudIn&, pcl::SIFTKeypoint<PointInT, PointOutT>::KdTree&, const
std::vector<float>&, Eigen::MatrixXf&) [with PointInT = pcl::PointXYZ;
PointOutT = pcl::PointWithScale; pcl::SIFTKeypoint<PointInT,
PointOutT>::PointCloudIn = pcl::PointCloud<pcl::PointXYZ>;
pcl::SIFTKeypoint<PointInT, PointOutT>::KdTree =
pcl::search::Search<pcl::PointXYZ>; Eigen::MatrixXf = Eigen::Matrix<float,
-1, -1>]’
/usr/include/pcl-1.7/pcl/keypoints/impl/sift_keypoint.hpp:163:56:   required
from ‘void pcl::SIFTKeypoint<PointInT,
PointOutT>::detectKeypointsForOctave(const PointCloudIn&,
pcl::SIFTKeypoint<PointInT, PointOutT>::KdTree&, float, int,
pcl::SIFTKeypoint<PointInT, PointOutT>::PointCloudOut&) [with PointInT =
pcl::PointXYZ; PointOutT = pcl::PointWithScale;    pcl::SIFTKeypoint<PointInT,
PointOutT>::PointCloudIn = pcl::PointCloud<pcl::PointXYZ>;
pcl::SIFTKeypoint<PointInT, PointOutT>::KdTree =
pcl::search::Search<pcl::PointXYZ>; pcl::SIFTKeypoint<PointInT,
PointOutT>::PointCloudOut = pcl::PointCloud<pcl::PointWithScale>]’
/usr/include/pcl-1.7/pcl/keypoints/impl/sift_keypoint.hpp:139:83:   required
from ‘void pcl::SIFTKeypoint<PointInT,
PointOutT>::detectKeypoints(pcl::SIFTKeypoint<PointInT,
PointOutT>::PointCloudOut&) [with PointInT = pcl::PointXYZ; PointOutT =
pcl::PointWithScale; pcl::SIFTKeypoint<PointInT, PointOutT>::PointCloudOut =
pcl::PointCloud<pcl::PointWithScale>]’
/home/adrian/PointCloudComparator/src/comparator.cpp:340:1:   required from here
/usr/include/pcl-1.7/pcl/keypoints/sift_keypoint.h:49:16: error: ‘const
struct pcl::PointXYZ’ has no member named ‘intensity’
   return p.intensity;


如果我想为PointXYZ值设置筛选关键点,应该使用什么?

问候

最佳答案

所以实际上问题是我正在使用pcl :: PointXYZ,并且存在类型pcl :: PointXYZRGB。该属性具有(颜色的)属性强度,现在只需将每个“ PointType”更改为“ PointXYZRGB”即可使用

干杯

09-07 08:18