OpenCV.js smaller package
Hi there,
Is it possible to cheery pick modules from OpenCV.js as the package size is >>8mb so mobile users will struggle to download this in a reasonable time. I'm looking down the webpack route, but if anyone has any suggestions on how to make the package size smaller then please let me know. Thanks in advance
Paul
You can try to build OpenCV with WASM support. It takes less size. But it's a good idea to split opencv.js to smallest parts. I.e. opencv_core.js or opencv_features2d.js or opencv_dnn.js. This way these libraries will contain only modules from suffix and their dependencies.
Thanks for your advice. I added WASM support and then manually changed the -DBUILD_opencv_xxx flags to OFF and I've managed to get it down to about 4.2MB from 8.4MB. I will have a proper look now to see if I can reduce it even further as I only really require the CORE.
Any update on further reducing size? I am also interested in helping this effort.
Same here I only need core but currently I am loading a 7MB OpenCV.js file into a web app. It would be really nice and useful to have OpenCV as npm package and be able to cheery pick what is imported using ES6 Modules import style. There are a few things out there on npm but none of those solutions seem official aside from OpenCV.js from OpenCV site.