All Projects → echamudi → Opencv Wasm

echamudi / Opencv Wasm

Licence: bsd-3-clause
Precompiled OpenCV 4.3.0 to JavaScript + WebAssembly for node and deno. 🦕

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to Opencv Wasm

Learningopencv
Source code for Learning OpenCV 《学习OpenCV》源码及 Mac 运行工程
Stars: ✭ 57 (-12.31%)
Mutual labels:  opencv
Colorfilters
Image thresholding in multiple colorspaces.
Stars: ✭ 60 (-7.69%)
Mutual labels:  opencv
Repo 2017
Python codes in Machine Learning, NLP, Deep Learning and Reinforcement Learning with Keras and Theano
Stars: ✭ 1,123 (+1627.69%)
Mutual labels:  opencv
Color Transfer Between Images
This is the open-source implement the paper "Color Transfer between Images" by Erik Reinhard, Michael Ashikhmin, Bruce Gooch and Peter Shirley.
Stars: ✭ 56 (-13.85%)
Mutual labels:  opencv
Catt
Detecting the temperature from an infrared image
Stars: ✭ 60 (-7.69%)
Mutual labels:  opencv
Mhxy
tensorflow实践:梦幻西游人物弹窗识别
Stars: ✭ 60 (-7.69%)
Mutual labels:  opencv
Beautifulgirls
爬虫+脸部识别+DCGAN脸部自动生成
Stars: ✭ 56 (-13.85%)
Mutual labels:  opencv
Sign Language
Sign Language Recognition for Deaf People
Stars: ✭ 65 (+0%)
Mutual labels:  opencv
Head Pose Estimator.caffe
Head Pose Estimator on Caffe
Stars: ✭ 60 (-7.69%)
Mutual labels:  opencv
Boss Detector
Change monitor screen when your boss is coming towards you!
Stars: ✭ 63 (-3.08%)
Mutual labels:  opencv
Overhead Camera People Counter
People counting algorithm using an overhead video camera
Stars: ✭ 58 (-10.77%)
Mutual labels:  opencv
Opencv Mtcnn
An implementation of MTCNN Face detector using OpenCV's DNN module
Stars: ✭ 59 (-9.23%)
Mutual labels:  opencv
Python Laser Tracker
A simple laser tracker using Python and OpenCV.
Stars: ✭ 61 (-6.15%)
Mutual labels:  opencv
Rpindvi
Raspberry PI NDVI Code
Stars: ✭ 57 (-12.31%)
Mutual labels:  opencv
Sitting Posture Recognition
Detects the sitting position of a person
Stars: ✭ 64 (-1.54%)
Mutual labels:  opencv
Handgesture
基于Qt框架的手势识别程序,其中主要是用到了Opencv中的训练算法!属于本科水平的小项目,没有太完善!后期有空再弄吧!😄
Stars: ✭ 56 (-13.85%)
Mutual labels:  opencv
Vehicle Detection And Tracking
Udacity Self-Driving Car Engineer Nanodegree. Project: Vehicle Detection and Tracking
Stars: ✭ 60 (-7.69%)
Mutual labels:  opencv
Opencv 3.2.0 Compiling On Raspberry Pi
Download, Compile, Build, and Install OpenCV 3.2.0 with Extra Modules on RPI running Jessie
Stars: ✭ 65 (+0%)
Mutual labels:  opencv
Mobilnet ssd opencv
MobilNet-SSD object detection in opencv 3.4.1
Stars: ✭ 64 (-1.54%)
Mutual labels:  opencv
Ai Thermometer
Fever screening with IR & RGB cameras and Deep CNNs
Stars: ✭ 60 (-7.69%)
Mutual labels:  opencv

OpenCV-Wasm

Build Status

Precompiled OpenCV to JavaScript + WebAssembly for node.js and deno environment. 🦕

In this Wasm-compiled OpenCV, there's no need to have OpenCV installed in the machine. The entire OpenCV library is already inside this package (opencv.js and opencv.wasm).

This module has zero dependencies.

Examples

Code Input Output
dilation.js (node) image sample 1 dilation
templateMatching.js (node) source:
image sample 2
template:
image sample 2 template
template matching

Installation

node

npm install opencv-wasm

Code example:

const { cv, cvTranslateError } = require('opencv-wasm');

let mat = cv.matFromArray(2, 3, cv.CV_8UC1, [1, 2, 3, 4, 5, 6]);
console.log('cols =', mat.cols, '; rows =', mat.rows);
console.log(mat.data8S);

cv.transpose(mat, mat);
console.log('cols =', mat.cols, '; rows =', mat.rows);
console.log(mat.data8S);

/*
cols = 3 ; rows = 2
Int8Array(6) [ 1, 2, 3, 4, 5, 6 ]
cols = 2 ; rows = 3
Int8Array(6) [ 1, 4, 2, 5, 3, 6 ]
*/

deno

import { cv, cvTranslateError } from 'https://deno.land/x/[email protected]/mod.ts';
// Change the @<version> with the latest or any version you desire.
// Check the available versions here: https://deno.land/x/opencv.

Code example:

import { cv, cvTranslateError } from 'https://deno.land/x/[email protected]/mod.ts';

let mat = cv.matFromArray(2, 3, cv.CV_8UC1, [1, 2, 3, 4, 5, 6]);
console.log('cols =', mat.cols, '; rows =', mat.rows);
console.log(mat.data8S);

cv.transpose(mat, mat);
console.log('cols =', mat.cols, '; rows =', mat.rows);
console.log(mat.data8S);

/*
cols = 3 ; rows = 2
Int8Array(6) [ 1, 2, 3, 4, 5, 6 ]
cols = 2 ; rows = 3
Int8Array(6) [ 1, 4, 2, 5, 3, 6 ]
*/

Usage

Because this module is using the same code as the official OpenCV.js for the web, you can use the same documentation at the web: https://docs.opencv.org/4.3.0/d5/d10/tutorial_js_root.html

There are some minor initialization changes, because this module will be loaded synchronously instead of the OpenCV's default (asynchronously).

You can check the files inside examples folder as reference on how to initialize, loading images, and saving images.

Error Handling

By default, mistakes in code will produce error code. You can use the following snippet to translate the error code into meaningful statement from OpenCV.

const { cv, cvTranslateError } = require('opencv-wasm');

try {
    // Your OpenCV code
} catch (err) {
    console.log(cvTranslateError(cv, err));
}

Versioning

This npm module uses the following versioning number:

<opencv version>-<this module version>

For Example

4.3.0-9
OpenCV version 4.3.0
OpenCV-Wasm Module version 9

Development

Building

Run the following script on macOS or Linux (tested on Ubuntu). You need docker on the system.

npm install
(cd ./utils && sh ./build.sh)
(cd utils && node generateCvProps.js)

Testing

After completing the build script, you can run the test provided by OpenCV, and the test from this repo.

# OpenCV's test
(cd ./build_wasm_test/bin && npm install)
(cd ./build_wasm_test/bin && node tests.js)

# This repo's test
npm test

Authors

See also the list of contributors who participated in this project.

License

Copyright © 2020 Ezzat Chamudi and OpenCV-Wasm Project Authors

OpenCV-Wasm code is licensed under BSD-3-Clause. Images, logos, docs, and articles in this project are released under CC-BY-SA-4.0.

OpenCV License.

Libraries, dependencies, and tools used in this project are tied with their licenses.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].