opencvjsのインストールメモ

インストール環境
macOS 10.15.7 (Catalina)
■opencvjsのインストール
(参考 https://docs.opencv.org/3.4.1/d4/da1/tutorial_js_setup.html)
1)emssdkのインストール
(参考 https://emscripten.org/docs/getting_started/downloads.html)
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
git pull
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh
./emsdk install latest
- OpenCV Source Code
(参考 https://docs.opencv.org/3.4.1/d4/da1/tutorial_js_setup.html)
git clone https://github.com/opencv/opencv.git
cd opencv
python3 ./platforms/js/build_js.py build_wasm --build_wasm
(--build_wasmオプションがないとasm.jsでビルドされてしまう)
python3 ./platforms/js/build_js.py build_js --build_doc
python3 ./platforms/js/build_js.py build_js --build_test
途中、make: *** [opencv.js] Error 2 で失敗
--memory-init-file このパラメータは今は使えないとのこと。
opencvのソースの中を検索し、これを削除(3箇所かな?)
途中、下記が無いとのことでインストール
brew install cmake
brew install doxygen
(参考 https://stupiddog.jp/note/archives/913)

・build_wasm
=====
===== Build finished
=====
OpenCV.js location: /Users/xxx/xxx/xxx/opencvjs_nanda/opencv/build_js/bin/opencv.js
・build_doc
=====
===== Build finished
=====
OpenCV.js location: /Users/xxx/xxx/opencvjs_nanda/opencv/build_js/bin/opencv.js
OpenCV.js tutorials location: /Users/xxx/xxx/xxx/opencvjs_nanda/opencv/build_js/doc/doxygen/html/d5/d10/tutorial_js_root.html
y
・build_test
=====
===== Build finished
=====
OpenCV.js location: /Users/xxx/xxx/xxx/opencvjs_nanda/opencv/build_js/bin/opencv.js
OpenCV.js tests location: /Users/xxx/xxx/xxx/opencvjs_nanda/opencv/build_js/bin/tests.html
--
-- General configuration for OpenCV 4.9.0-dev =====================================
-- Version control: 4.9.0-371-g66fb5021e9-dirty
--
-- Platform:
-- Timestamp: 2024-04-16T14:38:15Z
-- Host: Darwin 19.6.0 x86_64
-- Target: Emscripten 1 x86
-- CMake: 3.29.2
-- CMake generator: Unix Makefiles
-- CMake build tool: /usr/bin/make
-- Configuration: Release
--
-- CPU/HW features:
-- Baseline:
--
-- C/C++:
-- Built as dynamic libs?: NO
-- C++ standard: 11
-- C++ Compiler: /Users/xxx/xxx/xxx/opencvjs_nanda/emsdk/upstream/emscripten/em++ (ver 19.0.0)
-- C++ flags (Release): -s SINGLE_FILE=1 -s USE_PTHREADS=0 -s EXPORTED_FUNCTIONS="['_malloc', '_free']" 〜略
-- C++ flags (Debug): -s SINGLE_FILE=1 -s USE_PTHREADS=0 -s EXPORTED_FUNCTIONS="['_malloc', '_free']" 〜略
-- C Compiler: /Users/xxx/xxx/xxx/opencvjs_nanda/emsdk/upstream/emscripten/emcc
-- C flags (Release): -s SINGLE_FILE=1 -s USE_PTHREADS=0 -s EXPORTED_FUNCTIONS="['_malloc', '_free']" 〜略
-- C flags (Debug): -s SINGLE_FILE=1 -s USE_PTHREADS=0 -s EXPORTED_FUNCTIONS="['_malloc', '_free']" 〜略-
-- Linker flags (Debug): -Wl,--gc-sections
-- ccache: NO
-- Precompiled headers: NO
-- Extra dependencies:
-- 3rdparty dependencies: zlib libprotobuf
--
-- OpenCV modules:
-- To be built: calib3d core dnn features2d flann imgproc js objdetect photo video
-- Disabled: highgui imgcodecs ml stitching videoio world
-- Disabled by dependency: ts
-- Unavailable: gapi java python2 python3
-- Applications: examples
-- Documentation: js
-- Non-free algorithms: NO
--
-- GUI:
--
-- Media I/O:
-- ZLib: build (ver 1.3.1)
-- JPEG 2000: build (ver 2.5.0)
-- HDR: YES
-- SUNRASTER: YES
-- PXM: YES
-- PFM: YES
--
-- Video I/O:
--
-- Parallel framework: none
--
-- Other third-party libraries:
-- VA: NO
-- Custom HAL: NO
-- Protobuf: build (3.19.1)
-- Flatbuffers: builtin/3rdparty (23.5.9)
--
-- Python (for build): /usr/local/bin/python3
--
-- Install to: /usr/local
------------------------------------------------------------------------------------------------------