xudaoping 发表于 2014-5-30 08:50:11

高斯滤波程序出错,求助

网上找的一段高斯滤波程序,运行一直出错,下面是代码和错误信息
#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/common/gaussian.h>
#include <pcl/filters/filter.h>
#include <pcl/filters/convolution.h>
#include <pcl/filters/convolution_3d.h>
int
main (int argc, char** argv)
{
        //Create the input and filtered cloud objects
        pcl::PointCloud<pcl::PointXYZ>::Ptr inputcloud (new pcl::PointCloud<pcl::PointXYZ>);
        pcl::PointCloud<pcl::PointXYZ>::Ptr outputcloud (new pcl::PointCloud<pcl::PointXYZ>);

        //Read in the input file
        if (pcl::io::loadPCDFile("D:\\frame_saver_output\\front\\cloud_front_1_filtered.pcd", *inputcloud) == -1) //* load the file
    {
                PCL_ERROR ("Couldn't read file test_pcd.pcd \n"); // if couldnt open the file ?
                return (-1);
    }

        //Set up the Gaussian Kernel
        pcl::filters::GaussianKernel<pcl::PointXYZ,pcl::PointXYZ>:: Ptr kernel (new pcl::filters::GaussianKernel<pcl::PointXYZ, pcl::PointXYZ>);
        (*kernel).setSigma(4);
        (*kernel).setThresholdRelativeToSigma(4);
        std::cout << "Kernel made" << std::endl;

        //Set up the KDTree
        pcl::search::KdTree<pcl::PointXYZ>::Ptr kdtree (new pcl::search::KdTree<pcl::PointXYZ>);
        (*kdtree).setInputCloud(inputcloud);
        std::cout << "KdTree made" << std::endl;
       
        //Set up the Convolution Filter
        pcl::filters::Convolution3D <pcl::PointXYZ, pcl::PointXYZ, pcl::filters::GaussianKernel<pcl::PointXYZ,pcl::PointXYZ> > convolution;
        convolution.setKernel(*kernel);
        convolution.setInputCloud(inputcloud);
        convolution.setSearchMethod(kdtree);
        convolution.setRadiusSearch(0.05);
        std::cout << "Convolution Start" << std::endl;
        convolution.convolve(*outputcloud);
        std::cout << "Convoluted" << std::endl;

        //write to file
        pcl::io::savePCDFileASCII ("D:\\frame_saver_output\\front\\cloud_front_1_filtered_GaussianKernel_filters.pcd", *outputcloud);
        std::cout << "Written to File" << std::endl;
       
        system ("pause");
        return (0);
}



丫丫e 发表于 2016-1-11 09:34:54

楼主,高斯滤波你解决了没?

jiangshushu 发表于 2016-1-12 00:01:04

楼主,你好,你高斯滤波解决了没?是不是要修改头文件

qingyang 发表于 2016-4-26 10:18:59

丫丫e 发表于 2016-1-11 09:34 static/image/common/back.gif
楼主,高斯滤波你解决了没?

请问你解决了吗
页: [1]
查看完整版本: 高斯滤波程序出错,求助