The opencv version I use is 4.5.4, I now package a method that does not exist in the white_list in platforms/js/opencv_js.config.py, such as: undistortPoints, I check the 4.5.4 version of opencv. This method exists in the calib3d module However, I put the method into the whitelist as follows.
core = {
'': [
'absdiff', 'add', 'addWeighted', 'bitwise_and', 'bitwise_not', 'bitwise_or', 'bitwise_xor', 'cartToPolar',
'compare', 'convertScaleAbs', 'copyMakeBorder', 'countNonZero', 'determinant', 'dft', 'divide', 'eigen',
'exp', 'flip', 'getOptimalDFTSize','gemm', 'hconcat', 'inRange', 'invert', 'kmeans', 'log', 'magnitude',
'max', 'mean', 'meanStdDev', 'merge', 'min', 'minMaxLoc', 'mixChannels', 'multiply', 'norm', 'normalize',
'perspectiveTransform', 'polarToCart', 'pow', 'randn', 'randu', 'reduce', 'repeat', 'rotate', 'setIdentity', 'setRNGSeed',
'solve', 'solvePoly', 'split', 'sqrt', 'subtract', 'trace', 'transform', 'transpose', 'vconcat',
'setLogLevel', 'getLogLevel',
],
'Algorithm': [],
}
calib3d = {
'': [
'projectPoints',
'undistortPoints',
],
}
white_list = makeWhiteList([core, calib3d])
and build_js.py as below:
// other config code
"-DBUILD_opencv_calib3d=ON",
"-DBUILD_opencv_dnn=OFF",
"-DBUILD_opencv_features2d=ON",
"-DBUILD_opencv_flann=ON", # No bindings provided. This module is used as a dependency for other modules.
"-DBUILD_opencv_gapi=OFF",
"-DBUILD_opencv_ml=OFF",
"-DBUILD_opencv_photo=OFF",
"-DBUILD_opencv_imgcodecs=OFF",
"-DBUILD_opencv_shape=OFF",
"-DBUILD_opencv_videoio=OFF",
"-DBUILD_opencv_videostab=OFF",
"-DBUILD_opencv_highgui=OFF",
"-DBUILD_opencv_superres=OFF",
"-DBUILD_opencv_stitching=OFF",
"-DBUILD_opencv_java=OFF",
"-DBUILD_opencv_js=ON",
"-DBUILD_opencv_python2=OFF",
"-DBUILD_opencv_python3=OFF",
"-DBUILD_EXAMPLES=OFF",
"-DBUILD_PACKAGE=OFF",
"-DBUILD_TESTS=OFF",
"-DBUILD_PERF_TESTS=OFF"]
After packaging,
emcmake python ./opencv-4.5.4/platforms/js/build_js.py ../app-2.5d/src/lib/build_js
However, when I try cv.undistortPoints in the console, I get undefined.
How can I use this method?