Skip to main content

Feature Tracker

Description

The Feature Tracker demo application showcases Ocean's capabilities in tracking planar patterns, such as posters or images. The application offers flexibility in its input source, allowing users to select either a webcam or a video/movie file. Additionally, a simple image can be designated as the tracking pattern.

Image: The feature tracker app on android

The renowned SIFT image features are used to extract salient points on the tracking pattern (the image). The tracker detects and tracks these points reliably. The area of the tracking pattern is marked by a virtual bounding box that is aligned with the printout. Note the small coordinate system in one corner of the visualization. The red, green, and blue axes represent the x, y, and z axes, respectively. The performance of the tracker is displayed in the upper left corner, measured in milliseconds.

To try this demo you'll need to print or display the pattern image used above. A copy of it can be found here.

Building

Ensure the third-party libraries have been built for Android for all of the required Android ABIs. Let's assume the base location for third-party libraries is ${HOME}/install_ocean_thirdparty, i.e., the Android versions will be located in ${HOME}/install_ocean_thirdparty/android_${ANDROID_ABI}....

# Define this so that Gradle (and CMake) can find the third-party libraries.
export OCEAN_THIRDPARTY_PATH="${HOME}/install_ocean_thirdparty"

# Change into the directory with the Gradle config of this project
cd ${OCEAN_DEVELOPMENT_PATH}/build/gradle/application/ocean/demo/tracking/featuretracker/android

# In ./app/build.gradle.kts, ensure that only those Android ABIs are enabled for which the corresponding third-party libraries have been built. Otherwise, your build will fail, cf. the [general build instructions](https://github.com/facebookresearch/ocean/blob/v1.0.0/building_for_android.md#4-building-the-ocean-android-demotest-apps).

# Build the debug and release APK of this
./gradlew assemble

# Install the desired APK
adb install app/build/outputs/apk/debug/app-debug.apk
adb install app/build/outputs/apk/release/app-release.apk

By default, the log output will be displayed on the screen of the phone as well as in the Android logs, which can be displayed using:

adb logcat -s Ocean