OpenCV (Open Source Computer Vision Library) is an open source computer vision and machine learning software library. OpenCV was built to provide a common infrastructure for computer vision applications and to accelerate the use of machine perception in commercial products. OpenCV is a powerful library used for image processing, analysis and image recognition. It has been used extensively in many fields, from face detection to interactive art.

With opencv.js it's possible to do image processing, video analysis and object detection in the browser! We used opencv.js to detect document in the camera stream. We could access to the camera in the browser with WebRTC and get a video stream, analyze that video with opencv.js and show analyzed video. It is great at taking frames out of the video and run algorithms to extract information. For example, using OpenCV would give us the mathematical tools required to capture images and track a particular object and its movement. This is not provided directly but the mathematical tools required to process the images to extract such information are available. We are able to detect the document and do with it many operations such as find its vertices, center coordinates, the average color, determine its shape and position. And all this happens in real time on the client-side. In general, we can detect the object and then determine its shape, color, position, draw on it a transparent layer, crop it, draw a border for it, etc. OpenCV can be compiled to WebAssembly (wasm) which will give even better performance and higher fps for videos.

The most important advantage of using opencv.js is that everything happens in client-side. So instead of taking an image in client-side then sending it to the server, then analyzing in the server, then sending it back to the client-side which takes a particular time we simply analyze the image in client-side which is, of course, more faster. This is why it's great for video analysis, especially for live camera streams. And it's possible also for mobile phone browsers. And so with a simple web application, it's possible to access and manipulate mobile phone camera stream, analyze it, get necessary info, do changes on it and render it.

OpenCV algorithms let you create many types of applications including face detection applications, shape detection applications like a circle, rectangle, etc., object recognition applications (e.g. document), security applications, an application requiring tracking object movements, the image editing application, etc.