You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/js_tutorials/js_setup/js_intro/js_intro.markdown
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ OpenCV.js: OpenCV for the JavaScript programmer
13
13
14
14
Web is the most ubiquitous open computing platform. With HTML5 standards implemented in every browser, web applications are able to render online video with HTML5 video tags, capture webcam video via WebRTC API, and access each pixel of a video frame via canvas API. With abundance of available multimedia content, web developers are in need of a wide array of image and vision processing algorithms in JavaScript to build innovative applications. This requirement is even more essential for emerging applications on the web, such as Web Virtual Reality (WebVR) and Augmented Reality (WebAR). All of these use cases demand efficient implementations of computation-intensive vision kernels on web.
15
15
16
-
[Emscripten](http://kripken.github.io/emscripten-site) is an LLVM-to-JavaScript compiler. It takes LLVM bitcode - which can be generated from C/C++ using clang, and compiles that into asm.js or WebAssembly that can execute directly inside the web browsers. . Asm.js is a highly optimizable, low-level subset of JavaScript. Asm.js enables ahead-of-time compilation and optimization in JavaScript engine that provide near-to-native execution speed. WebAssembly is a new portable, size- and load-time-efficient binary format suitable for compilation to the web. WebAssembly aims to execute at native speed. WebAssembly is currently being designed as an open standard by W3C.
16
+
[Emscripten](https://emscripten.org/) is an LLVM-to-JavaScript compiler. It takes LLVM bitcode - which can be generated from C/C++ using clang, and compiles that into asm.js or WebAssembly that can execute directly inside the web browsers. . Asm.js is a highly optimizable, low-level subset of JavaScript. Asm.js enables ahead-of-time compilation and optimization in JavaScript engine that provide near-to-native execution speed. WebAssembly is a new portable, size- and load-time-efficient binary format suitable for compilation to the web. WebAssembly aims to execute at native speed. WebAssembly is currently being designed as an open standard by W3C.
17
17
18
18
OpenCV.js is a JavaScript binding for selected subset of OpenCV functions for the web platform. It allows emerging web applications with multimedia processing to benefit from the wide variety of vision functions available in OpenCV. OpenCV.js leverages Emscripten to compile OpenCV functions into asm.js or WebAssembly targets, and provides a JavaScript APIs for web application to access them. The future versions of the library will take advantage of acceleration APIs that are available on the Web such as SIMD and multi-threaded execution.
19
19
@@ -42,4 +42,4 @@ Below is the list of contributors of OpenCV.js bindings and tutorials.
42
42
- Gang Song (GSoC student, Shanghai Jiao Tong University)
43
43
- Wenyao Gan (Student intern, Shanghai Jiao Tong University)
44
44
- Mohammad Reza Haghighat (Project initiator & sponsor, Intel Corporation)
45
-
- Ningxin Hu (Students' supervisor, Intel Corporation)
45
+
- Ningxin Hu (Students' supervisor, Intel Corporation)
Copy file name to clipboardExpand all lines: doc/js_tutorials/js_setup/js_setup/js_setup.markdown
+33-28Lines changed: 33 additions & 28 deletions
Original file line number
Diff line number
Diff line change
@@ -7,12 +7,12 @@ You don't have to build your own copy if you simply want to start using it. Refe
7
7
Installing Emscripten
8
8
-----------------------------
9
9
10
-
[Emscripten](https://github.com/kripken/emscripten) is an LLVM-to-JavaScript compiler. We will use Emscripten to build OpenCV.js.
10
+
[Emscripten](https://github.com/emscripten-core/emscripten) is an LLVM-to-JavaScript compiler. We will use Emscripten to build OpenCV.js.
11
11
12
12
@note
13
13
While this describes installation of required tools from scratch, there's a section below also describing an alternative procedure to perform the same build using docker containers which is often easier.
14
14
15
-
To Install Emscripten, follow instructions of [Emscripten SDK](https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html).
15
+
To Install Emscripten, follow instructions of [Emscripten SDK](https://emscripten.org/docs/getting_started/downloads.html).
16
16
17
17
For example:
18
18
@code{.bash}
@@ -21,24 +21,29 @@ For example:
21
21
./emsdk activate latest
22
22
@endcode
23
23
24
-
@note
25
-
To compile to [WebAssembly](http://webassembly.org), you need to install and activate [Binaryen](https://github.com/WebAssembly/binaryen) with the `emsdk` command. Please refer to [Developer's Guide](http://webassembly.org/getting-started/developers-guide/) for more details.
26
24
27
-
After install, ensure the `EMSCRIPTEN` environment is setup correctly.
25
+
After install, ensure the `EMSDK` environment is setup correctly.
28
26
29
27
For example:
30
28
@code{.bash}
31
29
source ./emsdk_env.sh
32
-
echo ${EMSCRIPTEN}
30
+
echo ${EMSDK}
31
+
@endcode
32
+
33
+
Modern versions of Emscripten requires to use `emcmake` / `emmake` launchers:
34
+
35
+
@code{.bash}
36
+
emcmake sh -c 'echo ${EMSCRIPTEN}'
33
37
@endcode
34
38
35
-
The version 1.39.16 of emscripten is verified for latest WebAssembly. Please check the version of emscripten to use the newest features of WebAssembly.
39
+
40
+
The version 2.0.10 of emscripten is verified for latest WebAssembly. Please check the version of Emscripten to use the newest features of WebAssembly.
The default threads number is the logic core number of your device. You can use `cv.parallel_pthreads_set_threads_num(number)` to set threads number by yourself and use `cv.parallel_pthreads_get_threads_num()` to get the current threads number.
To run performance tests, launch a local web server in \<build_dir\>/bin folder. For example, node http-server which serves on `localhost:8080`.
@@ -271,36 +275,37 @@ Building OpenCV.js with Docker
271
275
272
276
Alternatively, the same build can be can be accomplished using [docker](https://www.docker.com/) containers which is often easier and more reliable, particularly in non linux systems. You only need to install [docker](https://www.docker.com/) on your system and use a popular container that provides a clean well tested environment for emscripten builds like this, that already has latest versions of all the necessary tools installed.
273
277
274
-
So, make sure [docker](https://www.docker.com/) is installed in your system and running. The following shell script should work in linux and MacOS:
278
+
So, make sure [docker](https://www.docker.com/) is installed in your system and running. The following shell script should work in Linux and MacOS:
The example uses latest version of emscripten. If the build fails you should try a version that is known to work fine which is `1.38.32` using the following command:
293
+
The example uses latest version of emscripten. If the build fails you should try a version that is known to work fine which is `2.0.10` using the following command:
Copy file name to clipboardExpand all lines: doc/js_tutorials/js_setup/js_usage/js_usage.markdown
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -129,12 +129,12 @@ function onOpenCvReady() {
129
129
</html>
130
130
@endcode
131
131
132
-
@note You have to call delete method of cv.Mat to free memory allocated in Emscripten's heap. Please refer to [Memory management of Emscripten](https://kripken.github.io/emscripten-site/docs/porting/connecting_cpp_and_javascript/embind.html#memory-management) for details.
132
+
@note You have to call delete method of cv.Mat to free memory allocated in Emscripten's heap. Please refer to [Memory management of Emscripten](https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html#memory-management) for details.
parser.add_argument('--opencv_dir', default=opencv_dir, help='Opencv source directory (default is "../.." relative to script location)')
217
-
parser.add_argument('--emscripten_dir', default=emscripten_dir, help="Path to Emscripten to use for build")
221
+
parser.add_argument('--emscripten_dir', default=emscripten_dir, help="Path to Emscripten to use for build (deprecated in favor of 'emcmake' launcher)")
218
222
parser.add_argument('--build_wasm', action="store_true", help="Build OpenCV.js in WebAssembly format")
219
223
parser.add_argument('--disable_wasm', action="store_true", help="Build OpenCV.js in Asm.js format")
220
224
parser.add_argument('--threads', action="store_true", help="Build OpenCV.js with threads optimization")
delos.environ['EMMAKEN_JUST_CONFIGURE'] # avoid linker errors with NODERAWFS message then using 'emcmake' launcher
251
+
246
252
ifargs.emscripten_dirisNone:
247
-
log.info("Cannot get Emscripten path, please specify it either by EMSCRIPTEN environment variable or --emscripten_dir option.")
253
+
log.error("Cannot get Emscripten path, please use 'emcmake' launcher or specify it either by EMSCRIPTEN environment variable or --emscripten_dir option.")
0 commit comments