opencv_contrib icon indicating copy to clipboard operation
opencv_contrib copied to clipboard

TrackerCSRT not included in the wasm bundle

Open luisrudge opened this issue 6 months ago • 2 comments

this is my dockerfile

FROM emscripten/emsdk:3.1.46

WORKDIR /src

RUN git clone --depth 1 https://github.com/opencv/opencv.git && \
    git clone --depth 1 https://github.com/opencv/opencv_contrib.git

WORKDIR /src/opencv

RUN emcmake python3 ./platforms/js/build_js.py build_wasm \
    --build_wasm \
    --disable_single_file \
    --cmake_option="-DOPENCV_EXTRA_MODULES_PATH=/src/opencv_contrib/modules" \
    --cmake_option="-DBUILD_opencv_tracking=ON"


# Copy build artifacts to the same paths expected by the release workflow
FROM alpine:3.20
WORKDIR /src/opencv/build_wasm/bin
COPY --from=0 /src/opencv/build_wasm/bin/opencv.js ./opencv.js
COPY --from=0 /src/opencv/build_wasm/bin/opencv_js.wasm ./opencv_js.wasm

These are the only trackers included:

Image

Am I doing something wrong? I tested a few trackers in python but TrackerCSRT is the best one for my situation, so I'd like to use that in the WASM build as well. Thanks!

luisrudge avatar Oct 12 '25 03:10 luisrudge

OpenCV JS bundle doesn't bring all public OpenCV functions.

  1. Bundle size may be very big.
  2. Not all modules/functions are well supported. There are still some corner cases.

TrackerMIL is described here: https://github.com/opencv/opencv/blob/4.x/modules/video/misc/js/gen_dict.json

This contrib module (tracking) is not adopted for JS, and doesn't have JS binding configuration here: https://github.com/opencv/opencv_contrib/tree/4.x/modules/tracking/misc

Ref: https://github.com/opencv/opencv/pull/25986

opencv-alalek avatar Oct 12 '25 04:10 opencv-alalek

@opencv-alalek thanks for the reply. Is there a way to include another module? Can I override that whitelist and add TrackerCSRT to it?

luisrudge avatar Oct 12 '25 04:10 luisrudge