0

For my project, I need only the calib3d subpart of the opencv.js module. Since I am trying to create this file for a website, the whole file/folder cannot be more than 2 MB, where as opencv.js itself is around 13 MB.

Specifically, I need only solvePnP, ProjectPoints and Rodrigues functions.

Is there any way to extract only the calib3d part of the opencv.js module?

mplungjan
  • 169,008
  • 28
  • 173
  • 236
madhan01
  • 117
  • 5
  • 1
    Do you know the url of the git repo where opencv.js is? Searching google I found a small handful. Basically, you could use git-submodules. First, you want to make sure you are putting the submodule in the right place, sinve moving submodules is annoying. I'd suggest a top level `packages` directory or something like that. Since you'll have to `cd` to this directory often, the closer it is to the root of your repo, the better. Run `git submodule add ` and this will add it to the _root_ (your-project/opencv), or you can do `git submodule add ./packages/opencv`. – Devin Rhode Jun 11 '20 at 15:06
  • Also, if it's an npm package, you may be able to install it normally, and then if you inspect the installed node_module (in repo root, `open node_modules/opencv.js`) if there isn't just one giant index.js file, maybe there's some sort of `calib3d/index.js` or `calib3d.js` file. So if there is a `node_modules/opencv.js/dist/calib3d/index.js`, inside your project, assuming you are using es6, you should try `import calibDefault, * as calibExports from 'opencv.js/dist/calib3d';` and `console.log({...calibExports, calibExports });` to see what you get. – Devin Rhode Jun 11 '20 at 15:12

0 Answers0