Bird Tracking

Finding and following birds and other small things in the sky from a phone's camera, built and measured in a simulator first.

where the tracker says it iswhere it will be in a second

What this is

A bird a hundred metres away is a few dark pixels in a phone's picture. This project works out how a phone can still find them, follow them, and say where they are heading, while the person holding it turns their head.

It has two parts. A simulator flies birds and other targets by their physics and draws the picture an iPhone 15 Pro's ultra-wide camera would take, so every idea can be measured against the truth. BirdTrack is the tracker itself, a single file with no dependencies that runs in any web page. It started as the Bird tracker in VR Portal.

Try it

How well it works

Every version is measured on the same 48 simulated flights: a pigeon, a crow, a gull and four other small flying shapes of different sizes and speeds, each on several paths. A right sighting means the tracker had the target that moment; a false one means it had something that was not there.

VersionRight sightingsFalse, per 100 looksBox error
VR Portal's tracker as it was16.4%1.43.70°
VR Portal's tracker, improved34.1%1.90.80°
BirdTrack 0.122.1%0.00.50°
BirdTrack 0.227.4%0.00.20°
BirdTrack 0.345.9%0.00.25°
BirdTrack 0.451.3%0.10.20°

Box error is the median, over flights, of how far the tracker's box was from the target's centre. These results come from the simulator on a desktop computer, not from a phone.

What changed, version by version

  1. The tracker became a library of its own, finding things that moved against the sky after allowing for the camera's own turn, and learning the lens's width and the camera's delay from the pictures.
  2. A finer picture for tiny targets, faint sightings kept when their path is steady, and things that hover found once the head turns a little. Marks on the lens are ignored.
  3. Matching sightings to targets with windows scaled to how fast each can move. A bird circling the person had been starting a new target at every sighting.
  4. Two methods at once, a motion finder and a spot finder, their sightings merged. Any other recogniser's boxes can be added.

Which method sees what

Each method measured on its own: the share of moments it saw the bird.

TargetMotionSpotsPhone's recogniser
Crow84%78%2%
Gull78%66%1%
Pigeon78%72%0%

The phone's built-in object recogniser was made for larger things and rarely sees targets this small.

Use the tracker

Give it the camera's turn as often as it is known, and each picture as it arrives. It gives back every target it is following.

const bt = BirdTrack.create({ across: 100, aspect: 9 / 16 });
bt.head(timeMs, quaternion);              // from the phone's motion sensor
const targets = bt.frame(video, timeMs);  // a video, a canvas, or plain pixels
// each target: where it is, its velocity, where it will be, which methods saw it

Install it in another project with npm install github:tbirdpower3000/Bird-Tracking, or copy birdtrack.js.

Read more