#include <librealsense2/rs.hpp>
#include <iostream>
int main()
{
rs2::pointcloud pc;
rs2::points points;
rs2::pipeline pipe;
rs2::config cfg;
cfg.enable_device_from_file("kailelvbo.bag");
pipe.start(cfg);
auto frames = pipe.wait_for_frames();
auto depth = frames.get_depth_frame();
auto RGB = frames.get_color_frame();
}
代码核心就是 cfg.enable_device_from_file("kailelvbo.bag");就相当于将.bag当做视频流输入。