Create the tracker files - asolis/vivaTracker GitHub Wiki

Step 1: Create your tracker files

Inside the trackers folders we will create a ncc folder. The vivaTracker cmake rules will search for all folders inside the trackers and load the new implementation as a new dynamic library to the project. The name of the library will be defined by the folder's name.

Our folder structure should be like this now

/
  trackers/
        ncc/   (<- new created folder)
        ...
   sequences/
   license/
   trackerlib/
   vivalib/
   ...

Inside of the "trackers/ncc" folder we will create a CMakeList.txt file with the following rules. This is the file the vivaTracker project will be looking for while searching a new tracker implementation.

CMakeList.txt file content:
GET_FILENAME_COMPONENT(CURR_DIR_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)

FILE(GLOB files
	"*.h"
	"*.hpp"
	"*.cpp"
)

ADD_LIBRARY("${CURR_DIR_NAME}"  ${files})

Note that the new file content doesn't contain any specific details about the ncc name. It's an abstract template and should be used as the starting point to add any new tracker.

Then we append a cmake macro for our NCC implementation to the precomp.h.in file in the root folder

#cmakedefine WITH_NCC

Note: WITH_NCC: NCC is the same folder name but all in uppercase.

Finally, we will add the headers and source code files for our implementation to the same ncc folder. In this example we will be using only two files: "ncc.h" and "ncc.cpp" but there is no restriction in the amount of files you could insert.

Final folder structure should look like this

/
  trackers/
        ncc/   (<- new created folder)
            ncc.h
            ncc.cpp
            CMakeList.txt
   sequences/
   license/
   trackerlib/
   vivalib/
   ...

Configure and generate the vivaTracker project again to include and link the new ncc library/tracker to the vivaTracker project. Details of how configure and generate the project could be found here.

After succeeding the first step, we should continue with the Step 2.