Hi I tried to build tracking module in opencv.js but failed
I got error :
make -f 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/build.make 3rdparty/protobuf/CMakeFiles/libprotobuf.dir/build
Generator warning: enum cv.detail.CvFeatureParams.FeatureType (cname=cv::detail::CvFeatureParams::FeatureType) already exists
Generator error: constant CvFeatureParams_HAAR (cname=cv::detail::CvFeatureParams::HAAR) already exists
make[3]: *** [modules/js_bindings_generator/CMakeFiles/gen_opencv_js_source.dir/build.make:145: modules/js_bindings_generator/gen/bindings.cpp] Error 255
make[3]: Leaving directory ‘/src/build_js’
make[2]: *** [CMakeFiles/Makefile2:3268: modules/js_bindings_generator/CMakeFiles/gen_opencv_js_source.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs…
make[3]: Entering directory ‘/src/build_js’
make[3]: Nothing to be done for ‘3rdparty/protobuf/CMakeFiles/libprotobuf.dir/build’.
make[3]: Leaving directory ‘/src/build_js’
[ 18%] Built target libprotobuf
make[2]: Leaving directory ‘/src/build_js’
make[1]: *** [CMakeFiles/Makefile2:3455: modules/js/CMakeFiles/opencv.js.dir/rule] Error 2
make[1]: Leaving directory ‘/src/build_js’
make: *** [Makefile:548: opencv.js] Error 2
Traceback (most recent call last):
File “./platforms/js/build_js.py”, line 321, in
builder.build_opencvjs()
File “./platforms/js/build_js.py”, line 229, in build_opencvjs
execute([“make”, “-j”, str(multiprocessing.cpu_count()), “opencv.js”])
File “./platforms/js/build_js.py”, line 23, in execute
raise Fail(“Child returned: %s” % retcode)
main.Fail: Child returned: 2
[Environment Information]
OS: Windows10
openCV: 4.5.1
openCV_contrb : 4.5.1
[Modification]
-
opencv/modules/js/generator/embindgen.py
tracking = {“Tracker”: [“init”, “update”], “TrackerKCF”: [“create”], “TrackerBoosting”: [“create”], “TrackerMIL”: [“create”], “TrackerTLD”: [“create”], “TrackerMedianFlow”: [“create”], “TrackerMOSSE”: [“create”], “TrackerCSRT”: [“create”]}
-
opencv/modules/js/generator/embindgen.py
white_list = makeWhiteList([tracking])
-
opencv/platforms/js/build_js.py
cmd = [“cmake”,
“-DOPENCV_EXTRA_MODULES_PATH=/opencv_contrib/modules”, -
opencv/modules/js/src/core_bindings.cpp
using namespace tracking;
-
opencv_contrib/modules/tracking/CMakeLists - Append “js” in ocv_define_module
ocv_define_module(tracking opencv_imgproc opencv_core opencv_video opencv_plot${debug_modules} OPTIONAL opencv_dnn opencv_datasets opencv_highgui WRAP java python objc js)
[Command]
cd opencv docker run --rm --workdir /src -v “$(get-location):/src” -v “my/peth/to/opencv_contrib:/contrib” “emscripten/emsdk:2.0.10” emcmake python3 ./platforms/js/build_js.py build_js