Skip to content

CJKu/opencv

 
 

Repository files navigation

OpenCV with Emscripten

In this branch, we are going to combine opencv with emscripten to enable opencv's rich features in javascript's world.

We are going to

  1. Export Mat by Embinding. (Working)
  2. Export the first layer modules by Embinding.

Setup Emscripten

Emscripten installation guide from Emscripten.org

Version 1.29 and above is recommended for better performance.

Compile

At the root folder of opencv source code.
$ mkdir jsobj
$ cd jsobj
$ emcmake cmake ..
$ emmake make

You will find opencv.js in ${jsobj}/lib folder. By Including this js library in HTML or require it in js, you can start using opencv.

Run

You may use opencv.js in firefox/ chrome or node.js.

In node.js

$ node
> var Module = require('./opencv.js');
> var mat = new Module.Mat(10, 10, Module.CV_8UC3)
> mat.channels()
3

Test

JS test suite is put in module/js/test. There are many tests in test suite, and those tests are good reference of how to using opencv module by javascript.

Sample

I am constructing a js app, in sample/js folder, which demostrate the usage of image-proc module.

Next step

  1. Automatic binding code generator. I don't want to manually generate bind code for each function that we want to export onto javascript.
  2. Matrix operation.(MatExpr)

About

Open Source Computer Vision Library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 83.9%
  • Cuda 5.9%
  • C 3.0%
  • Java 2.5%
  • CMake 2.1%
  • Python 1.7%
  • Other 0.9%