Using MATLAB Image Acquisition Toolbox for Linux
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
- Ubuntu 16.04.3 64-bit, kernel 4.10.0.28-generic
- MATLAB R2017b
Prerequisites
-
Install the Image Acquisition Toolbox.
- Click on the Apps tab.
- Click Get More Apps.
- 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.
-
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.
-
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 Toolbox window.
MATLAB Image Acquisition Tool
-
Launch the Image Acquisition Tool from within MATLAB. MATLAB can be launched by typing matlab from the terminal.
-
Choose your desired camera and pixel format in the Hardware Browser.
-
Click Start Preview to preview images on screen in the current imaging settings.
-
Click Stop Preview to stop previewing images on screen.
-
Select the Device Properties tab to adjust camera settings.
-
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.
-
Select the Region of Interest tab to adjust image height and width.
-
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.
-
Click Start Acquisition to start grabbing and logging image data.
-
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 to save your session log.
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.