13

I would like to include xfeatures2D from opencv_contrib into opencv.js.

I follow this documentation Build OpenCV.js. Everything is ok. I got a brand new opencv.js that I'm able to use in my html page, but it doesn't include the xfeatures2D module.

I change this file opencv/platforms/js/build_js.py to add :

def get_cmake_cmd(self):
  cmd = ["cmake",
     "-DOPENCV_EXTRA_MODULES_PATH=/Users/me/git/opencv_contrib/modules",
     ... 

Now cmake include opencv_contrib module. I can see extra modules compiled, but still not included by emscripten. It looks like JavaScript compilation hardcoded into opencv/modules/js.

Is a way to produce his own opencv.js and choose to remove or add opencv and/or contribution modules ?

halfer
  • 19,824
  • 17
  • 99
  • 186
  • could this be helpful https://html.developreference.com/article/11401179/sift+%3D+cv2.xfeatures2d.SIFT_create()+not+working+even+though+have+contrib+installed ? –  Sep 20 '20 at 08:05
  • please check this also https://forum.openframeworks.cc/t/problem-compiling-nonfree-opencv-modules/31002/4 it might be helpful. –  Sep 20 '20 at 08:12

1 Answers1

1

I've spotted a repo which looks promising: https://github.com/ganwenyao/opencv_js You can even try a few aruco demos here: https://ganwenyao.github.io/opencv_js/

It doesn't include xfeature2d already compiled but it's worth trying the same approach listed the repo's README.

George Profenza
  • 50,687
  • 19
  • 144
  • 218