Ask Your Question
0

Adding packages to Javascript WASM build

asked 2018-04-06 14:43:42 -0600

updated 2018-04-06 14:48:08 -0600

Hi,

I'm using the Javascript WASM build target, and I wanted to expose more functionality. Exposing more methods in the existing packages (core, etc) is straightforward (i.e., I added "rotate" easily).

I wanted to try and add one of the opencv_contrib modules, and can't figure out how to do it.

I added a line to the embindgen.py file for aruco, and added aruco to the white_list in the file.

aruco = {'aruco': ['detectMarkers', 'estimatePoseSingleMarkers', 'drawDetectedMarkers', 'drawAxis']}

The instructions for building the contrib modules assume you are building with CMAKE on the command line; I tried adding the appropriate flags to the build_js.py file, but couldn't seem to make it build any of the contrib modules (i.e., it didn't affect the resulting build).

I am trying it out with the aruco module. I also tried moving the aruco folder in the main opencv/modules. Here the build made some progress, showing me that it wasn't including it because of missing dependency (calib3d); so I changed the calib3d flag to ON in build_py.sh, and got output during the config that seems to say it is going to try and build aruco:

--   OpenCV modules:
--     To be built:                 aruco bgsegm bioinspired calib3d core dnn dnn_objdetect dpm features2d fuzzy hfs img_hash imgproc java_bindings_generator js line_descriptor objdetect phase_unwrapping plot python_bindings_generator reg rgbd saliency stereo structured_light tracking video xfeatures2d xphoto
--     Disabled:                    flann highgui imgcodecs ml photo shape stitching superres videoio videostab world
--     Disabled by dependency:      ccalib datasets face optflow surface_matching text ximgproc xobjdetect
--     Unavailable:                 cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv dnn_modern freetype hdf java matlab ovis python2 python3 sfm ts viz
--     Applications:                -
--     Documentation:               js
--     Non-free algorithms:         NO

But, after that, it doesn't try to build that library. I hope it's something simply I'm doing wrong, I don't have much experience building opencv

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-05-20 22:27:49 -0600

rishant gravatar image

updated 2018-05-20 22:29:05 -0600

Maybe you should follow these steps, http://answers.opencv.org/question/18...

You are probably missing the step where you update the CMakeLists of the module with JS flag

Let me know how it goes.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-04-06 14:43:42 -0600

Seen: 904 times

Last updated: May 20 '18