Configure MATLAB to Acquire Images from Vision Module
After you perform the initial configuration activities as described in Set Up IMAQ Adapter for matlab_kortex Driver, you can configure MATLAB® to acquire images from vision module of the Kinova® Gen3 robot.
Register the adaptor library with MATLAB
In the MATLAB command window, use the
imaqregistercommand to register the adaptor from KINOVA Robotics with MATLAB Image Acquisition Toolbox™. This step needs to be performed only once.
For the Windows operating system, the library file is ‘kinova_vision_imaq.dll’ and it is located in the installation folder. For example, if the installation folder is ‘C:\Program Files\Kinova\Vision Imaq’ then the command to register the adaptor is:
imaqregister('C:\Program Files\Kinova\Vision Imaq’);
For Linux operating system, the library file is 'libkinova_vision_imaq.so' and it is available inside the downloaded folder.
Verify the registration
Reset the image acquisition hardware
Get information about the available image acquisition hardware
If the adaptor is registered correctly, ‘kinova_vision_imaq’ is present under list of installed adaptors. If the adaptor is not listed under the installed adapters, then restart the MATLAB and continue with Step 3.
Acquire image from cameras
Create a video input object for RGB camera
vid1 = videoinput('kinova_vision_imaq', 1, 'RGB24');
Set frames per trigger and get information about currently selected video source object
vid1.FramesPerTrigger = 1; src1 = getselectedsource(vid1);
Change device properties
src1.CloseConnectionOnStop = 'Enabled'; src1.Ipv4Address = ‘192.168.1.10’;
Preview the video object
Close the preview and delete the video object
Display the colorized depth video
vid2 = videoinput('kinova_vision_imaq', 2, 'MONO16'); vid2.FramesPerTrigger = 1; src2 = getselectedsource(vid2); src2.CloseConnectionOnStop = 'Enabled'; src2.Ipv4Address = '192.168.1.10'; im = preview(vid2); ax = im.Parent; im.CDataMapping = 'scaled'; colormap(ax, hot); ax.CLimMode = 'auto'; ax.CLim = [0 20]; closepreview(vid2); delete(vid2);
The only difference in the workflow for Linux operating system is the name of adaptor. For Linux, the adaptor name is
Perform the remaining steps, which are same as mentioned under Windows operating system.