1
votes

Intel gives example to align RGB camera and Depth(IR) camera, but i need adapt to opencv. the example show only "align in render", so i can't use them because i will use below function.

Mat color(Size(640, 480), CV_8UC3, (void*)color_frame.get_data(), Mat::AUTO_STEP);

i need align frame like below sentences form.

rs2::frameset frames = pipe.wait_for_frames();
rs2::frame color_frame = frames.get_color_frame();
rs2::frame depth_frame = color_map(frames.get_depth_frame());

So, is it possible that i can use align function like below ex) sentence?

ex) rs2:: frameset align_frame = ...... allocate_composite_frame......

OR, is there any function like "depth_aligned_to_color" in D435 like SR300?

1

1 Answers

0
votes

The frameset will be returned after align function is called, you can retrieve back the aligned color/depth image to set into CV function without problem. Please download the latest version LibRS and check the rs-align.cpp, attach code snippet below.

//Get processed aligned frame
auto processed = align.process(frameset);

// Trying to get both other and aligned depth frames
rs2::video_frame other_frame = processed.first(align_to);
rs2::depth_frame aligned_depth_frame = processed.get_depth_frame();