Ask Your Question
1

Building calib3d in OpenCV.js

asked 2017-12-15 11:29:10 -0600

jerome_etienne gravatar image

updated 2017-12-16 06:59:02 -0600

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

edit retag flag offensive close merge delete

Comments

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

berak gravatar imageberak ( 2017-12-15 11:37:27 -0600 )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 ( 2017-12-15 11:44:40 -0600 )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 ( 2017-12-15 11:48:02 -0600 )edit
1

Done, thanks for your help!

jerome_etienne gravatar imagejerome_etienne ( 2017-12-15 11:50:08 -0600 )edit

2 answers

Sort by » oldest newest most voted
1

answered 2017-12-18 06:59:00 -0600

jerome_etienne gravatar image

updated 2017-12-18 06:59:45 -0600

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 calib3d’s 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 calib3d’s headers into the main file: https://github.com/opencv/opencv/blob/master/modules/js/src/core_bindings.cpp#L76
edit flag offensive delete link more

Comments

Hi there! Is this working???

JeenQLee gravatar imageJeenQLee ( 2018-04-19 14:19:48 -0600 )edit

Yes, it is working even now.

balarayen gravatar imagebalarayen ( 2020-02-19 01:13:14 -0600 )edit
1

answered 2017-12-16 11:40:07 -0600

berak gravatar image

updated 2017-12-17 02:39:22 -0600

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 !)

edit flag offensive delete link more

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 ( 2017-12-16 11:45:36 -0600 )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 ( 2017-12-16 12:01:15 -0600 )edit
1
Eduardo gravatar imageEduardo ( 2017-12-17 07:38:41 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2017-12-15 11:29:10 -0600

Seen: 2,307 times

Last updated: Dec 17 '17