Abstract
The study of animal behavior increasingly relies on (semi-) automatic methods for the extraction of relevant behavioral features from video or picture data. To date, several specialized software products exist to detect and track animals' positions in simple (laboratory) environments. Tracking animals in their natural environments, however, often requires substantial customization of the image processing algorithms to the problem-specific image characteristics. Here we introduce BioTracker, an open-source computer vision framework, that provides programmers with core functionalities that are essential parts of a tracking software, such as video I/O, graphics overlays and mouse and keyboard interfaces. BioTracker additionally provides a number of different tracking algorithms suitable for a variety of image recording conditions. The main feature of BioTracker is however the straightforward implementation of new problem-specific tracking modules and vision algorithms that can build upon BioTracker's core functionalities. With this open-source framework the scientific community can accelerate their research and focus on the development of new vision algorithms.
Introduction
In biological research, tracking animal movement is essential for understanding behavior. However, tracking is rarely a "one-size-fits-all" task; a setup designed for a single mouse in a white box is often unsuitable for a swarm of bees in a hive or fish in a murky pond. Historically, researchers faced a choice between specialized, rigid software or building custom solutions from scratch. The latter is inefficient, as a significant portion of the code—handling video streams, UI, and data export—is identical across projects. BioTracker addresses this by providing a robust, reusable "core" infrastructure, allowing developers to focus exclusively on the tracking algorithms themselves.
Methods and Architecture
BioTracker is built using C++11, leveraging OpenCV for image processing and Qt for the graphical user interface. Its architecture is modular, divided into four distinct components:
- Core: Manages plugin loading, video/camera streams, and the GUI (playback, zooming, and manual track correction).
- Tracking Module: The specific algorithm used, loaded dynamically as a plugin.
- Interfaces: The communication bridge between the Core and the Tracking Module.
- Utility: A library of helper functions to simplify module development.
Additionally, a Python-based Data Analysis Module allows users to import CSV data to calculate behavioral metrics such as velocity, acceleration, and inter-individual distances.
Key Insights and Results
BioTracker emphasizes the "separation of concerns," isolating vision logic from application logic to lower the barrier for computer scientists to contribute to biological research. A key practical feature is built-in coordinate rectification, which maps distorted camera pixels to real-world units (e.g., cm or mm), ensuring biological accuracy.
The framework supports "closed-loop" experiments where computer-controlled stimuli can react to animal movement in real-time. It also allows for manual track correction and annotation within the GUI, ensuring data quality even when automated algorithms struggle.
Demonstrations of the framework include tracking 11 Sulfur Mollies (Poecilia sulphuraria) in a laboratory setting using a Background Subtraction Tracker. The framework has also been applied to honey bees, bumblebees, and biomimetic robots. BioTracker is cross-platform (Windows, Linux, Mac) and ensures standardized output formats (.csv, JSON, binary) for streamlined downstream analysis.
Limitations and Future Work
While powerful, BioTracker's generic visualization was initially limited to points with direction vectors; support for complex shapes like polygons is a target for future development. Furthermore, while the GUI is accessible to biologists, creating new tracking modules requires C++ knowledge. The framework's long-term utility depends on community contributions of diverse, pre-built tracking modules for various species and environments.
Summary updated