{"id":21355157,"url":"https://github.com/echamudi/opencv-wasm","last_synced_at":"2025-04-04T16:13:23.638Z","repository":{"id":42877805,"uuid":"256758398","full_name":"echamudi/opencv-wasm","owner":"echamudi","description":"Precompiled OpenCV 4.3.0 to JavaScript + WebAssembly for node and deno. 🦕","archived":false,"fork":false,"pushed_at":"2022-12-30T20:17:54.000Z","size":5842,"stargazers_count":326,"open_issues_count":18,"forks_count":37,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-28T15:06:00.820Z","etag":null,"topics":["deno","javascript","node","opencv","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/opencv-wasm","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/echamudi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-18T13:18:32.000Z","updated_at":"2025-03-18T03:29:46.000Z","dependencies_parsed_at":"2023-01-31T15:30:19.586Z","dependency_job_id":null,"html_url":"https://github.com/echamudi/opencv-wasm","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/echamudi%2Fopencv-wasm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/echamudi%2Fopencv-wasm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/echamudi%2Fopencv-wasm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/echamudi%2Fopencv-wasm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/echamudi","download_url":"https://codeload.github.com/echamudi/opencv-wasm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247208139,"owners_count":20901570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deno","javascript","node","opencv","typescript"],"created_at":"2024-11-22T04:15:55.223Z","updated_at":"2025-04-04T16:13:23.615Z","avatar_url":"https://github.com/echamudi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenCV-Wasm\n\n[![Build Status](https://travis-ci.org/echamudi/opencv-wasm.svg?branch=master)](https://travis-ci.org/echamudi/opencv-wasm)\n\nPrecompiled OpenCV to JavaScript + WebAssembly for node.js and deno environment. 🦕\n\nIn 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`).\n\nThis module has zero dependencies.\n\n## Examples\n\n| Code | Input | Output |\n|---|---|---|\n| [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) |\n| [templateMatching.js](https://github.com/echamudi/opencv-wasm/blob/master/examples/templateMatching.js) (node) | source:\u003cbr\u003e![image sample 2](https://github.com/echamudi/opencv-wasm/blob/master/examples/input/image-sample-2.png?raw=true) \u003cbr\u003etemplate:\u003cbr\u003e ![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) |\n\n## Installation\n\n### node\n\n```\nnpm install opencv-wasm\n```\nCode example:\n```js\nconst { cv, cvTranslateError } = require('opencv-wasm');\n\nlet mat = cv.matFromArray(2, 3, cv.CV_8UC1, [1, 2, 3, 4, 5, 6]);\nconsole.log('cols =', mat.cols, '; rows =', mat.rows);\nconsole.log(mat.data8S);\n\ncv.transpose(mat, mat);\nconsole.log('cols =', mat.cols, '; rows =', mat.rows);\nconsole.log(mat.data8S);\n\n/*\ncols = 3 ; rows = 2\nInt8Array(6) [ 1, 2, 3, 4, 5, 6 ]\ncols = 2 ; rows = 3\nInt8Array(6) [ 1, 4, 2, 5, 3, 6 ]\n*/\n```\n\n### deno\n\n```ts\nimport { cv, cvTranslateError } from 'https://deno.land/x/opencv@v4.3.0-10/mod.ts';\n// Change the @\u003cversion\u003e with the latest or any version you desire.\n// Check the available versions here: https://deno.land/x/opencv.\n```\nCode example:\n```ts\nimport { cv, cvTranslateError } from 'https://deno.land/x/opencv@v4.3.0-10/mod.ts';\n\nlet mat = cv.matFromArray(2, 3, cv.CV_8UC1, [1, 2, 3, 4, 5, 6]);\nconsole.log('cols =', mat.cols, '; rows =', mat.rows);\nconsole.log(mat.data8S);\n\ncv.transpose(mat, mat);\nconsole.log('cols =', mat.cols, '; rows =', mat.rows);\nconsole.log(mat.data8S);\n\n/*\ncols = 3 ; rows = 2\nInt8Array(6) [ 1, 2, 3, 4, 5, 6 ]\ncols = 2 ; rows = 3\nInt8Array(6) [ 1, 4, 2, 5, 3, 6 ]\n*/\n```\n\n## Usage\n\nBecause 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\n\nThere are some minor initialization changes, because this module will be loaded synchronously instead of the OpenCV's default (asynchronously). \n\nYou can check the files inside [examples](https://github.com/echamudi/opencv-wasm/tree/master/examples) folder as reference on how to initialize, loading images, and saving images.\n\n## Error Handling\n\nBy default, mistakes in code will produce error code. You can use the following snippet to translate the error code into meaningful statement from OpenCV.\n\n```js\nconst { cv, cvTranslateError } = require('opencv-wasm');\n\ntry {\n    // Your OpenCV code\n} catch (err) {\n    console.log(cvTranslateError(cv, err));\n}\n```\n\n## Versioning\n\nThis npm module uses the following versioning number:\n```\n\u003copencv version\u003e-\u003cthis module version\u003e\n```\nFor Example\n```\n4.3.0-9\nOpenCV version 4.3.0\nOpenCV-Wasm Module version 9\n```\n\n## Development\n\n### Building\n\nRun the following script on macOS or Linux (tested on Ubuntu). You need docker on the system.\n\n```\nnpm install\n(cd ./utils \u0026\u0026 sh ./build.sh)\n(cd utils \u0026\u0026 node generateCvProps.js)\n```\n\n### Testing\n\nAfter completing the build script, you can run the test provided by OpenCV, and the test from this repo.\n\n```sh\n# OpenCV's test\n(cd ./build_wasm_test/bin \u0026\u0026 npm install)\n(cd ./build_wasm_test/bin \u0026\u0026 node tests.js)\n\n# This repo's test\nnpm test\n```\n\n## Authors\n\n* **Ezzat Chamudi** - [echamudi](https://github.com/echamudi)\n\nSee also the list of [contributors](https://github.com/echamudi/opencv-wasm/graphs/contributors) who participated in this project.\n\n## License\n\nCopyright © 2020 [Ezzat Chamudi](https://github.com/echamudi) and [OpenCV-Wasm Project Authors](https://github.com/echamudi/opencv-wasm/graphs/contributors)\n\nOpenCV-Wasm code is licensed under [BSD-3-Clause](https://opensource.org/licenses/BSD-3-Clause). Images, logos, docs, and articles in this project are released under [CC-BY-SA-4.0](https://creativecommons.org/licenses/by-sa/4.0/legalcode).\n\n[OpenCV License](https://opencv.org/license/).\n\nLibraries, dependencies, and tools used in this project are tied with their licenses.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fechamudi%2Fopencv-wasm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fechamudi%2Fopencv-wasm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fechamudi%2Fopencv-wasm/lists"}