Case // 08
Browser SLAM
Mapping a room with a phone camera, in plain JavaScript.
Fact sheet
An experiment in simultaneous localisation and mapping that runs in a mobile browser. Corner detection, optical-flow tracking and triangulation are written from scratch, fused with the phone's gyroscope, and drawn as a live 3D point cloud.
- Context
- R&D lab
- Role
- Research and development
- Team
- Solo
- Period
- 2026
- Status
- Prototype
- 0computer-vision libraries: every algorithm written by hand
- 4,000points kept in the live map
Challenge
01Understand visual odometry from first principles, without hiding the hard parts behind OpenCV, and make it run on a phone with nothing to install.
Approach
02Camera frames are converted to grayscale and scanned with a FAST-9 corner detector. Lucas-Kanade optical flow tracks the corners between frames. The gyroscope's rotation is subtracted from the flow to isolate translation, parallax gives depth by triangulation, and the landmarks feed a coloured point cloud and a trajectory rendered with Three.js. A small Python server provides the HTTPS, with a self-signed certificate, that browsers require before they open the camera.
Outcome
03A working prototype that maps its surroundings in real time on a phone, capped at 4,000 points to stay fluid, and a first-hand understanding of the computer-vision pipeline behind AR and robotics.
Architecture
SCHEMA- Device
- Phone cameraFrames via getUserMedia, HTTPS
- GyroscopeDeviceOrientation events
- Tracking
- FAST-9 cornersCorner detection, grayscale
- Lucas-KanadeOptical-flow tracking
- Estimation
- Motion estimateRotation removed, translation kept
- TriangulationDepth from parallax
- Map
- Point cloudUp to 4,000 coloured points
- Three.js viewMap and trajectory, orbit view
Swipe sideways to explore the diagram
What I did
- FAST-9 feature detection and Lucas-Kanade tracking implemented by hand
- Sensor fusion: gyroscope rotation removed from the optical-flow field
- Fallback heading estimate when no orientation sensor is available
- Real-time 3D map and trajectory with Three.js and orbit controls
Stack
- Front end
- JavaScript
- Canvas 2D
- getUserMedia
- DeviceOrientation
- 3D and graphics
- Three.js
- OrbitControls
- Back end
- Python HTTPS server
- cryptography (self-signed TLS)
Related services
Need something similar? These are the services this project demonstrates.
Get in touch