Visual Servoing Platform  version 3.4.0
Tutorial: Generic model-based tracking in java with ViSP

Introduction

We assume that you have already followed the previous tutorial Tutorial: First java application with ViSP. It could be also useful to follow Tutorial: Markerless generic model-based tracking using a color camera to get an overview on model-based tracking in ViSP.

In this tutorial, you will see how to develop an application that allows to load a sequence of images and run model-based tracking in java using ViSP library in Eclipse.

Create a new project

To create the project corresponding to this tutorial:

  • Open Eclipse and create a new Java project entering "File \> New \> Java Project" menu.
img-tutorial-java-eclipse-create-new-project.jpeg
  • In the "New Java Project" dialog write the name of your project (let say visp-java-mbt-generic). In JRE section, select the appropriate execution environment (JavaSE-11 if you install JDK 11, or JavaSE-13 if you install JDK 13). Then press "Finish" button.
img-java-mbt-generic-project.jpg
  • In the "New module-info.java" dialog that may appear, press "Don't Create" button.
img-tutorial-java-eclipse-dont-create.jpeg

Add a user library

If you followed Tutorial: Installing ViSP for Java, you should already have ViSP library set in your workspace’s user libraries; if not please check out Tutorial: Installing ViSP for Java. Now you should be ready to add ViSP library to your project.

  • Inside Eclipse’s Package Explorer just right-click on your project’s folder and go to "Build Path \> Add Libraries...".
img-java-mbt-generic-import-user-library.jpg
  • Select "User Library" and click on "Next":
img-tutorial-java-eclipse-add-libraries2.jpeg
  • Check the checkbox of the ViSP library and press "Finish" button.
img-tutorial-java-eclipse-add-libraries3.jpeg

Import generic tracker java code

  • Now import GenericTracker.java file in your project, pointing your mouse on src folder and with a right click entering "Import" menu.
img-java-mbt-generic-import.jpg
  • Select "General \> File System" and press Next button.
img-java-apriltag-import-file.jpg
  • Browse to $VISP_WS/visp/tutorial/java/mbt-generic folder, enable mbt-generic check box and press Finish button.
img-java-mbt-generic-import-mbt-generic.jpg
  • Now expanding what's behind src you should see something similar to:
img-java-mbt-generic-project-complete.jpg

Run tracking application

We can now run this application entering"Run \> Run" menu.

  • Here you should see the application appearing:
img-java-mbt-generic-app-empty.png

Install ViSP data set, press "Open ViSP Input Image" button, browse to select $ViSP_WS/visp-images folder that contains ViSP dataset, and press "open" button as shown in the next image.

img-java-mbt-generic-app-open-data-set.png
  • Now press "Track" button to run the tracker on a sequence that is part of ViSP dataset.


This application allows to select features (edges alone, keypoints alone, or edges and keypoints together in the same scheme) that are used by the tracker. Just try it...

Known issues