opencv-wasm
Advanced tools
Comparing version 4.3.0-9.alpha.6 to 4.3.0-10
@@ -13,2 +13,2 @@ import * as OpenCV from './types/opencv'; | ||
*/ | ||
export function cvTranslateError(cvObject: typeof OpenCV, err: any): string | Error; | ||
export function cvTranslateError(cvObject: typeof OpenCV, err: any): string | Error | undefined; |
@@ -7,3 +7,3 @@ module.exports = { | ||
let errorStatement; | ||
let errorStatement = undefined; | ||
@@ -10,0 +10,0 @@ if (typeof err === 'undefined') { |
@@ -1,3 +0,3 @@ | ||
import * as OpenCV from 'https://unpkg.com/opencv-wasm@4.3.0-9.alpha.6/types/opencv.ts'; | ||
import {cv as _cv} from 'https://unpkg.com/opencv-wasm@4.3.0-9.alpha.6/opencv-deno.js'; | ||
import * as OpenCV from 'https://unpkg.com/opencv-wasm@4.3.0-10/types/opencv.ts'; | ||
import {cv as _cv} from 'https://unpkg.com/opencv-wasm@4.3.0-10/opencv-deno.js'; | ||
@@ -4,0 +4,0 @@ export const cv: typeof OpenCV = _cv; |
{ | ||
"name": "opencv-wasm", | ||
"version": "4.3.0-9.alpha.6", | ||
"version": "4.3.0-10", | ||
"description": "Precompiled OpenCV 4.3.0 to JavaScript + WebAssembly for node.js environment", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,6 +5,8 @@ # OpenCV-Wasm | ||
Precompiled OpenCV 4.3.0 to JavaScript + WebAssembly for node.js environment. | ||
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. | ||
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 | ||
@@ -14,10 +16,59 @@ | ||
|---|---|---| | ||
| [dilation.js](https://github.com/echamudi/opencv-wasm/blob/master/examples/dilation.js) | ![image sample 1](https://github.com/echamudi/opencv-wasm/blob/master/examples/input/image-sample-1.jpg?raw=true) | ![dilation](https://github.com/echamudi/opencv-wasm/blob/master/examples/expected-output/dilation.png?raw=true) | | ||
| [templateMatching.js](https://github.com/echamudi/opencv-wasm/blob/master/examples/templateMatching.js) | source:<br>![image sample 2](https://github.com/echamudi/opencv-wasm/blob/master/examples/input/image-sample-2.png?raw=true) <br>template:<br> ![image sample 2 template](https://github.com/echamudi/opencv-wasm/blob/master/examples/input/image-sample-2-template.png?raw=true) | ![template matching](https://github.com/echamudi/opencv-wasm/blob/master/examples/expected-output/template-matching.png?raw=true) | | ||
| [dilation.js](https://github.com/echamudi/opencv-wasm/blob/master/examples/dilation.js) (node)| ![image sample 1](https://github.com/echamudi/opencv-wasm/blob/master/examples/input/image-sample-1.jpg?raw=true) | ![dilation](https://github.com/echamudi/opencv-wasm/blob/master/examples/expected-output/dilation.png?raw=true) | | ||
| [templateMatching.js](https://github.com/echamudi/opencv-wasm/blob/master/examples/templateMatching.js) (node) | source:<br>![image sample 2](https://github.com/echamudi/opencv-wasm/blob/master/examples/input/image-sample-2.png?raw=true) <br>template:<br> ![image sample 2 template](https://github.com/echamudi/opencv-wasm/blob/master/examples/input/image-sample-2-template.png?raw=true) | ![template matching](https://github.com/echamudi/opencv-wasm/blob/master/examples/expected-output/template-matching.png?raw=true) | | ||
## Installation | ||
### node | ||
``` | ||
npm install opencv-wasm | ||
``` | ||
Code example: | ||
```js | ||
const { cv, cvTranslateError } = require('./index.js'); | ||
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 | ||
```ts | ||
import { cv, cvTranslateError } from 'https://deno.land/x/opencv@v4.3.0-10/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: | ||
```ts | ||
import { cv, cvTranslateError } from 'https://deno.land/x/opencv@v4.3.0-10/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 | ||
@@ -53,5 +104,5 @@ | ||
``` | ||
4.3.0-1 | ||
4.3.0-9 | ||
OpenCV version 4.3.0 | ||
OpenCV-Wasm Module version 1 | ||
OpenCV-Wasm Module version 9 | ||
``` | ||
@@ -58,0 +109,0 @@ |
17104371
145