Ask Your Question

Revision history [back]

use surf (part of opencv-contrib,module xfeatures2d) in opencv.js

i wanted to use surf so i cloned opencv-contrib branch 3.4 and then i did following steps

1) opencv_contrib/modules/xfeatures2d/CMakeLists.txt

Add "js" parameter in ocv_define_module

2) opencv/modules/js/src/core_bindings.cpp, add add: using namespace cv::xfeatures2d;

3) In opencv/modules/js/src/embindgen.py add:

xfeatures2d={'xfeatures2d': ['detect', 'compute', 'detectAndCompute', 'descriptorSize', 'descriptorType', 'defaultNorm', 'empty', 'getDefaultName'],

'SURF':['create'],

'SIFT':['create'],

}

modify:

i) white_list = makeWhiteList([core, imgproc, objdetect, video, dnn, features2d, photo, aruco, xfeatures2d, calib3d])

ii) re.sub(r"^cv.[a-zA-Z0-9]*.|cv.", "", name).replace(".", "_")

4) In opencv/platforms/js/build_js.py add: "-DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules",

modify:

"-DBUILD_opencv_calib3d=off" -> "-DBUILD_opencv_calib3d=on" "-DBUILD_opencv_features2d=off" -> "-DBUILD_opencv_features2d=on"

after this i built opencv.js but surf was still not working. could anyone please help me solving this issue. Thanks.