Latest commit 8b9b16b Nov 28, 2018
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
CMakeLists.txt Add Matlab to CMake Nov 7, 2018
Factory.cpp Matlab Wrapper. framework, example, bindings for example, additional … Aug 14, 2018
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 Update Matlab wrapper for processing_block refactor. Nov 28, 2018
camera_info.m lots of work on matlab half of the wrapper Aug 14, 2018
colorizer.m Update Matlab wrapper for processing_block refactor. Nov 28, 2018
config.m Fix typos found by izaakvc in #2487 Oct 8, 2018
context.m Finish matlab half off all classes for initial release, add first exa… Aug 14, 2018
decimation_filter.m Update Matlab wrapper for processing_block refactor. Nov 28, 2018
depth_example.m Matlab colorizer example to use standard toolbox API Aug 27, 2018
depth_frame.m lots of work on matlab half of the wrapper Aug 14, 2018
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 Add operator bool functions to matlab wrapper Aug 21, 2018
device_hub.m Finish matlab half off all classes for initial release, add first exa… Aug 14, 2018
disparity_frame.m lots of work on matlab half of the wrapper Aug 14, 2018
disparity_transform.m Update Matlab wrapper for processing_block refactor. Nov 28, 2018
filter.m Update Matlab wrapper for processing_block refactor. Nov 28, 2018
format.m Finish matlab half off all classes for initial release, add first exa… Aug 14, 2018
frame.m Add operator bool functions to matlab wrapper Aug 21, 2018
frame_metadata_value.m lots of work on matlab half of the wrapper Aug 14, 2018
frame_queue.m Finish matlab half off all classes for initial release, add first exa… Aug 14, 2018
frameset.m [matlab] update frameset.m to reflect mexfile Oct 31, 2018
hole_filling_filter.m Update Matlab wrapper for processing_block refactor. Nov 28, 2018
librealsense_mex.cpp Update Matlab wrapper for processing_block refactor. Nov 28, 2018
librealsense_mex.def Matlab Wrapper. framework, example, bindings for example, additional … Aug 14, 2018
librealsense_mex.sln update project files to be more generic and hopefully compile anywhere Aug 19, 2018
librealsense_mex.vcxproj Update Matlab VS Project Nov 28, 2018
librealsense_mex.vcxproj.filters Update Matlab VS Project Nov 28, 2018
librealsense_mex.vcxproj.user Matlab Wrapper. framework, example, bindings for example, additional … Aug 14, 2018
motion_frame.m lots of work on matlab half of the wrapper Aug 14, 2018
motion_stream_profile.m lots of work on matlab half of the wrapper Aug 14, 2018
option.m lots of work on matlab half of the wrapper Aug 14, 2018
options.m Finish matlab half off all classes for initial release, add first exa… Aug 14, 2018
pipeline.m Finish matlab half off all classes for initial release, add first exa… Aug 14, 2018
pipeline_profile.m Fix more errors discovered by izaakvc in issue #2487 Oct 24, 2018
playback.m Finish matlab half off all classes for initial release, add first exa… Aug 14, 2018
playback_status.m Finish matlab half off all classes for initial release, add first exa… Aug 14, 2018
pointcloud.m Update Matlab wrapper for processing_block refactor. Nov 28, 2018
pointcloud_example.m Fix matlab build Nov 27, 2018
points.m Update for function get_vertices in points.m file Sep 3, 2018
pose_frame.m lots of work on matlab half of the wrapper Aug 14, 2018
readme.md Matlab wrapper documentation update Nov 27, 2018
recorder.m Finish matlab half off all classes for initial release, add first exa… Aug 14, 2018
roi_sensor.m fix additional typos Oct 8, 2018
rosbag_example.m Replace vec2mat with reshape Nov 11, 2018
rs2_type_traits.h Update Matlab wrapper for processing_block refactor. Nov 28, 2018
sensor.m Add operator bool functions to matlab wrapper Aug 21, 2018
spatial_filter.m Update Matlab wrapper for processing_block refactor. Nov 28, 2018
stream.m Finish matlab half off all classes for initial release, add first exa… Aug 14, 2018
stream_profile.m [matlab] Fix Access Violation errors when using stream_profiles Oct 29, 2018
syncer.m Finish matlab half off all classes for initial release, add first exa… Aug 14, 2018
temporal_filter.m Update Matlab wrapper for processing_block refactor. Nov 28, 2018
timestamp_domain.m lots of work on matlab half of the wrapper Aug 14, 2018
types.h [matlab] Fix Access Violation errors when using stream_profiles Oct 29, 2018
video_frame.m Matlab Wrapper. framework, example, bindings for example, additional … Aug 14, 2018
video_stream_profile.m lots of work on matlab half of the wrapper Aug 14, 2018

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();
    channels = vec2mat(data, 3);
    img(:,:,1) = vec2mat(channels(:,1), color.get_width());
    img(:,:,2) = vec2mat(channels(:,2), color.get_width());
    img(:,:,3) = vec2mat(channels(:,3), color.get_width());

    % Display image
    imshow(img);
    title(sprintf("Colorized depth frame from %s", name));
end