Extracting 3D points from the pointer returned by rs2::depth_frame::get_data
Dear Intel RealSense Community,
The following code snippet is from the RealSense API example "rs-pointcloud.cpp":
// Wait for the next set of frames from the camera
auto frames = pipe.wait_for_frames();
auto depth = frames.get_depth_frame();
// Generate the pointcloud and texture mappings
points = pc.calculate(depth);
As one can see, the 3D points are extracted from the depth frame by passing it to rs2:pointcloud::calculate. I wonder if it is instead possible to extract the 3D points by using the pointer returned by rs2::depth_frame::get_data. The code I'm looking for could look like that:
// Wait for the next set of frames from the camera
auto frames = pipe.wait_for_frames();
auto depth = frames.get_depth_frame();
// Generate the pointcloud and texture mappings
const void* pData = depth.get_data();
int nSize = depth.get_data_size();
points = pc.calculate(pData, nSize);
Best regards,
Sylvain
-
Hi S Roy I carefully researched for C++ examples that use get_data for point cloud generation but most references are in the Python language. The only script reference I could locate in C++ that resembled your needs is the somewhat complex one in the link below.
Please sign in to leave a comment.
Comments
2 comments