Code lines that need to be added to the depth_example.m file in order to access the 2 Infrared streams and set the exposure on Intel® RealSense™ Depth Camera D435
I am currently using the Intel® RealSense™ Depth Camera D435 with Matlab*. I am able to execute the depth_example.m source code obtaining the depth but I want to also show the Infrared streams and set the exposure. Can you guide me?
- Use RealSense SDK 2.0 version 2.16.5 (or newer).
- Modify the depth_example.m code in order to obtain the 2 Infrared Streams as follows:
The following lines in bold need to be added:
........
colorizer = realsense.colorizer();
cfg = realsense.config();
cfg.enable_all_streams();
profile = pipe.start(cfg);
dev = profile.get_device();
name = dev.get_info(realsense.camera_info.name);
sens = dev.first('depth_sensor');
sens.set_option(realsense.option.emitter_enabled, 0); %or 1
for i = 1:5
fs = pipe.wait_for_frames();
end
ir1 = fs.get_infrared_frame(1);
ir2 = fs.get_infrared_frame(2);
irdata1 = ir1.get_data();
irdata2 = ir2.get_data();
ir_img1 = reshape(irdata1, 1280, 720);
ir_img2 = reshape(irdata2, 1280, 720);
figure, imshow(ir_img1');
title(sprintf("IR1 frame from %s", name));
figure, imshow(ir_img2');
title(sprintf("IR2 frame from %s", name));
.......
If after the upgrade, there's an error regarding "int64_t" in the frameset class, then you must edit frameset.m and change all instances of int64_t to int64.