1

I am trying to build a simple web/js app that would detect image on camera. I have already done this on iOS and Android using OpenCV so my obvious choice was to use OpenCV.js (latest release).

I built opencv.js as in tutorial https://docs.opencv.org/3.4.1/d4/da1/tutorial_js_setup.html and created simple app that changes colorspace from camera to grayscale and shows it on canvas.

However I don't know how to use ORB or it is just not included in opencv.js build. When I try to do as follows: let orb = new cv.ORB() I got

cv.ORB is not a constructor

I also tried to use it in different way like in python cv.ORB_create but with the same result. There is no tutorial on docs.opencv with this. I am not sure whether it should be allocated in different way or it is missing in build.

I enabled these options in opencv/platforms/js/build_js.py:

"-DBUILD_opencv_calib3d=On","-DBUILD_opencv_dnn=ON","-DBUILD_opencv_features2d=ON","-DBUILD_opencv_flann=On","-DBUILD_opencv_ml=On",

But with no effect. When I analyzed logs from building I did not find logs from features2d like

[ 33%] Building CXX object modules/core/CMakeFiles/****

and maybe this is the issues. But I have enabled all required options - could anyone tell me what else could I do wrong?

desertnaut
  • 57,590
  • 26
  • 140
  • 166
Dev_IL
  • 252
  • 1
  • 15
  • You can include the modules you need by creating custom build of opencv.js, refer [here](https://docs.opencv.org/master/d4/da1/tutorial_js_setup.html) for the set of software's that needs to be installed and the commands to execute. Another alternative way of creating a custom opencv.js build is by using Docker container which is also explained [here](https://docs.opencv.org/master/d4/da1/tutorial_js_setup.html) – Giriraj Alagirisamy Mar 31 '21 at 10:32

1 Answers1

1

Right now (Jul 2018) opencv.js has a very minimal implementation, they didn't port the entire opencv library to js. You don't have ORB.

As Apr 2021, opencv.js has ORB, FAST, and many more. opencv_js.config.py has a list of available functions.

And there are instructions to build your own taylor opencv version with contrib module: https://docs.opencv.org/3.4/d4/da1/tutorial_js_setup.html

Alejandro Silvestri
  • 3,706
  • 31
  • 43