Using aruco from opencv.js

I built a current version of opencv.js using:

  git clone https://github.com/opencv/opencv.git
  cd opencv
  git clone https://github.com/opencv/opencv_contrib.git
  docker run --rm -v $(pwd):/src -u $(id -u):$(id -g) emscripten/emsdk:2.0.10 emcmake python3 ./platforms/js/build_js.py build_js --cmake_option="-DOPENCV_EXTRA_MODULES_PATH=/src/opencv_contrib/modules/"

I think I should have aruco support, but I cannot work out how to call, based on my python experience, I expect something like:

const dictionary = new cv.aruco.getPredefinedDictionary(cv.DICT_ARUCO_ORIGINAL);

to work, but instead, I see:

TypeError: Cannot read properties of undefined (reading 'getPredefinedDictionary')

Could someone please provide an example? - thanks

the emscripten stuff works by transpiling whitelisted pieces of OpenCV.

since you’re building that yourself already, you can experiment with it.

whitelisting happens when someone tries to whitelist some part of opencv and finds that the transpilation worked, perhaps after fixing some issues that might stand in the way.

the aruco module was modified notably for the past 1-2 releases. perhaps some whitelisted parts now changed sufficiently to cause trouble. or those parts you want haven’t been whitelisted yet.

whitelisted pieces of OpenCV.

which you can find here:

which is, exactly ? please tell !

Hi, thanks for the reply. I built opencv.js yesterday using the script at the top of my post
I understand about the whitelist - I would still appreciate a code example to configure an aruco detector

FYI - output of

console.log(cv.getBuildInformation());
General configuration for OpenCV 4.7.0 =====================================
  Version control:               4.7.0

  Platform:
    Timestamp:                   2022-12-28T15:20:23Z
    Host:                        Linux 5.15.0-56-generic x86_64
    Target:                      Emscripten 1 x86
    CMake:                       3.10.2
    CMake generator:             Unix Makefiles
    CMake build tool:            /usr/bin/make
    Configuration:               Release
...
1 Like

@nicbkw try to add --cmake_option="-DBUILD_opencv_aruco=ON" to the docker build script

1 Like

Did you solved the issue?