Support Support Home » Vision Libraries » MathWorks MATLAB

MathWorks MATLAB


MathWorks® is the leading developer and supplier of software for technical computing and Model-Based Design.
The MATLAB® product family provides a flexible environment for solving complex imaging problems in a wide range of applications including scientific imaging, medicine and biotechnology, aerospace and defense, security, and machine vision.
Image Acquisition Toolbox™ enables users to acquire images and video directly from cameras into MATLAB and Simulink. Image Processing Toolbox™ and Computer Vision System Toolbox™ products provide algorithms and tools for building image processing, video processing, and computer vision applications.


Recent API Software Packages are fully supported and tested with Matlab versions released in the last 2 years. The backward compatibility is not tested for all features and camera models in older Matlab versions.

Matlab R2014a and later

  1. Install Matlab software.
  2. Install the XIMEA API Software Package , which contains the XIMEA GeniCam GenTL Producer .
    Note: Installation is not needed on products with pre-installed software packages
  3. Open Matlab and install the Genicam Interface according to the guide described on the Installing the Support Packages for Image Acquisition Toolbox Adaptors Mathworks support page.
  4. Restart PC.

Matlab R2012a to R2013b

  1. Install Matlab software.
  2. Install the XIMEA API Software Package , which contains the XIMEA GeniCam GenTL Producer .
    Note: Installation is not needed on products with pre-installed software packages
  3. Open Matlab and run the installgenicam.m file from the C:\Program Files\MATLAB\R2014a\toolbox\imaq\imaqextern folder.
  4. Restart PC.

Linux support

Besides above steps, please
  • add "export GENICAM_GENTL64_PATH=/opt/XIMEA/lib/" to your ~/.bashrc file to enable GenTL
  • or run MATLAB every time by command:
    GENICAM_GENTL64_PATH=/opt/XIMEA/lib/ ./Matlab


The Image Acquisition Tool is a graphical interface for rapid hardware configuration, image acquisition and live video previewing.
The preview window, as shown here, reflects adjustments made to the XIMEA camera properties and provides a quick start in the development of image processing systems.


The toolbox has a comprehensive set of functions for command line programming of tasks such as device connection, image data acquisition, to adjust acquisition parameters and more.
The code below shows how to connect to a XIMEA camera to acquire data:

% Access an image acquisition device
vidobj = videoinput('gentl', 1, 'BGRA8Packed');
src.AEAGEnable = 'True';
% List the video input object's configurable properties.vidobj.FramesPerTrigger = 50;
% Open the preview window
% Data acquisition
%  Cleanup the image acquisition object and the MATLAB® workspace delete(vidobj);
clear vidobj;


Visit the Image Acquisition Toolbox support page.

The .NET support for MATLAB

Applications in Matlab can be also developed under our .NET interface.
Since xiAPI.NET supports multiple versions of the .NET SDK, you need to:
  1. copy xiApi64.dll (or xiApi32.dll for x86 systems) from \XIMEA\API\xiAPI to folder of the .NET version you are using (e.g. to \XIMEA\API\xiAPI.NET.Framework.4.7.2)
  2. import the xiApi.NETX64.dll (xiApi.NET.dll for x86 systems) from the same folder into Matlab (e.g. from \XIMEA\API\xiAPI.NET.Framework.4.7.2 like in the following sample)

After importing the xiAPI.NET shared library you can implement an application with the xiAPI.NET API.

.NET example

Here is a xiAPI.NET example for Matlab. Path to xiApi.NET depends on what .NET version you are using.
More extensive sample showing work with RGB or 16-bit image formats can be downloaded here: xiAPINET_Matlab_sample.m.

NET.addAssembly('C:\XIMEA\API\xiAPI.NET.Framework.4.7.2\xiApi.NETX64.dll');  % Path to the xiApi.NET library

myCam=xiApi.NET.xiCam;      % Initialize camera
myCam.SetParam(xiApi.NET.PRM.EXPOSURE ,10000);    % Set exposure time
myCam.SetParam(xiApi.NET.PRM.IMAGE_DATA_FORMAT, xiApi.NET.IMG_FORMAT.RAW8);     % Set image format




% img is ready to process as MATLAB uint8 image matrix               

clear myCam;