Build with WasmEdge-OpenCVMini Plug-in
The WasmEdge-OpenCVMini plug-in exposes a subset of OpenCV image processing functions to WebAssembly applications running on WasmEdge. It is designed for AI input/output pre- and post-processing tasks such as image resizing, color conversion, and basic transformations.
Prerequisites
Since WasmEdge 0.17.2, the plug-in requires OpenCV 5. Please install OpenCV 5 on your system.
For macOS:
brew install opencv@5
For Linux, the libopencv-dev package of most distributions still provides OpenCV 4. Please build and install OpenCV 5 from the OpenCV source instead.
For WasmEdge 0.17.1 and earlier versions, the plug-in requires OpenCV 4, which can be installed by sudo apt install -y libopencv-dev on Ubuntu or brew install opencv on macOS.
Build WasmEdge with WasmEdge-OpenCVMini Plug-in
To enable the WasmEdge-OpenCVMini plug-in, developers need to build WasmEdge from source with the cmake option -DWASMEDGE_PLUGIN_OPENCVMINI=ON.
cd <path/to/your/wasmedge/source/folder>
cmake -GNinja -Bbuild -DCMAKE_BUILD_TYPE=Release -DWASMEDGE_PLUGIN_OPENCVMINI=ON
cmake --build build
cmake --install build
If the built wasmedge CLI tool cannot find the WasmEdge-OpenCVMini plug-in, you can set the WASMEDGE_PLUGIN_PATH environment variable to the plug-in installation path (such as /usr/local/lib/wasmedge/, or the built plug-in path build/plugins/wasmedge_opencvmini/) to try to fix this issue.
Then you will have an executable wasmedge runtime under /usr/local/bin and the WasmEdge-OpenCVMini plug-in under /usr/local/lib/wasmedge/libwasmedgePluginWasmEdgeOpenCVMini.so after installation.
For more information, you can refer to the GitHub repository.