int
main (int argc, char ** argv)
{
    if (argc < 2)
    {
        usage (argv);
        return 1;
    }

    std::string arg (argv[1]);

    if (arg == "--help" || arg == "-h")
    {
        usage (argv);
        return 1;
    }

    double threshold = 0.05;
    pcl::console::parse_argument (argc, argv, "-thresh", threshold);

    pcl::OpenNIGrabber grabber (arg);
    if (grabber.providesCallback<pcl::OpenNIGrabber::sig_cb_openni_point_cloud_rgba> ())
    {
        OpenNIPlanarSegmentation<pcl::PointXYZRGBA> v (arg, threshold);
        v.run ();
    }
    else
    {
        OpenNIPlanarSegmentation<pcl::PointXYZ> v (arg, threshold);
        v.run ();
    }

    return (0);
}
示例#2
0
int 
	main (int argc, char ** argv)
{
	if (argc < 2)
	{
		usage (argv);
		return 1;
	}

	std::string arg (argv[1]);

	if (arg == "--help" || arg == "-h")
	{
		usage (argv);
		return 1;
	}

	double threshold = 0.02;
	pcl::console::parse_argument (argc, argv, "-thresh", threshold);

	pcl::Grabber* grabberptr;

	if (arg.length() >= 4 && 0 == arg.compare(arg.length()-4, 4, ".oni")){
		grabberptr = new pcl::ONIGrabber(arg, true, true);
	} else {
		grabberptr = new pcl::OpenNIGrabber(arg);
	}

	pcl::Grabber& grabber = *grabberptr;

	if (grabber.providesCallback<pcl::OpenNIGrabber::sig_cb_openni_point_cloud_rgba> ())
	{
		OpenNIPlanarSegmentation<pcl::PointXYZRGBA> v (arg, threshold);
		delete grabberptr;
		v.run ();
	}
	else
	{
		OpenNIPlanarSegmentation<pcl::PointXYZ> v (arg, threshold);
		delete grabberptr;
		v.run ();
	}

	return (0);
}