Items with no label
3338 Discussions

How to enable both Y16 (unrectified) streams from D435 in SDK2.0 Matlab wrapper?

VHess
Novice
3,814 Views

I tried the following commands, but both figures are just from the same (left) camera. I like to get y16 from both left and right:

 

% Make Pipeline object to manage streaming

pipe = realsense.pipeline();

 

%enable the IR streams

cfg = realsense.config();

cfg.enable_stream(realsense.stream.infrared, realsense.format.y16) %configure the an unrectified stream

%cfg.enable_stream(realsense.stream.infrared, realsense.format.y16) %configure the an unrectified stream

 

 

% Start streaming all streams

profile = pipe.start(cfg);

 

%in order to get this to work, frameset.m needs to be corrected. all

%instancces of int64_t needs to be changed to int64 in that file.

 

% 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:5

fs = pipe.wait_for_frames();

end

 

frameCount =0;

while frameCount < 50

  frameCount = frameCount+1;

  fs = pipe.wait_for_frames();

   

  ir1 = fs.get_infrared_frame(0);

  ir2 = fs.get_infrared_frame(1);

 

  irdata1 = ir1.get_data();

  irdata2 = ir2.get_data();

 

  img1 = reshape(irdata1, 1280, 800);

  img2 = reshape(irdata2, 1280, 800);

   

  figure(1)

  imshow(img1)

  figure(2)

  imshow(img2)

end

 

% Stop streaming

pipe.stop();

0 Kudos
1 Solution
MartyG
Honored Contributor III
2,316 Views

I'm not sure what the programming syntax would be if you wanted to write the instruction for use in the MATLAB wrapper. In general though, if you want to stream left and right then you should give the streams index numbers (e.g 1 for left and 2 for right). Here's a C++ example:

 

https://github.com/IntelRealSense/librealsense/issues/1140#issuecomment-364816438

View solution in original post

3 Replies
MartyG
Honored Contributor III
2,317 Views

I'm not sure what the programming syntax would be if you wanted to write the instruction for use in the MATLAB wrapper. In general though, if you want to stream left and right then you should give the streams index numbers (e.g 1 for left and 2 for right). Here's a C++ example:

 

https://github.com/IntelRealSense/librealsense/issues/1140#issuecomment-364816438

Eliza_D_Intel
Employee
2,316 Views
Hello VHess, Thank you for your interest in the Intel RealSense Products. Please check out this thread, as it contains a code that will provide you the data from both left and right imagers: https://forums.intel.com/s/question/0D50P0000490Z2fSAE/obtain-the-infrared-frame-in-matlab-for-d435 Thank you and best regards, Eliza
0 Kudos
VHess
Novice
2,316 Views

@MartyG​  Brilliant, thanks! The corresponding Matlab wrapper syntax for configuring two Y16 streams are:

cfg = realsense.config();

cfg.enable_stream(realsense.stream.infrared, 1, realsense.format.y16)

cfg.enable_stream(realsense.stream.infrared, 2, realsense.format.y16)

 

@ElizaD_Intel​  Thanks for your reply but the link appears to be broken. I also could not find that thread by searching for it. But MartyGs answer solved it for me!

0 Kudos
Reply