Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pointcloud.width = width;
- pointcloud.height = height;
- pointcloud.points.resize (pointcloud.height * pointcloud.width);
- int* depth_data = new int[pointcloud.height * pointcloud.width];
- //copy the depth values of every pixel in here
- register float constant = 1.0f / 525;
- register int centerX = (pointcloud.width >> 1);
- int centerY = (pointcloud.height >> 1);
- register int depth_idx = 0;
- for (int v = -centerY; v < centerY; ++v)
- {
- for (register int u = -centerX; u < centerX; ++u, ++depth_idx)
- {
- pcl::PointXYZ& pt = pointcloud.points[depth_idx];
- pt.z = depth_data[depth_idx] * 0.001f;
- pt.x = static_cast<float> (u) * pt.z * constant;
- pt.y = static_cast<float> (v) * pt.z * constant;
- }
- }
- pointcloud.sensor_origin_.setZero ();
- pointcloud.sensor_orientation_.w () = 0.0f;
- pointcloud.sensor_orientation_.x () = 1.0f;
- pointcloud.sensor_orientation_.y () = 0.0f;
- pointcloud.sensor_orientation_.z () = 0.0f;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement