Skip to content

Commit ef27c11

Browse files
committed
Merge pull request opencv#19162 from alalek:backport_18985
2 parents cd3939a + c2bc171 commit ef27c11

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

doc/js_tutorials/js_setup/js_setup/js_setup.markdown

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,13 @@ Building OpenCV.js from Source
131131
emcmake python ./opencv/platforms/js/build_js.py build_js --build_test
132132
@endcode
133133

134+
-# [optional] To enable OpenCV contrib modules append `--cmake_option="-DOPENCV_EXTRA_MODULES_PATH=/path/to/opencv_contrib/modules/"`
135+
136+
For example:
137+
@code{.bash}
138+
python ./platforms/js/build_js.py build_js --cmake_option="-DOPENCV_EXTRA_MODULES_PATH=opencv_contrib/modules"
139+
@endcode
140+
134141
Running OpenCV.js Tests
135142
---------------------------------------
136143

modules/js/generator/embindgen.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,8 +634,10 @@ def gen_function_binding(self, func, class_info):
634634
ret_type = type_dict[ptr_type]
635635
for key in type_dict:
636636
if key in ret_type:
637-
ret_type = ret_type.replace(key, type_dict[key])
638-
637+
# Replace types. Instead of ret_type.replace we use regular
638+
# expression to exclude false matches.
639+
# See https://github.com/opencv/opencv/issues/15514
640+
ret_type = re.sub('(^|[^\w])' + key + '($|[^\w])', type_dict[key], ret_type)
639641
if variant.constret and ret_type.startswith('const') == False:
640642
ret_type = 'const ' + ret_type
641643
if variant.refret and ret_type.endswith('&') == False:

platforms/js/opencv_js.config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
'BFMatcher': ['isMaskSupported', 'create'],
4848
'': ['drawKeypoints', 'drawMatches', 'drawMatchesKnn']}
4949

50-
calib3d = {'': ['findHomography', 'estimateAffine2D', 'Rodrigues']}
50+
calib3d = {'': ['findHomography', 'calibrateCameraExtended', 'drawFrameAxes', 'estimateAffine2D', \
51+
'getDefaultNewCameraMatrix', 'initUndistortRectifyMap', 'Rodrigues', \
52+
'solvePnP', 'solvePnPRansac', 'solvePnPRefineLM']}
5153

52-
white_list = makeWhiteList([core, imgproc, objdetect, video, dnn, features2d, calib3d])
54+
white_list = makeWhiteList([core, imgproc, objdetect, video, dnn, features2d, calib3d])

0 commit comments

Comments
 (0)