本文整理汇总了C++中depthimage::Ptr::getTimestamp方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::getTimestamp方法的具体用法?C++ Ptr::getTimestamp怎么用?C++ Ptr::getTimestamp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类depthimage::Ptr
的用法示例。
在下文中一共展示了Ptr::getTimestamp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
pcl::io::OpenNI2Grabber::depthCallback (DepthImage::Ptr depth_image, void*)
{
if (num_slots<sig_cb_openni_point_cloud_rgb> () > 0 ||
num_slots<sig_cb_openni_point_cloud_rgba> () > 0 ||
num_slots<sig_cb_openni_image_depth_image> () > 0)
rgb_sync_.add1 (depth_image, depth_image->getTimestamp ());
if (num_slots<sig_cb_openni_point_cloud_i> () > 0 ||
num_slots<sig_cb_openni_ir_depth_image> () > 0)
ir_sync_.add1 (depth_image, depth_image->getTimestamp ());
if (depth_image_signal_->num_slots () > 0)
depth_image_signal_->operator ()(depth_image);
if (point_cloud_signal_->num_slots () > 0)
point_cloud_signal_->operator ()(convertToXYZPointCloud (depth_image));
}
示例2: cloud
pcl::PointCloud<pcl::PointXYZI>::Ptr
pcl::io::OpenNI2Grabber::convertToXYZIPointCloud (const IRImage::Ptr &ir_image, const DepthImage::Ptr &depth_image)
{
boost::shared_ptr<pcl::PointCloud<pcl::PointXYZI> > cloud (new pcl::PointCloud<pcl::PointXYZI > ());
cloud->header.seq = depth_image->getFrameID ();
cloud->header.stamp = depth_image->getTimestamp ();
cloud->header.frame_id = rgb_frame_id_;
cloud->height = depth_height_;
cloud->width = depth_width_;
cloud->is_dense = false;
cloud->points.resize (cloud->height * cloud->width);
float fx = device_->getDepthFocalLength (); // Horizontal focal length
float fy = device_->getDepthFocalLength (); // Vertcal focal length
float cx = ((float)cloud->width - 1.f) / 2.f; // Center x
float cy = ((float)cloud->height - 1.f) / 2.f; // Center y
// Load pre-calibrated camera parameters if they exist
if (pcl_isfinite (depth_parameters_.focal_length_x))
fx = static_cast<float> (depth_parameters_.focal_length_x);
if (pcl_isfinite (depth_parameters_.focal_length_y))
fy = static_cast<float> (depth_parameters_.focal_length_y);
if (pcl_isfinite (depth_parameters_.principal_point_x))
cx = static_cast<float> (depth_parameters_.principal_point_x);
if (pcl_isfinite (depth_parameters_.principal_point_y))
cy = static_cast<float> (depth_parameters_.principal_point_y);
float fx_inv = 1.0f / fx;
float fy_inv = 1.0f / fy;
const uint16_t* depth_map = (const uint16_t*) depth_image->getData ();
if (depth_image->getWidth () != depth_width_ || depth_image->getHeight () != depth_height_)
{
// Resize the image if nessacery
depth_resize_buffer_.resize(depth_width_ * depth_height_);
depth_map = depth_resize_buffer_.data();
depth_image->fillDepthImageRaw (depth_width_, depth_height_, (unsigned short*) depth_map );
}
const uint16_t* ir_map = (const uint16_t*) ir_image->getData ();
if (ir_image->getWidth () != depth_width_ || ir_image->getHeight () != depth_height_)
{
// Resize the image if nessacery
ir_resize_buffer_.resize(depth_width_ * depth_height_);
ir_map = ir_resize_buffer_.data();
ir_image->fillRaw (depth_width_, depth_height_, (unsigned short*) ir_map);
}
int depth_idx = 0;
float bad_point = std::numeric_limits<float>::quiet_NaN ();
for (int v = 0; v < depth_height_; ++v)
{
for (int u = 0; u < depth_width_; ++u, ++depth_idx)
{
pcl::PointXYZI& pt = cloud->points[depth_idx];
/// @todo Different values for these cases
// Check for invalid measurements
if (depth_map[depth_idx] == 0 ||
depth_map[depth_idx] == depth_image->getNoSampleValue () ||
depth_map[depth_idx] == depth_image->getShadowValue ())
{
pt.x = pt.y = pt.z = bad_point;
}
else
{
pt.z = depth_map[depth_idx] * 0.001f; // millimeters to meters
pt.x = (static_cast<float> (u) - cx) * pt.z * fx_inv;
pt.y = (static_cast<float> (v) - cy) * pt.z * fy_inv;
}
pt.data_c[0] = pt.data_c[1] = pt.data_c[2] = pt.data_c[3] = 0;
pt.intensity = static_cast<float> (ir_map[depth_idx]);
}
}
cloud->sensor_origin_.setZero ();
cloud->sensor_orientation_.setIdentity ();
return (cloud);
}