Skip to content
Branch: master
Find file History
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
CMakeLists.txt
Factory.cpp
Factory.h Several organizational and logical changes to matlab wrapper code Aug 14, 2018
MatlabParamParser.h Add patch supplied by Christian Diaz of TUM to enable compilation on … Oct 24, 2018
align.m
camera_info.m lots of work on matlab half of the wrapper Aug 14, 2018
colorizer.m
config.m Fix similar errors in the rest of the matlab files Jan 16, 2019
context.m
decimation_filter.m
depth_example.m
depth_frame.m
depth_sensor.m Fix typos found by izaakvc in #2487 Oct 8, 2018
depth_stereo_sensor.m Fix typos found by izaakvc in #2487 Oct 8, 2018
device.m
device_hub.m Finish matlab half off all classes for initial release, add first exa… Aug 14, 2018
disparity_frame.m
disparity_transform.m
filter.m
format.m
frame.m
frame_metadata_value.m
frame_queue.m
frameset.m [matlab] rename frameset.size, points.size to fix isscalar behaviour Mar 24, 2019
hole_filling_filter.m
librealsense_mex.cpp
librealsense_mex.def
librealsense_mex.sln update project files to be more generic and hopefully compile anywhere Aug 19, 2018
librealsense_mex.vcxproj
librealsense_mex.vcxproj.filters Update Matlab VS Project Nov 28, 2018
librealsense_mex.vcxproj.user
motion_frame.m
motion_stream_profile.m
option.m
options.m Add save_to_ply PB to wrappers Dec 12, 2018
pipeline.m
pipeline_profile.m
playback.m
playback_status.m
pointcloud.m Update Matlab wrapper for processing_block refactor. Nov 28, 2018
pointcloud_example.m
points.m
pose_frame.m lots of work on matlab half of the wrapper Aug 14, 2018
readme.md
recorder.m
roi_sensor.m
rosbag_example.m Replace vec2mat with reshape Nov 11, 2018
rs2_type_traits.h
save_single_frameset.m Add save_single_frameset to wrappers Dec 12, 2018
save_to_ply.m Add save_to_ply PB to wrappers Dec 12, 2018
sensor.m
spatial_filter.m
stream.m
stream_profile.m Fix similar errors in the rest of the matlab files Jan 16, 2019
syncer.m Finish matlab half off all classes for initial release, add first exa… Aug 14, 2018
temporal_filter.m
timestamp_domain.m lots of work on matlab half of the wrapper Aug 14, 2018
types.h
video_frame.m
video_stream_profile.m

readme.md

Getting Started with RealSense™ SDK2.0 for Matlab®

Introduction:

The latest generation of RealSense Depth Cameras can be controlled via the RealSense SDK2.0, also referred to as libRealSense 2.x.x, or LibRS for short. This includes stereo depth cameras D415 and D435 as well as their corresponding modules, such as D410 and D430.

To get started controlling the RealSense Cameras with Matlab® in Windows 10, we have created a package that wraps some of the core functions of the realsense2.dll, and we have also created a simple “Hello World” function to get started capturing depth data. This uses Matlab R2017b and requires a Windows 10 laptop with a USB3 port.

Getting Started

Building from Source

  1. Download the Git repository. Opt in the Matlab wrapper for LibRs with cmake .. -D... -DBUILD_MATLAB_BINDINGS:BOOL=ON when configuring CMake.
  2. Build the librealsense_mex target.
  3. After compiling the project, set build/Debug or build/Release as your Matlab working directory. Alternatively copy the +realsense folder from there to a place where Matlab can find it.
  4. Start exploring with Realsense devices by typing at the Matlab prompt:
    realsense.depth_example - Capture and render Depth frame with a live device .
    realsense.rosbag_example - Playback pre-recorded video and data streams stored in rosbag format. realsense.pointcloud_example - Generate and visualize 3D point cloud from live stream.

Windows Installer

  1. Run the Windows Installer and select the Matlab Developer Package checkbox.

    Image of Installer

  2. Allow the installer to complete

  3. The package will be installed to C:\Program Files (x86)\Intel RealSense SDK 2.0\matlab\+realsense\. You can copy it from here to a place where Matlab can find it or add it to Matlab's path

Examples

Displaying a frame using realsense.pipeline

function depth_example()
    % Make Pipeline object to manage streaming
    pipe = realsense.pipeline();
    % Make Colorizer object to prettify depth output
    colorizer = realsense.colorizer();

    % Start streaming on an arbitrary camera with default settings
    profile = pipe.start();

    % 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
    
    % Stop streaming
    pipe.stop();

    % Select depth frame
    depth = fs.get_depth_frame();
    % Colorize depth frame
    color = colorizer.colorize(depth);

    % 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("Colorized depth frame from %s", name));
end
You can’t perform that action at this time.