Items with no label
3338 讨论

How to convert cv::Mat to rs2::frame ?

yliu54
初学者
3,253 次查看

hello,

I have already seen this question in this community but didn't get the answer I want.

 

In rs_align, I have converted the rs2:: frame to cv:: Mat for using the joint bilateral filter provided by OpenCV to improve the quality of the depth map. The depth map of the processed mat type that is obtained cannot be used to call remove_background().

So,I just want to know how to convert cv:: Mat to rs2:: frame. If you can help me, I would be very grateful.

Thank you!

0 项奖励
5 回复数
MartyG
名誉分销商 III
2,139 次查看

Intel support team member Eliza has stated on a past reply to this question in September 2018, "The memory in rs2::frame may be reused by librealsense/UVC. Converting from cv::Mat to rs2::frame (copy pixel array to a object of rs2::frame) is not a good idea. Note that when the camera captures images, the uvcvideo driver writes the frame information into the rs2::frame".

0 项奖励
yliu54
初学者
2,139 次查看

Thank you for your reply!

But in order to use cv::ximgproc:: jointBilateralFilter,I have converted rs2::frame to cv:: mat.I just want to transform the destination filtered depth map(rs:: mat) to rs:: frame for using the remove_background().

0 项奖励
MartyG
名誉分销商 III
2,139 次查看

I do not know how to do such a conversion, unfortunately. Hopefully one of the Intel support team on this forum can provide some advice on this. Good luck!

0 项奖励
yliu54
初学者
2,139 次查看

Anyway, thank you for your attention!

0 项奖励
idata
员工
2,139 次查看

Hello Yu523,

 

 

I see your question has been answered here: https://github.com/IntelRealSense/librealsense/issues/2634.

 

 

Regards,

 

Jesus

 

Intel Customer Support
0 项奖励
回复