This MATLAB adaptor allows access to the Kinova vision module depth and color streams in MATLAB via the Image Acquisition Toolbox.
Development and testing was done under:
- Windows 7 (64-bit) and
- Ubuntu 16.04 (64-bit).
- MATLAB version 9.5 (R2018b)
- Image Acquisition Toolbox (selected during MATLAB installation)
- Image Processing Toolbox (selected during MATLAB installation)
Note: You don't need to install the following GStreamer 1.0 Runtime Binaries if you select to install the GStreamer component when installing the Vision Module MATLAB Image Acquisition Toolbox Adaptor. Refer to section Installation Instructions below.
- GStreamer 1.0 Runtime Binaries:
- Environment variable
PATH
must include GStreamer's binaries folder- Typically
C:\gstreamer\1.0\x86_64\bin
- Typically
Note: When installing GStreamer, it's recommended to select the Complete installation.
GStreamer 1.0 and Glib 2.0 Runtime binaries:
sudo apt install libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-libav
sudo apt install libglib2.0-0
You can access the latest release of the Vision Module MATLAB Image Acquisition Toolbox Adaptor here on the Kinova Artifactory.
Uncompress the archive to access either the Windows or Linux binaries:
Under the windows/installer
folder, you will find the installer executable.
This application, kinova_vision_imaq_<version>.exe
, installs the following components:
- The Kinova Vision Module MATLAB Image Acquisition Toolbox Adaptor library (i.e. the product)
- [Optionally] The required GStreamer libraries (see note below)
- [Optionally] The Windows redistribution libraries installer (runs automatically)
Note: If GStreamer version 1.15.2 or more recent is already installed on your system, you don't need to install the GStreamer libraries component.
The <version> field indicates the version of the product.
You need to have administration privileges to run this installer. This is required to update the Windows registry, as well as optionally update environment variables.
This installer can only be run on a Windows 64-bit machine.
The installation information is stored in the Windows registry for the local machine (HKLM).
This makes the application visible in the "Program and Feature" control panel, allowing you to uninstall the application if required.
If the GStreamer libraries component is installed, the following environment variables are affected.
- User environment:
GST_PLUGIN_SYSTEM_PATH
(added if not already existing) - System environment:
PATH
For both variables, the path to the installed GStreamer libraries is added. Upon uninstalling the application, that path is removed from these environment variables.
Under the linux/lib
folder, you will find the adaptor library.
- Start MATLAB
- In the Command Window, register the adaptor library (you will only have to do this once):
imaqregister('<full/path/to/kinova_vision_imaq library>');
Note:
- Under the Windows Operating System, the library file is
kinova_vision_imaq.dll
- Under the Linux Operating System, the library file is
libkinova_vision_imaq.so
Device ID | Stream | Format |
---|---|---|
1 | Color | RGB24 |
2 | Depth | MONO16 |
Property | Access | Default | Description |
---|---|---|---|
Close Connection On Stop | Read/Write | Disabled | Close stream connection upon stopping a capture (see Note 1) |
Ipv4 Address | Read/Write | 192.168.1.10 | IP address to reach the Vision module via the arm |
Reset ROI On Resolution Change | Read/Write | Enabled | Reset the ROI upon a stream resolution change (see Note 2) |
Resolution | Read Only | N/A | Indicates the stream resolution |
Note 1:
When we close the stream connection, we use the GStreamer library to change the pipeline state to READY
. Unfortunately, under Linux, this doesn't always send a TEARDOWN
request to the robot RTSP server. Without the TEARDOWN
request, the RTSP server needs to wait for a 30-second inactivity timeout before internally closing the connection. As a result, if we open then close connections successively, after 2 connections we need to wait for 30 seconds.
To avoid this issue, the default behavior is to leave the connection open upon stopping a capture (preview, acquisition). When you're ready to close a connection, simply set the proper device's property to 'Enabled' before stopping a capture.
Note 2:
When enabled, the Region of Interest (ROI) is reset to the maximum streamed image size upon a change in the resolution of the streamed video.
The detection is made when starting a capture (preview, acquisition), including the first one after a reset of the adaptor.
% Resets image acquisition hardware and obtains information about image acquisition adaptors
imaqreset;
imaqhwinfo;
% Note: For Linux, the adaptor name is libkinova_vision_imaq
vid1 = videoinput('kinova_vision_imaq', 1, 'RGB24');
vid1.FramesPerTrigger = 1;
src1 = getselectedsource(vid1);
% Optionally, view the adaptor version
imaqhwinfo(vid1)
% Optionally, change device properties
src1.CloseConnectionOnStop = 'Enabled';
src1.Ipv4Address = '10.20.0.100';
src1.ResetROIOnResolutionChange = 'Disabled';
% Optionally, change the Region of Interest
vid1.ROIPosition = [0 0 300 200];
preview(vid1);
closepreview(vid1);
delete(vid1);
% Note: For Linux, the adaptor name is libkinova_vision_imaq
vid2 = videoinput('kinova_vision_imaq', 2, 'MONO16');
vid2.FramesPerTrigger = 1;
src2 = getselectedsource(vid2);
% Optionally, view the adaptor version
imaqhwinfo(vid2)
% Optionally, change device properties
src2.CloseConnectionOnStop = 'Enabled';
src2.Ipv4Address = '10.20.0.100';
src2.ResetROIOnResolutionChange = 'Disabled';
% Optionally, change the Region of Interest
vid2.ROIPosition = [0 0 300 200];
preview(vid2);
closepreview(vid2);
delete(vid2);
% Note: For Linux, the adaptor name is libkinova_vision_imaq
vid2 = videoinput('kinova_vision_imaq', 2, 'MONO16');
vid2.FramesPerTrigger = 1;
src2 = getselectedsource(vid2);
% Optionally, view the adaptor version
imaqhwinfo(vid2)
% Optionally, change device properties
src2.CloseConnectionOnStop = 'Enabled';
src2.Ipv4Address = '10.20.0.100';
src2.ResetROIOnResolutionChange = 'Disabled';
% Optionally, change the Region of Interest
vid2.ROIPosition = [0 0 300 200];
im = preview(vid2);
ax = im.Parent;
im.CDataMapping = 'scaled';
colormap(ax, hot);
ax.CLimMode = 'auto';
ax.CLim = [0 20];
closepreview(vid2);
delete(vid2);
- From MATLAB' main window, click on the Image Acquisition button
- In the
Image Acquisition Tool
window:
- Select
RGB24 (default)
underColor Device
- [Optionally] In the
Acquisition Parameters
view, selectDevice Properties
and view / change some properties - [Optionally] In the
Acquisition Parameters
view, selectRegion of Interest
and view / change the ROI - Click on
Start Preview
- Select
MONO16 (default)
underDepth Device
- [Optionally] In the
Acquisition Parameters
view, selectDevice Properties
and view / change some properties - [Optionally] In the
Acquisition Parameters
view, selectRegion of Interest
and view / change the ROI - Click on
Start Preview
When doing the imaqregister
command, you may get an error about ... kinova_vision_imaq.dll is not a valid adaptor
. Make sure the install location of the GStreamer libraries component is in the system environment variable PATH
.
If the location is already there, you might need to move it before other GStreamer librairies locations. Note however that doing so might break compatibility with other applications using GStreamer.
When doing the imaqhwinfo
command, you may get an error about Plugin '<plugin>' not found ...
. Make sure the install location of the GStreamer libraries component is both in the user environment GST_PLUGIN_SYSTEM_PATH
and in the system environment variable PATH
.
If the location is already there, you might need to move it before other GStreamer librairies locations. Note however that doing so might break compatibility with other applications using GStreamer.
When doing the imaqhwinfo
command, you may get an error about Plugin '<plugin>' not found ...
. Make sure the required plugins are installed.
Refer to the above section Runtime Dependencies.
This MATLAB adaptor uses GStreamer to access the Kinova Vision module Depth and Color streams. GStreamer uses the LGPL license.