Main Content

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.

  1. Register the adaptor library with MATLAB

    In the MATLAB command window, use the imaqregister command to register the adaptor from KINOVA Robotics with 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.

  2. Verify the registration

    1. Reset the image acquisition hardware

      imaqreset; 
    2. Get information about the available image acquisition hardware

      imaqhwinfo; 

      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.

  3. Acquire image from cameras

    • Windows OS

      1. Create a video input object for RGB camera

        vid1 = videoinput('kinova_vision_imaq', 1, 'RGB24'); 
      2. Set frames per trigger and get information about currently selected video source object

        vid1.FramesPerTrigger = 1; 
        src1 = getselectedsource(vid1);
      3. Change device properties

        src1.CloseConnectionOnStop = 'Enabled';
        src1.Ipv4Address = ‘192.168.1.10’;  
      4. Preview the video object

        preview(vid1); 
      5. Close the preview and delete the video object

        closepreview(vid1);
        delete(vid1); 
      6. 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); 
    • Linux OS

      • The only difference in the workflow for Linux operating system is the name of adaptor. For Linux, the adaptor name is libkinova_vision_imaq instead of kinova_vision_imaq for Windows.

      • Perform the remaining steps, which are same as mentioned under Windows operating system.