- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to convert cv::Mat to rs2::frame ?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello yaowei,
Thank you for your interest in the Intel RealSense Technology.
Could you please provide us more details about your project and what you are trying to accomplish? Also, what is the RealSense camera/module that you are using?
Looking forward to your reply!
Best regards,
Eliza
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your reply!
I'm using d435 camera in the project.I want to denoise the pointcloud of it,and try to use the post-processing example of realsense sdk filter the depth image which type is cv::Mat .Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello yaowei,
Thank you for the clarifications!
Could you please let us know how did you get the pointcloud converted as cv::Mat? The format should be rs2:frame so you shouldn't have this issue working with the post-processing program.
Looking forward to your reply!
Best regards,
Eliza
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your replay!
The pointcloud is converted from depth image which get with the ros wrapper which in https://github.com/intel-ros/realsense https://github.com/intel-ros/realsense
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In other words, how to use post-processing program in ros?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello yaowei,
Unfortunately, the post-processing wrapper for ROS has not yet been implemented.
I found a code online that might help you out: https://github.com/johannesburg/uw-realsense
Here, 3 out of the 4 filters used on the post-processing application are integrated (temporal, spatial, and hole filling filter). You can use it as a starting point for your project.
I hope that this information helps you!
Thank you and best regards,
Eliza
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There are exampe for the conversion from rs2::frame to cv::Mat, so i think it's possible to convert cv::Mat to rs2::frame
rs2::frameset data = pipe.wait_for_frames();
rs2::frame depth = color_map(data.get_depth_frame());
const int w = depth.as().get_width();
const int h = depth.as().get_height();
cv::Mat image(Size(w, h), CV_8UC3, (void*)depth.get_data(), cv::Mat::AUTO_STEP);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello yaowei,
Thank you for your patience.
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.
Thank you,
Eliza
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page