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

asked 2019-07-25 01:29:46 -0600

asifk1997 gravatar image

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.

edit retag flag offensive close merge delete

Comments

and when trying to do the same thing compiles perfectly. Still cannot find the moduleā€¦ Are you able to resolve it?

kavikode gravatar imagekavikode ( 2019-08-06 06:53:42 -0600 )edit