eskiuv0.12.0
Package

vision

The computer vision core of a visual-inertial tracker, in Eskiu with no C library beyond libm. It comes from tinyvio, ReactVision's tracker behind ViroReact's web AR, and computes the same bits as tinyvio's C++. Over 200,000 cases compared bit for bit with the C++, 0 mismatches.

The repository is private for now. This page describes what the package does and how it was checked.

What it does

An example

Corners in one frame, followed into the next with Lucas-Kanade flow:

import <list>;
import <vision/image>;
import <vision/fast>;
import <vision/klt>;

ImageRef first = a.ref();
FastConfig fast;
List<Corner> corners;
vision_fast(&first, &fast, &corners);

List<V2> from;
for (i in 0..corners.size) from.push(corners.data[i].px);
Pyramid pa;
Pyramid pb;
pa.build(first, 3);
pb.build(b.ref(), 3);
KltConfig klt;
List<FlowResult> flow;
vision_klt_track(&pa, &pb, from.data, from.size, null, 0, &klt, &flow);
// flow.data[i].ok() and flow.data[i].px: where corner i went

Every config struct carries the defaults of the original, so KltConfig klt; is a working setup. On two test frames the example prints 152 corners, 150 tracked, median motion (5.00, -2.00) px.

Same bits as the C++

The package's tests link tinyvio's C++ core, pinned at a commit and built with -ffp-contract=off as its WebAssembly builds are, against each module, and compare every output bit for bit on frames and an IMU stream rendered for the test. They run on every commit:

ModuleCasesMismatches
geometry110,3840
klt73,7240
descriptors16,6740
plane6,3000
imu4,7820
direct3,7680
bundle1,5000
calibrate3000
fast1500

Two things a C++ build does implicitly are made explicit. Tied elements are ordered as libc++ orders them, since Eskiu's <sort> is libc++'s algorithm. And sin and cos of one angle go through one sincos call on Apple platforms, as clang merges them there.

Where it runs

vision is pure Eskiu, so it builds wherever Eskiu does: its tests run on macOS, Linux and Windows, and it cross-compiles for iOS, Android (arm64, armv7, x86_64) and WebAssembly. The results are the same bits on every platform whose C library rounds sin, cos and the other math functions the same way.

The same code, under tinyvio's own names, is tinyvio's Eskiu engine. Replaying a recording through its C API gives the same output as the C++ engine on macOS, WebAssembly, the iOS simulator and the Android emulator. See the ReactVision case study.

Start in a minute.

Install the compiler with one command, or run a program in the browser first.