How to set up OpenCV.js

Ran (Reine)
Analytics Vidhya
Published in
3 min readMar 15, 2020

--

(With detailed instructions for compiling from source)

Photo by Clément H on Unsplash

OpenCV.js was created to help with the adaptability of OpenCV in web development. However, I (personally) find that the documentation online and from their official platform is rather uhh…ambiguous so here’s an outline for setting up OpenCV.js that hopefully helps :) There’s be two parts to this — Part I would be an outline of how to use it without compiling from source and Part II would be for people who have too much time to kill (AKA compiling from source) (I’m kidding, please don’t hate me internet — I’m just salty about how much time I spent trying to figure it out). Here goes:

PART I (Use directly without compiling)

Basically you just download the opencv.js file and then include it in the js directory of your project so with a directory like this:

└── openCV_JS    ├── README.md    ├── index.html    └── js        └── opencv.js

As for the opencv.js file, I used this version: https://docs.opencv.org/4.0.1/opencv.js but other versions are known to work too or there’s a nightly build at https://docs.opencv.org/master/opencv.js.

--

--

Ran (Reine)
Analytics Vidhya

I live for days when I can watch skies of blue, while enjoying the view. Most other days I’m a city rat who scuttles between Art and Coding. SG NTU CS Grad.