Items with no label
3335 Discussions

How to control the infrared laser using matlab wrapper

THelb
Beginner
1,155 Views

Hello,

I have been trying this for a long time now, sadly i still did not get to a solution. I am using D435 with matlab wrapper and i need to control the laser power (turn it off or make it less bright). Since working with the mex file is quite confusing for me, i have not yet figured out the correct syntax to do so. I would therefore appreciate some help a lot.

Thank you very much in advance!

0 Kudos
6 Replies
Alexandra_C_Intel
568 Views

Hi THelb,

 

Thank you for your interest in the Intel RealSense D435 camera.

You can use this function to enable/disable the emitter:

depth_sensor.set_option(sens.option.emitter_enabled, 0); disable emitter

depth_sensor.set_option(sens.option.emitter_enabled, 1); - enable emitter

 

Regards,

Alexandra

0 Kudos
THelb
Beginner
568 Views

Hi Alexandra,

 

Thank you for your reply. Unfortunately it does not work for me yet. Calling the function

depth_sensor.set_option(sens.option.emitter_enabled, 0);

i get the following error message: Undefined variable "sens" or class "sens.option.emitter_enabled".

 

I then tried replacing the part "sens.option.emitter_enabled" with 18 (according to option.m this is the equivalent):

depth_sensor.set_option(18, 0);

Which then led to this error: Undefined variable "depth_sensor" or class "depth_sensor.set_option".

 

I guess i first have to define or call depth_sensor in any way, but i don't know how.

 

One short further question: how could i set the laser power of the emitter? according to the data sheet, it should be possible to set it to 0, 30, 60, 90, ...., 360)

 

Thank you very much

 

0 Kudos
Alexandra_C_Intel
568 Views
Hi THelb, This issue has been discussed in the thread below. You may find it helpful. https://forums.intel.com/s/question/0D50P0000490Z2fSAE/obtain-the-infrared-frame-in-matlab-for-d435 Regards, Alexandra
0 Kudos
THelb
Beginner
568 Views

Hi Alexandra,

 

Thank you for that link. Unfortunately it seems to be broken. "The page requested has moved or no longer exists."

But obtaining the IR frame is not an issue for me, that works perfectly fine so far.

 

This is what i have coded for that so far:

 

pipe = realsense.pipeline();

cfg = realsense.config();

cfg.enable_stream(realsense.stream.infrared, 1, 1280, 720, realsense.format.y8);

pipeprofile = pipe.start(cfg);

fs = pipe.wait_for_frames();

ir_frame = fs.first(3);

data = ir_frame.get_data();

imshow(permute(reshape(data, 1280, 720), [2 1]))

pipe.stop();

 

Thank you very much

0 Kudos
Alexandra_C_Intel
568 Views
Hi THelb, For setting the Emitter_Enabled option, you should implement the code like this: dev = profile.get_device(); sens = dev.first('depth_sensor'); sens.set_option(realsense.option.emitter_enabled, 0); %or 1 Please let me know if it works. Regards, Alexandra
0 Kudos
THelb
Beginner
568 Views

Hi Alexandra,

 

thank you very much, it works now!

 

Regards,

THelb

0 Kudos
Reply