本文整理汇总了C++中SimpleOpenNIViewer类的典型用法代码示例。如果您正苦于以下问题:C++ SimpleOpenNIViewer类的具体用法?C++ SimpleOpenNIViewer怎么用?C++ SimpleOpenNIViewer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SimpleOpenNIViewer类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int
main ()
{
SimpleOpenNIViewer v;
v.run ();
return 0;
}
示例2: main
int main(int argc, char* argv[])
{
std::cout << "Press 's' key to capture a pcd\n";
if( argc > 4 )
{
help(argv[0]);
return 0;
}
else
{
for(int i = 1; i < argc; i++ )
{
const char* s = argv[i];
if( strcmp( s, "-f" ) == 0 )
{
i++;
filename = argv[i];
}
else
{
help(argv[0]);
return fprintf( stderr, "Unknown option %s\n", s ), -1;
}
}
}
SimpleOpenNIViewer v;
v.run ();
return 0;
}
示例3: main
int
main (int argc, char** argv)
{
// Default values
int num_cameras(1);
/*
* Parse command line arguments
*/
if (pcl::console::find_argument (argc, argv, "-h") >= 0)
{
printUsage (argv[0]);
return 0;
}
// Number of cameras
if (pcl::console::find_argument(argc, argv, "-n") >= 0)
{
pcl::console::parse_argument(argc, argv, "-n", num_cameras);
}
SimpleOpenNIViewer v (num_cameras);
v.run ();
return 0;
}
示例4: main
int main (int argc, char* argv[])
{
assert(argc > 1);
id = (atoi(argv[1]));
SimpleOpenNIViewer v;
v.run ();
return 0;
}
示例5: main
int main ()
{
boost::thread workerThread(visualize);
SimpleOpenNIViewer v;
v.run ();
workerThread.join();
return 0;
}
示例6: main
int
main (int, char **)
{
SimpleOpenNIViewer v;
v.run ();
return (0);
}
示例7: main
int
main (int argc, char **argv)
{
SimpleOpenNIViewer v;
v.run ();
return (0);
}
示例8: main
/* ******************************************************************************************** */
int main (int argc, char* argv[]) {
assert(argc > 1);
id = (atoi(argv[1]));
pthread_mutex_init(&lock, NULL);
pthread_mutex_init(&lock2, NULL);
SimpleOpenNIViewer v;
v.run ();
return 0;
}
示例9: main
int main ()
{
InitSharedMemory();
SimpleOpenNIViewer v;
//pcl::gpu::printShortCudaDeviceInfo
v.run ();
return 0;
}
示例10: main
//.........这里部分代码省略.........
if (pcl::console::find_argument (argc, argv, "-?")>0)
{
print_usage ("");
return 1;
}
if (!validArguments)
{
print_usage ("Please specify compression mode..\n");
return -1;
}
octreeCoder = new OctreePointCloudCompression<PointXYZRGBA> (compressionProfile, showStatistics, pointResolution,
octreeResolution, doVoxelGridDownDownSampling, iFrameRate,
doColorEncoding, static_cast<unsigned char> (colorBitResolution));
if (!bServerFileMode)
{
if (bEnDecode)
{
// ENCODING
ofstream compressedPCFile;
compressedPCFile.open (fileName.c_str(), ios::out | ios::trunc | ios::binary);
if (!bShowInputCloud)
{
EventHelper v (compressedPCFile, octreeCoder, field_name, min_v, max_v);
v.run ();
}
else
{
SimpleOpenNIViewer v (compressedPCFile, octreeCoder);
v.run ();
}
} else
{
// DECODING
ifstream compressedPCFile;
compressedPCFile.open (fileName.c_str(), ios::in | ios::binary);
compressedPCFile.seekg (0);
compressedPCFile.unsetf (ios_base::skipws);
pcl::visualization::CloudViewer viewer ("PCL Compression Viewer");
while (!compressedPCFile.eof())
{
PointCloud<PointXYZRGBA>::Ptr cloudOut (new PointCloud<PointXYZRGBA> ());
octreeCoder->decodePointCloud ( compressedPCFile, cloudOut);
viewer.showCloud (cloudOut);
}
}
} else
{
// switch to ONLINE profiles
if (compressionProfile == pcl::io::LOW_RES_OFFLINE_COMPRESSION_WITH_COLOR)
compressionProfile = pcl::io::LOW_RES_ONLINE_COMPRESSION_WITH_COLOR;
else if (compressionProfile == pcl::io::LOW_RES_OFFLINE_COMPRESSION_WITHOUT_COLOR)
compressionProfile = pcl::io::LOW_RES_ONLINE_COMPRESSION_WITHOUT_COLOR;
else if (compressionProfile == pcl::io::MED_RES_OFFLINE_COMPRESSION_WITH_COLOR)
compressionProfile = pcl::io::MED_RES_ONLINE_COMPRESSION_WITH_COLOR;
else if (compressionProfile == pcl::io::MED_RES_OFFLINE_COMPRESSION_WITHOUT_COLOR)
compressionProfile = pcl::io::MED_RES_ONLINE_COMPRESSION_WITHOUT_COLOR;
else if (compressionProfile == pcl::io::HIGH_RES_OFFLINE_COMPRESSION_WITH_COLOR)
示例11: main
int
main (int argc, char ** argv)
{
std::string device_id ("");
pcl::OpenNIGrabber::Mode image_mode = pcl::OpenNIGrabber::OpenNI_Default_Mode;
if (argc >= 2)
{
device_id = argv[1];
if (device_id == "--help" || device_id == "-h")
{
usage (argv);
return (0);
}
else if (device_id == "-l")
{
if (argc >= 3)
{
pcl::OpenNIGrabber grabber (argv[2]);
boost::shared_ptr<openni_wrapper::OpenNIDevice> device = grabber.getDevice ();
std::vector<std::pair<int, XnMapOutputMode> > modes;
if (device->hasImageStream ())
{
cout << endl << "Supported image modes for device: " << device->getVendorName () << " , " << device->getProductName () << endl;
modes = grabber.getAvailableImageModes ();
for (std::vector<std::pair<int, XnMapOutputMode> >::const_iterator it = modes.begin (); it != modes.end (); ++it)
{
cout << it->first << " = " << it->second.nXRes << " x " << it->second.nYRes << " @ " << it->second.nFPS << endl;
}
}
}
else
{
openni_wrapper::OpenNIDriver& driver = openni_wrapper::OpenNIDriver::getInstance ();
if (driver.getNumberDevices () > 0)
{
for (unsigned deviceIdx = 0; deviceIdx < driver.getNumberDevices (); ++deviceIdx)
{
cout << "Device: " << deviceIdx + 1 << ", vendor: " << driver.getVendorName (deviceIdx) << ", product: " << driver.getProductName (deviceIdx)
<< ", connected: " << driver.getBus (deviceIdx) << " @ " << driver.getAddress (deviceIdx) << ", serial number: \'" << driver.getSerialNumber (deviceIdx) << "\'" << endl;
}
}
else
cout << "No devices connected." << endl;
cout <<"Virtual Devices available: ONI player" << endl;
}
return (0);
}
}
else
{
openni_wrapper::OpenNIDriver& driver = openni_wrapper::OpenNIDriver::getInstance ();
if (driver.getNumberDevices() > 0)
cout << "Device Id not set, using first device." << endl;
}
unsigned mode;
if (pcl::console::parse (argc, argv, "-imagemode", mode) != -1)
image_mode = static_cast<pcl::OpenNIGrabber::Mode> (mode);
pcl::OpenNIGrabber grabber (device_id, pcl::OpenNIGrabber::OpenNI_Default_Mode, image_mode);
SimpleOpenNIViewer v (grabber);
v.run ();
return (0);
}
示例12: main
int
main(int argc, char ** argv)
{
std::string device_id("");
pcl::OpenNIGrabber::Mode depth_mode = pcl::OpenNIGrabber::OpenNI_Default_Mode;
pcl::OpenNIGrabber::Mode image_mode = pcl::OpenNIGrabber::OpenNI_Default_Mode;
bool xyz = false;
if (argc >= 2)
{
device_id = argv[1];
if (device_id == "--help" || device_id == "-h")
{
usage(argv);
return 0;
}
else if (device_id == "-l")
{
if (argc >= 3)
{
pcl::OpenNIGrabber grabber(argv[2]);
boost::shared_ptr<openni_wrapper::OpenNIDevice> device = grabber.getDevice();
cout << "Supported depth modes for device: " << device->getVendorName() << " , " << device->getProductName() << endl;
std::vector<std::pair<int, XnMapOutputMode > > modes = grabber.getAvailableDepthModes();
for (std::vector<std::pair<int, XnMapOutputMode > >::const_iterator it = modes.begin(); it != modes.end(); ++it)
{
cout << it->first << " = " << it->second.nXRes << " x " << it->second.nYRes << " @ " << it->second.nFPS << endl;
}
if (device->hasImageStream ())
{
cout << endl << "Supported image modes for device: " << device->getVendorName() << " , " << device->getProductName() << endl;
modes = grabber.getAvailableImageModes();
for (std::vector<std::pair<int, XnMapOutputMode > >::const_iterator it = modes.begin(); it != modes.end(); ++it)
{
cout << it->first << " = " << it->second.nXRes << " x " << it->second.nYRes << " @ " << it->second.nFPS << endl;
}
}
}
else
{
openni_wrapper::OpenNIDriver& driver = openni_wrapper::OpenNIDriver::getInstance();
if (driver.getNumberDevices() > 0)
{
for (unsigned deviceIdx = 0; deviceIdx < driver.getNumberDevices(); ++deviceIdx)
{
cout << "Device: " << deviceIdx + 1 << ", vendor: " << driver.getVendorName(deviceIdx) << ", product: " << driver.getProductName(deviceIdx)
<< ", connected: " << (int) driver.getBus(deviceIdx) << " @ " << (int) driver.getAddress(deviceIdx) << ", serial number: \'" << driver.getSerialNumber(deviceIdx) << "\'" << endl;
}
}
else
cout << "No devices connected." << endl;
cout <<"Virtual Devices available: ONI player" << endl;
}
return 0;
}
}
else
{
openni_wrapper::OpenNIDriver& driver = openni_wrapper::OpenNIDriver::getInstance();
if (driver.getNumberDevices() > 0)
cout << "Device Id not set, using first device." << endl;
}
unsigned mode;
if (pcl::console::parse(argc, argv, "-depthmode", mode) != -1)
depth_mode = (pcl::OpenNIGrabber::Mode) mode;
if (pcl::console::parse(argc, argv, "-imagemode", mode) != -1)
image_mode = (pcl::OpenNIGrabber::Mode) mode;
if (pcl::console::find_argument(argc, argv, "-xyz") != -1)
xyz = true;
pcl::OpenNIGrabber grabber (device_id, depth_mode, image_mode);
if (xyz) // only if xyz flag is set, since grabber provides at least XYZ and XYZI pointclouds
{
SimpleOpenNIViewer<pcl::PointXYZ> v (grabber);
v.run ();
}
else if (grabber.providesCallback<pcl::OpenNIGrabber::sig_cb_openni_point_cloud_rgb> ())
{
SimpleOpenNIViewer<pcl::PointXYZRGBA> v (grabber);
v.run ();
}
else
{
SimpleOpenNIViewer<pcl::PointXYZI> v (grabber);
v.run ();
}
return (0);
}
示例13: main
//.........这里部分代码省略.........
pcl::console::parse_argument (argc, argv, "-f", fileName);
if (pcl::console::find_argument (argc, argv, "-?")>0)
{
print_usage ("");
return 1;
}
if (!validArguments)
{
print_usage ("Please specify compression mode..\n");
return -1;
}
organizedCoder = new OrganizedPointCloudCompression<PointXYZRGBA> ();
if (!bServerFileMode)
{
if (bEnDecode)
{
// ENCODING
ofstream compressedPCFile;
compressedPCFile.open (fileName.c_str(), ios::out | ios::trunc | ios::binary);
if (!bShowInputCloud)
{
EventHelper v (compressedPCFile, organizedCoder, doColorEncoding, showStatistics, bRawImageEncoding, bGrayScaleConversion);
v.run ();
}
else
{
SimpleOpenNIViewer v (compressedPCFile, organizedCoder, doColorEncoding, showStatistics, bRawImageEncoding, bGrayScaleConversion);
v.run ();
}
} else
{
// DECODING
ifstream compressedPCFile;
compressedPCFile.open (fileName.c_str(), ios::in | ios::binary);
compressedPCFile.seekg (0);
compressedPCFile.unsetf (ios_base::skipws);
pcl::visualization::CloudViewer viewer ("PCL Compression Viewer");
while (!compressedPCFile.eof())
{
PointCloud<PointXYZRGBA>::Ptr cloudOut (new PointCloud<PointXYZRGBA> ());
organizedCoder->decodePointCloud ( compressedPCFile, cloudOut );
viewer.showCloud (cloudOut);
}
}
} else
{
if (bEnDecode)
{
// ENCODING
try
{
boost::asio::io_service io_service;
tcp::endpoint endpoint (tcp::v4 (), 6666);
tcp::acceptor acceptor (io_service, endpoint);
tcp::iostream socketStream;