Skip to content

Commit b82700a

Browse files
authored
Merge pull request opencv#18985 from ZEISS:feature/aruco_js_fix
Aruco javascript fix and added functionality * whitespace * updated docu. updated regexp. * update docu * embindgen regex * removed parser arg * remove whitespace * removed aruco hint * remove whitespace * removed aruco hint * new docu string * removed extra line * remove whitespace * removed aruco hint * new docu string * removed extra line
1 parent 624d532 commit b82700a

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
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
@@ -127,6 +127,13 @@ Building OpenCV.js from Source
127127
python ./platforms/js/build_js.py build_js --build_test
128128
@endcode
129129

130+
-# [optional] To enable OpenCV contrib modules append `--cmake_option="-DOPENCV_EXTRA_MODULES_PATH=/path/to/opencv_contrib/modules/"`
131+
132+
For example:
133+
@code{.bash}
134+
python ./platforms/js/build_js.py build_js --cmake_option="-DOPENCV_EXTRA_MODULES_PATH=opencv_contrib/modules"
135+
@endcode
136+
130137
Running OpenCV.js Tests
131138
---------------------------------------
132139

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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,12 @@
7474
'aruco_Board': ['create'],
7575
'aruco_GridBoard': ['create', 'draw'],
7676
'aruco_CharucoBoard': ['create', 'draw'],
77+
'aruco_DetectorParameters': ['create']
7778
}
7879

79-
calib3d = {'': ['findHomography', 'calibrateCameraExtended', 'drawFrameAxes', 'estimateAffine2D', 'getDefaultNewCameraMatrix', 'initUndistortRectifyMap', 'Rodrigues']}
80+
calib3d = {'': ['findHomography', 'calibrateCameraExtended', 'drawFrameAxes', 'estimateAffine2D', \
81+
'getDefaultNewCameraMatrix', 'initUndistortRectifyMap', 'Rodrigues', \
82+
'solvePnP', 'solvePnPRansac', 'solvePnPRefineLM']}
8083

8184

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

0 commit comments

Comments
 (0)