yarn
&
yarn dev
This optical flow demo implements the Lucas–Kanade method and performs realtime computation on the GPU using the GPU.js which transpiles JavaScript to GLSL.
As GPUs are designed to process four 8 bit color values (RGBA), this can be exploited to process any arbitrary array of 32 bit values, provided operations can be done in parallel. This lends itself nicely to image and video processing.
The sample footage is from the comma.ai speed challenge.
This is Part 1 of estimating vehicle speed from optical flow, which is a lot more complicated than I originally thought, and probably not the best approach.
Due to missing glibc
libraries on some deployment playforms, such as Vercel, it may be easier to deploy the dist
folder as a static site (rather than build from src
).
An installed pre-commit hook
will build the dist
folder on every git commit
to ensure a fresh build is deployed.