Merge pull request #19162 from alalek:backport_18985

pull/19167/head^2
Alexander Alekhin 4 years ago
commit ef27c11d50
  1. 7
      doc/js_tutorials/js_setup/js_setup/js_setup.markdown
  2. 6
      modules/js/generator/embindgen.py
  3. 6
      platforms/js/opencv_js.config.py

@ -131,6 +131,13 @@ Building OpenCV.js from Source
emcmake python ./opencv/platforms/js/build_js.py build_js --build_test emcmake python ./opencv/platforms/js/build_js.py build_js --build_test
@endcode @endcode
-# [optional] To enable OpenCV contrib modules append `--cmake_option="-DOPENCV_EXTRA_MODULES_PATH=/path/to/opencv_contrib/modules/"`
For example:
@code{.bash}
python ./platforms/js/build_js.py build_js --cmake_option="-DOPENCV_EXTRA_MODULES_PATH=opencv_contrib/modules"
@endcode
Running OpenCV.js Tests Running OpenCV.js Tests
--------------------------------------- ---------------------------------------

@ -634,8 +634,10 @@ class JSWrapperGenerator(object):
ret_type = type_dict[ptr_type] ret_type = type_dict[ptr_type]
for key in type_dict: for key in type_dict:
if key in ret_type: if key in ret_type:
ret_type = ret_type.replace(key, type_dict[key]) # Replace types. Instead of ret_type.replace we use regular
# expression to exclude false matches.
# See https://github.com/opencv/opencv/issues/15514
ret_type = re.sub('(^|[^\w])' + key + '($|[^\w])', type_dict[key], ret_type)
if variant.constret and ret_type.startswith('const') == False: if variant.constret and ret_type.startswith('const') == False:
ret_type = 'const ' + ret_type ret_type = 'const ' + ret_type
if variant.refret and ret_type.endswith('&') == False: if variant.refret and ret_type.endswith('&') == False:

@ -47,6 +47,8 @@ features2d = {'Feature2D': ['detect', 'compute', 'detectAndCompute', 'descriptor
'BFMatcher': ['isMaskSupported', 'create'], 'BFMatcher': ['isMaskSupported', 'create'],
'': ['drawKeypoints', 'drawMatches', 'drawMatchesKnn']} '': ['drawKeypoints', 'drawMatches', 'drawMatchesKnn']}
calib3d = {'': ['findHomography', 'estimateAffine2D', 'Rodrigues']} calib3d = {'': ['findHomography', 'calibrateCameraExtended', 'drawFrameAxes', 'estimateAffine2D', \
'getDefaultNewCameraMatrix', 'initUndistortRectifyMap', 'Rodrigues', \
'solvePnP', 'solvePnPRansac', 'solvePnPRefineLM']}
white_list = makeWhiteList([core, imgproc, objdetect, video, dnn, features2d, calib3d]) white_list = makeWhiteList([core, imgproc, objdetect, video, dnn, features2d, calib3d])

Loading…
Cancel
Save