Using MATLAB Image Acquisition Toolbox for Windows

Image Acquisition Toolbox™ provides functions and blocks that enable you to connect industrial and scientific cameras to MATLAB® and Simulink®. It includes a MATLAB app that lets you interactively detect and configure hardware properties. The toolbox enables acquisition modes such as processing in-the-loop, hardware triggering, background acquisition, and synchronizing acquisition across multiple devices. The following instructions detail how to configure Lucid Vision GigE Vision cameras with MATLAB Image Acquisition Toolbox.

System Specifications

  • Windows 10 Pro 64-bit, version 1709, build 16299.64
  • MATLAB 2017b 64-bit

Prerequisites

  1. Install the Image Acquisition Toolbox.

    • Click on the Apps tab.
    • Click Get More Apps.

    https://d1d1c1tnh6i0t6.cloudfront.net/wp-content/uploads/2018/01/matlab_windows_get_more_apps.png

    • Search for the Image Acquisition Toolbox package and install it.

    The Image Acquisition Tool, which is part of the Image Acquisition Toolbox, will be available in your Apps tab.

    https://d1d1c1tnh6i0t6.cloudfront.net/wp-content/uploads/2018/01/matlab_windows_image_acquisition_installed.png

  2. Install the MATLAB GigE Vision adapter.

    • Click on the Apps tab.
    • Click Get More Apps.
    • Search for the Image Acquisition Support Package for GigE Vision Hardware package and install it.

    https://d1d1c1tnh6i0t6.cloudfront.net/wp-content/uploads/2018/01/matlab_windows_addon_gige.png

  3. Verify the MATLAB GigE Vision adapter is installed by finding the package named gige in the Installed adaptors list in the Information section of the Image Acquisition Tool window.

    https://d1d1c1tnh6i0t6.cloudfront.net/wp-content/uploads/2018/01/matlab_windows_image_acquisition_gige.png

MATLAB Image Acquisition Tool

  1. Launch the MATLAB Image Acquisition Tool from within MATLAB. MATLAB can be launched from the Start Menu.

    https://d1d1c1tnh6i0t6.cloudfront.net/wp-content/uploads/2018/01/matlab_windows_image_acquisition.png

  2. Choose your desired camera and pixel format in the Hardware Browser.

    https://d1d1c1tnh6i0t6.cloudfront.net/wp-content/uploads/2018/01/matlab_windows_image_acquisition_hardware_browser.png

  3. Click Start Preview to preview images on screen in the current imaging settings.

  4. Click Stop Preview to stop previewing images on screen.

  5. Select the Device Properties tab to adjust camera settings.

  6. Select the Logging tab to adjust the logging settings used by the Image Acquistion Tool.

    • Choose Log to: Memory to log image data to memory. Click Export Data to export the data after image acquisition.
    • Choose Log to: Disk to log image data to disk. Image data gets logged to a VideoWriter file.
    • Choose Log to: Disk and memory to log image data to memory and disk.
  7. Select the Region of Interest tab to adjust image height and width.

  8. Select the Triggering tab to configuring MATLAB’s triggering modes.

    • Immediate will immediately log image data.
    • Manual will log image data when the Trigger button is clicked.

    Camera triggering options are present in the Device Properties tab.

  9. Click Start Acquisition to start grabbing and logging image data.

  10. Click Stop Acquisition to stop grabbing and logging image data.

The Image Acqusition Tool will also record your actions in the Session Log which can be saved as a MATLAB M-file (.m). Click matlab_windows_image_acquisition_button_save_session_log to save your session log.

https://d1d1c1tnh6i0t6.cloudfront.net/wp-content/uploads/2018/01/matlab_windows_image_acquisition_session_log.png

MATLAB gigecam Interface

Starting with MATLAB 2014a, the Image Acquisition Support Package for GigE Vision Hardware also includes the gigecam interface, which is specifically designed for GigE Vision cameras. It can be used to access GigE Vision-specific features.

The following MATLAB commands demostrate connecting to a GigE camera and setting up camera properties using the gigecam interface.

% List cameras
>> gigecamlist

ans =

  1×4 table

       Model          Manufacturer          IPAddress       SerialNumber
    ___________    ___________________    ______________    ____________

    'PHX050S-M'    'Lucid Vision Labs'    '169.254.51.0'    '50'

% Connect to camera by IP address
% It is also possible to connect by list index number or serial number
>> g = gigecam('169.254.51.0')

g =

   Display Summary for gigecam:

          DeviceModelName: 'PHX050S-M'
             SerialNumber: '50'
                IPAddress: '169.254.51.0'
              PixelFormat: 'Mono8'
    AvailablePixelFormats: {'Mono8'  'Mono10p'  'Mono10Packed'  'Mono12Packed'  'Mono12p'  'Mono10'  'Mono12'  'Mono16'}
                   Height: 2048
                    Width: 2448
                  Timeout: 10

   Show Beginner, Expert, Guru properties.
   Show Commands.

>> g.PixelFormat = 'Mono8'
>> g.Width = 320
>> g.Height = 240
>> g.GainAuto = 'Off'
>> g.Gain = 1
>> g.ExposureAuto = 'Off'
>> g.ExposureTime = 1000
>> g.GevSCPSPacketSize = 9000

% preview(g) will preview the image from the camera
% snapshot(g) will acquire a single image
>> img = snapshot(g)

% display 'img' on screen
>> imshow(img)

% clear 'img'
>> clear img

For more information about the gigecam interface, please see the page Acquisition Using GigE Vision Hardware from MathWorks.

Note

The Image Acquisition Tool uses the gige interface with the videoinput object, which is separate from the gigecam interface.