Skip to content

Commit c824176

Browse files
authored
Merge pull request opencv#18068 from lionkunonly:gsoc_2020_simd
[GSoC] OpenCV.js: WASM SIMD optimization 2.0 * gsoc_2020_simd Add perf test for filter2d * add perf test for kernel scharr and kernel gaussianBlur * add perf test for blur, medianBlur, erode, dilate * fix the errors for the opencv PR robot fix the trailing whitespace. * add perf tests for kernel remap, warpAffine, warpPersepective, pyrDown * fix a bug in modules/js/perf/perf_imgproc/perf_remap.js * add function smoothBorder in helpfun.js and remove replicated function in perf test of warpAffine and warpPrespective * fix the trailing white space issues * add OpenCV.js loader * Implement the Loader with help of WebAssembly Feature Detection, remove trailing whitespaces * modify the explantion for loader in js_setup.markdown and fix bug in loader.js
1 parent bd19f99 commit c824176

36 files changed

+3502
-836
lines changed

doc/js_tutorials/js_setup/js_setup/js_setup.markdown

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ source ./emsdk_env.sh
3232
echo ${EMSCRIPTEN}
3333
@endcode
3434

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.
36+
37+
For example:
38+
@code{.bash}
39+
./emsdk update
40+
./emsdk install 1.39.16
41+
./emsdk activate 1.39.16
42+
@endcode
43+
3544
Obtaining OpenCV Source Code
3645
--------------------------
3746

@@ -76,6 +85,31 @@ Building OpenCV.js from Source
7685
python ./platforms/js/build_js.py build_wasm --build_wasm
7786
@endcode
7887

88+
-# [Optional] To build the OpenCV.js loader, append `--build_loader`.
89+
90+
For example:
91+
@code{.bash}
92+
python ./platforms/js/build_js.py build_js --build_loader
93+
@endcode
94+
95+
@note
96+
The loader is implemented as a js file in the path `<opencv_js_dir>/bin/loader.js`. The loader utilizes the [WebAssembly Feature Detection](https://github.com/GoogleChromeLabs/wasm-feature-detect) to detect the features of the broswer and load corresponding OpenCV.js automatically. To use it, you need to use the UMD version of [WebAssembly Feature Detection](https://github.com/GoogleChromeLabs/wasm-feature-detect) and introduce the `loader.js` in your Web application.
97+
98+
Example Code:
99+
@code{.javascipt}
100+
// Set paths configuration
101+
let pathsConfig = {
102+
wasm: "../../build_wasm/opencv.js",
103+
threads: "../../build_mt/opencv.js",
104+
simd: "../../build_simd/opencv.js",
105+
threadsSimd: "../../build_mtSIMD/opencv.js",
106+
}
107+
108+
// Load OpenCV.js and use the pathsConfiguration and main function as the params.
109+
loadOpenCV(pathsConfig, main);
110+
@endcode
111+
112+
79113
-# [optional] To build documents, append `--build_doc` option.
80114

81115
For example:

0 commit comments

Comments
 (0)