Items with no label
3335 Discussions

Which Matlab functions should give the RGB image and the INFRA image from the Matlab wrapper?

VT000
Beginner
1,457 Views

I have one question about Matlab wrapper. The pointcloud_example should give the XYZ coordinates and the point cloud (still I don't get the point cloud and I can't access the pointcloud object, I haven't got an answer why) the depth_example should give the depth image.

 

But, which Matlab functions should give the RGB image and the INFRA image?

0 Kudos
11 Replies
MartyG
Honored Contributor III
711 Views

Another user succeeded in configuring left and right IR streams in the MATLAB wrapper with the scripting in the link below.

 

https://forums.intel.com/s/question/0D70P000006AycZSAS

 

Someone else may be able to help you with the equivalent code for RGB in the MATLAB wrapper

0 Kudos
VT000
Beginner
711 Views

Hello Marty,

I saw the link. That is OK, but I am using the saved bag files:

cfg = realsense.config();

cfg.enable_device_from_file('D:\Work\Measurements\+realsense\Day09.bag');

profile = pipe.start(cfg);

 

How should I do this from the bag file?

Thank you in advance.

Best regards,

0 Kudos
Alexandra_C_Intel
711 Views
Hi VT1000, Thank you for your interest in the Intel RealSense cameras. You can begin with depth_example.m. First enable the streams using the functions in config.m. con = realsense.config(); con.enable_all_streams(); .. then get the frames you want: color = fs.get_color_frame(); infra=fs.get_infrared_frame(); Regards, Alexandra
0 Kudos
VT000
Beginner
711 Views

Dear Alexandra,

Thank you for the answer and sorry for the late response, I had some jobs to finish.

This code i OK and I am think this is the solution for live streaming. But, I am using saved "bag" files. How can I do this from the "bag" file?

This is the part of my code, where I am using the "bag" file:

cfg = realsense.config();

cfg.enable_device_from_file('D:\Work\Measurements\+realsense\Day09.bag');

profile = pipe.start(cfg);

 

Thank you in advance.

Kind regards,

 

0 Kudos
Alexandra_C_Intel
711 Views

Hi VT1000,

 

The code below will show the color frame from a ROS Bag. You can get the infrared frame using get_infrared_frame .

 

function rosbag_example(filename)

% Make Config object to manage pipeline settings

cfg = realsense.config();

validateattributes(filename, {'char','string'}, {'scalartext', 'nonempty'}, '', 'filename', 1);

% Tell pipeline to stream from the given rosbag file

cfg.enable_device_from_file(filename);

% Make Pipeline object to manage streaming

pipe = realsense.pipeline();

% Start streaming from the rosbag with default settings

profile = pipe.start(cfg);

% Get streaming device's name

dev = profile.get_device();

name = dev.get_info(realsense.camera_info.name);

% Get frames. We discard the first couple to allow

% the camera time to settle

for i = 1:50

fs = pipe.wait_for_frames();

end

% Stop streaming

pipe.stop();

% Get the RGB Frame

color = fs.get_color_frame();

%color = fs.get_infrared_frame();

% Get actual data and convert into a format imshow can use

% (Color data arrives as [R, G, B, R, G, B, ...] vector)

data = color.get_data();

img = permute(reshape(data',[3,color.get_width(),color.get_height()]),[3 2 1]);

% Display image

imshow(img);

title(sprintf("Color frame from %s", name));

end

 

Regards,

Alexandra

0 Kudos
VT000
Beginner
711 Views

Hello Alexandra,

Another question about data extraction from the bag file?

How can I extract the depth stream in white-to-black or other visualizing scheme?

The depth_example.m function gives the colored depth image. Is this possible using the depth_example function? The color and other frame work well now.

Thank you in advance.

Kind regards

0 Kudos
VT000
Beginner
711 Views

Hello Alexandra,

Thank you, it works.

Also, how can I extract the RGB, Depth, PointCloud and infra images for each frame separately? I have extracted the point cloud using the pointcloud_example.m, but there is only one point cloud defined by "vertices" variable (not for the each frame)?

Thank you.

Kind regards,

 

0 Kudos
Alexandra_C_Intel
711 Views
Hi VT1000, You can place the frame access, e.g., get_color_frame, get_depth_frame, and other frame processing commands right after the command fs = pipe.wait_for_frames();. fs is the current frameset. You can place the command fs = pipe.wait_for_frames() in a while loop that is TRUE until a certain condition is met. Regards, Alexandra
0 Kudos
VT000
Beginner
711 Views

Dear Alexandra,

So, there is no option to extract it automatically without programing? OK, I will try it.

Also, I have a question about setting. I would like to use the RealSense D415 outdoors with high accuracy setting? Are there any documents about these settings or a preset JSON file? Where can I find the documents for stereo control, advanced control, depth visualisation and postprocessing settings? I need the explanation of all parameters in those setting in order to try to tune them. I can't find any documents about this. Or, If there is a document for tuning the setting for outdoor usage, I will be thankful if someone would provide me it.

Thank you in advance.

Kind regards

0 Kudos
Alexandra_C_Intel
711 Views
Hi VT1000, Please open a new thread since your questions are not related to the initial question. Regards, Alexandra
0 Kudos
VT000
Beginner
711 Views

Dear Alexandra,

Sorry, I have used the link to answer you automatically.

I will open a new thread.

Thank you, kind regards.

 

0 Kudos
Reply