Read the intel® RealSense with the new MATLAB® adapter code sample? Camera data stream

Source: Internet
Author: User

To download the source code, please visit the original address: Read the intel® realsense™ camera data stream with the new MATLAB® adapter code sample

Brief introduction

This downloadable code sample briefly describes how to use the intel® RealSense ™sdk and MATLAB Image Acquisition Toolbox Adapter kit to obtain the original camera data stream for the intel® realsense™ camera (R200 and F200) in the MATLAB® workspace. This sample code enables MATLAB developers to develop intel® realsense™ applications for intel® platforms with the following features:

    • multiple data stream synchronization. both the color data stream and the depth of field data stream are obtained (see Figure 1).
    • Multi-camera support. get the raw data stream for multiple cameras at the same time.
    • The user can adjust the properties. the adapter supports video input that contains different properties specific to the camera.

Figure 1. The original intel® realsense™ camera (F200) color and depth-of-field streaming diagram in matlab*.


Software development environment

The code sample was created using Microsoft Visual studio* 2013 on Windows 8*. The MATLAB version used in this project is Matlab r2015a.

The SDK and Depth camera Manager (DCM) versions used in this project are:

    • Intel RealSense SDK V7.0.23.8048
    • Intel RealSense Depth Camera manager F200 V1.4.27.41944
    • Intel RealSense Depth Camera manager R200 V2.0.3.53109

Hardware overview

We used the intel® realsense™ Developer Kit (F200) and the Intel RealSense Developer Kit (R200).

About Code

The code example can be built into a dynamic-link library (DLL) to connect the MATLAB Image Acquisition Toolbox ™ and the Intel RealSense camera via the Intel RealSense SDK. Figure 2 shows the relationship between the adapter and the MATLAB and Intel RealSense cameras. MATLAB's Image Acquisition Toolbox ™ is a standard interface that can be used to capture imaging devices that are images and video.

Figure 2. The relationship between the adapter and the MATLAB and intel® realsense™ camera.


I used the MATLAB installation path and the SDK installation path are respectively C:\MATLAB and C:\Program Files (x86)\Intel\RSSDK . Note that if the SDK and the MATLAB installation path are different, you need to change the Include directory and library directory. You also need to set the environment variable in the system variable containing the MATLAB installation folder name Matlab.

The file location used to place the entire code example Realsenseimaq is C:\My_Adaptor\RealSenseImaq . The Realsenseimaq solution is located below this directory. The Realsenseimaq solution is actually comprised of two projects:

    • Imaqadaptorkit is an adapter suite project provided by Matlab to help you easily reference some of the adapter suite files in MATLAB. The file locations for this project are:<your_matlab_installation_directory>\R2015a\toolbox\imaq\imaqadaptors\kit
    • The Realsenseimaq is an adapter project for capturing raw camera data streams. Multiple camera colors and depth of field data can be collected simultaneously. It can also support video input with different attributes (specific to the camera).

How to Run code

To build a DLL from this code sample:

    • First run Microsoft Visual Studio as an administrator and open the Realsenseimaq solution. You must make sure that you specify "x64" below the platform settings in the project properties.
    • To build the code example, right-click the project Realsenseimaq in the solution browser and select and build from the menu options as a startup item.
    • MATLAB developers and users who are not interested in source code can C:\My_Adaptor\RealSenseImaq\x64\Debug\ look up pre-built DLLs from a folder. Note that if you put the code sample in a different location, you need to change the DLL directory.

To park the DLL in MATLAB:

    • DLLs must be hosted with the imaqregister function to inform the Image Acquisition Toolbox software of the existence of the DLL. You can use the following MATLAB code to register DLLs:

Imaqregister (' <your_directory>\realsenseimaq.dll ');

    • Start MATLAB, and call the imaqhwinfo function. At this point you should see that the Realsenseimaq adapter included in the adapter is listed in theinstalledadaptors field.

To run a DLL in MATLAB:

I created 3 MATLAB scripts and placed them below the code sample directory C:\My_Adaptor\RealSenseImaq\matlab .

To start running a DLL in MATLAB, use the following script:

    • The Matlab script "test1" can be used to capture raw F200 color data streams in MATLAB.
    • Use the MATLAB script "Test2" to capture both the original color of the Intel RealSense Camera (F200) and the depth of field data stream (see Figure 1).
    • You can also use the adapter to adjust camera-specific properties and retrieve the current value of the property. For example, the MATLAB script "Test3" in the code sample file can be used to retrieve the current value of the color brightness and adjust it.

View Now

Click the download link to get the code.

About intel® realsense™ Technology

To get started, learn more about the Intel RealSense Software Development Kit for Windows, please visit: HTTPS://SOFTWARE.INTEL.COM/ZH-CN/INTEL-REALSENSE-SDK.

About MATLAB®

MATLAB is a high-level language and interactive environment that enables you to explore and present ideas and collaborate across disciplines. For more information about MATLAB, please visit the http://www.mathworks.com/products/matlab/

About the author

Jing Huang is a software application engineer in the Intel Developer Relations Department. She is currently focused on the performance of Intel RealSense SDK based on Intel's platform, but she has extensive experience in video and image processing, as well as in computer vision, mostly for medical imaging applications and multi-camera applications such as video tracking and classification.

Read the intel® RealSense with the new MATLAB® adapter code sample? Camera data stream

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.