First time here? Check out the FAQ!

Ask Your Question
1

Building calib3d in OpenCV.js

asked Dec 15 '17

jerome_etienne gravatar image

updated Dec 16 '17

Hello,

I would like to use SolvePnP in javascript, But currently i cant make it work :(

im using 3.3.1 and following the intruction to build openCV.js from the official page.

SolvePnp is in calib3d module, and this module isnt compiled by default in javascript. So i set calib3d to ON in build_js.py. The same with features2d, which seems to be a dependancy of calib3d. The build config report them as 'to be build'.

--   OpenCV modules:
--     To be built:                 core imgproc objdetect video features2d js calib3d
--     Disabled:                    flann highgui imgcodecs ml photo shape stitching superres videoio videostab world
--     Disabled by dependency:      -
--     Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2 python3 ts viz

But calib3d is never compiled. No matter the ON/OFF i put it only build core/imgproc/objdetect/video ... nothing more.

jerome@jmemac:~/Downloads/opencvjs-test/opencv-3.3.1/build_js/lib$ ls -l
total 30528
-rw-r--r--  1 jerome  staff  6418036 Dec 15 17:04 libopencv_core.a
-rw-r--r--  1 jerome  staff  7498700 Dec 15 17:04 libopencv_imgproc.a
-rw-r--r--  1 jerome  staff   830352 Dec 15 17:04 libopencv_objdetect.a
-rw-r--r--  1 jerome  staff   877608 Dec 15 17:04 libopencv_video.a

Any hint on how to get SolvePnP in javascript ? im super new at opencv

Preview: (hide)

Comments

be so kind, and replace the screenshots with TEXT , thank you !

berak gravatar imageberak (Dec 15 '17)edit

i will gladly do it, but how can i copy a text verbatim ?

Is there a documentation on how to do it ? (the > blockquote from the UI doesnt seems to work)

jerome_etienne gravatar imagejerome_etienne (Dec 15 '17)edit

usually , marking the text, and pressing the "10101" button (format as code) does the trick.

we can also help you with the formatting. screenshots are just bad, because they can't be properly indexed for search, or c/p for quoting things.

berak gravatar imageberak (Dec 15 '17)edit
1

Done, thanks for your help!

jerome_etienne gravatar imagejerome_etienne (Dec 15 '17)edit

2 answers

Sort by » oldest newest most voted
1

answered Dec 18 '17

jerome_etienne gravatar image

updated Dec 18 '17

Here is an answer from an email by Hu, Ningxin. i paste it here for future references

Calib3d module is not enabled by OpenCV.js by default. To enable it, you need:

1. Enable the build flag: https://github.com/opencv/opencv/blob/master/platforms/js/build_js.py#L136
2. Append js into WRAP list of calib3ds CMakefiles.txt: https://github.com/opencv/opencv/blob/master/modules/calib3d/CMakeLists.txt#L2
3. Add SolvePnP API into JS API whitelist: https://github.com/opencv/opencv/blob/master/modules/js/src/embindgen.py#L141
4.  You may need to include the calib3ds headers into the main file: https://github.com/opencv/opencv/blob/master/modules/js/src/core_bindings.cpp#L76
Preview: (hide)

Comments

Hi there! Is this working???

JeenQLee gravatar imageJeenQLee (Apr 19 '18)edit

Yes, it is working even now.

balarayen gravatar imagebalarayen (Feb 19 '0)edit
1

answered Dec 16 '17

berak gravatar image

updated Dec 17 '17

sorry to disappoint you, but the current js wrapping system is all but automatic (it's operating on an explicit whitelist, not on a blacklist, like the python/java/matlab wrappers)

the calib3d module is simply not wrapped to js now (and whatever c++ libs are built or not is not relevant for this),

as of now, you only get exactly the small subset covered here

it's just work in progress, be patient, and wait out, how it moves .. (and i'm sure, help is welcome there !)

Preview: (hide)

Comments

Thanks for this answer.

I will gladly help to make it happen. i need that to do image-based marker in AR.js. I am definitly willing to work to make it happen. I would appreciate any pointer on how to update this whitelist to include calib3d.

Where should i look ?

jerome_etienne gravatar imagejerome_etienne (Dec 16 '17)edit
1

ah, nice !

current work was done as a GSOC project (#10)

maybe you should just try to ping those folks for further information

(cool project, btw, seen it before. keep on rocking !)

then, ofc. have a look here ( though i guess, you know all of it already, just to make sure... )

berak gravatar imageberak (Dec 16 '17)edit
1
Eduardo gravatar imageEduardo (Dec 17 '17)edit

Question Tools

2 followers

Stats

Asked: Dec 15 '17

Seen: 2,390 times

Last updated: Dec 17 '17