View my account

Realsense D457 Zoom and settings adjustment

Comments

9 comments

  • MartyG

    Hi Coltongcunningham  RealSense cameras do not have an optical zoom mechanism on their sensors.  The focus of the lenses is fixed.

     

    You can set a Disparity Shift in the RealSense MATLAB wrapper to reduce the minimum depth sensing distance by configuring its value in a json camera configuration file and then importing the json in your MATLAB script to apply the settings stored in the file.  The link below demonstrates how to set Disparity Shift this way in the wrapper.

    https://support.intelrealsense.com/hc/en-us/community/posts/17464300886675/comments/17480495790227

     

    If you are using RGB color images then you may also benefit from setting RGB Sharpness to its maximum value of '100' in the json file to improve RGB image quality.

    "controls-color-sharpness": "100",
    0
    Comment actions Permalink
  • Coltongcunningham

    Hi Marty, 
    Thank you for your response. I think loading in a .json file would be a good solution, but I think there is an issue with the Matlab wrapper code. I a getting the same error as seen in this thread. https://github.com/IntelRealSense/librealsense/issues/12004

    I tried using the advancedmode example in the matlab wrapper, and it seems to not work in loading in the .json file as a string. Is there a work around to fix this issue?

    0
    Comment actions Permalink
  • MartyG

    What method did you use to create your json file, please?  Did you export it from the RealSense Viewer tool?  If you are, is one of the preset files from the link below able to work with the json loading string?

    https://dev.intelrealsense.com/docs/d400-series-visual-presets#preset-table

    0
    Comment actions Permalink
  • Coltongcunningham

    Hi, I just tried that, and it worked I believe. I attached the code I used to load in a .json file and then load those settings into the intel camera incase it is helpful for others down the road.

    function advanced_mode_example()
    % Make a context object
    ctx = realsense.context();
    % Get a device from context
    devs = ctx.query_devices();
    dev = devs{1};
     
    % Make sure the device supports advanced mode
    if ~dev.is('advanced_mode')
    error('Device doesn''t support advanced mode!');
    end
     
    % Make sure the device is in advanced mode
    adv = dev.as('advanced_mode');
    if ~adv.is_enabled()
    adv.toggle_advanced_mode(true);
     
    % Pause execution to give the device time to reconnect
    oldState = pause('on');
    pause(2)
    pause(oldState);
    % Grab the device
    devs = ctx.query_devices();
    dev = devs{1};
    adv = dev.as('advanced_mode');
    % Make sure the device supports advanced mode
    if ~adv.is_enabled()
    error('Device didn''t enter advanced mode');
    end
     
    end
     
     
    json_file_path = fullfile("Put full file path here");
     
    % Read the JSON file
    try
    json_data = fileread(json_file_path);
    catch ME
    error(['Error reading JSON file: ' ME.message]);
    end
     
    % Load the JSON data into the camera
    adv.load_json(json_data);
     
    disp('Successfully loaded camera settings from JSON file.');
    end
    0
    Comment actions Permalink
  • MartyG

    It's great to hear that you were successful.  Thanks so much for sharing your solution!

    0
    Comment actions Permalink
  • Coltongcunningham

    One more question, I see in the viewer, that I can change the maximum detectable distance, and the minimum detectable distance. However, when I look in the .json file settings, I don't see an option to adjust the min and max depth thresholds. Is there a way to adjust these settings in the .json file?

    0
    Comment actions Permalink
  • MartyG

    You can define a depth clamp min-max in the json.

    "aux-param-depthclampmin": "0",

    "aux-param-depthclampmax": "65536",

     

    The values 0-65536 represent the raw pixel depth values.  You can find what the values represent in real-world meters by multiplying the value by 0.001, the default 'depth unit scale' of the D455 camera.  For example, 65536 x 0.001 = 65.536 meters (known as the expressive range, described at the link below).

    https://dev.intelrealsense.com/docs/projection-in-intel-realsense-sdk-20#depth-image-formats

    0
    Comment actions Permalink
  • Coltongcunningham

    Thank you Marty, that is really helpful. Another question, what do people usally do to increase the resolution of the camera with far away objects? Because the camera is able to sense up to 6 meters away reliably, but if we take a picture of an object 6 meters away and enlarge it, it will be pretty pixelated. So, since the camera doesn't have a zoom function, is there another way to enhance the resolution of a faraway object?

     

     

    0
    Comment actions Permalink
  • MartyG

    The default depth resolution of D455 is 848x480.  The higher resolution 1280x720 is also supported for depth though.  If you are using RGB color then that is 1280x720 by default.  Custom configurations for streams can be defined using the MATLAB wrapper code below.

     

    config = realsense.config();
    config.enable_stream(realsense.stream.depth,1280,720,realsense.format.z16,30);
    config.enable_stream(realsense.stream.color,1280,720,realsense.format.rgb8,30);
    % Make Pipeline object to manage streaming
    pipe = realsense.pipeline();
    % Start streaming with default settings
    profile = pipe.start(config);
    0
    Comment actions Permalink

Please sign in to leave a comment.