opencv_js.config.py 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. # Classes and methods whitelist
  2. core = {
  3. '': [
  4. 'absdiff', 'add', 'addWeighted', 'bitwise_and', 'bitwise_not', 'bitwise_or', 'bitwise_xor', 'cartToPolar',
  5. 'compare', 'convertScaleAbs', 'copyMakeBorder', 'countNonZero', 'determinant', 'dft', 'divide', 'eigen',
  6. 'exp', 'flip', 'getOptimalDFTSize','gemm', 'hconcat', 'inRange', 'invert', 'kmeans', 'log', 'magnitude',
  7. 'max', 'mean', 'meanStdDev', 'merge', 'min', 'minMaxLoc', 'mixChannels', 'multiply', 'norm', 'normalize',
  8. 'perspectiveTransform', 'polarToCart', 'pow', 'randn', 'randu', 'reduce', 'repeat', 'rotate', 'setIdentity', 'setRNGSeed',
  9. 'solve', 'solvePoly', 'split', 'sqrt', 'subtract', 'trace', 'transform', 'transpose', 'vconcat',
  10. 'setLogLevel', 'getLogLevel',
  11. ],
  12. 'Algorithm': [],
  13. }
  14. imgproc = {
  15. '': [
  16. 'Canny',
  17. 'GaussianBlur',
  18. 'Laplacian',
  19. 'HoughLines',
  20. 'HoughLinesP',
  21. 'HoughCircles',
  22. 'Scharr',
  23. 'Sobel',
  24. 'adaptiveThreshold',
  25. 'approxPolyDP',
  26. 'arcLength',
  27. 'bilateralFilter',
  28. 'blur',
  29. 'boundingRect',
  30. 'boxFilter',
  31. 'calcBackProject',
  32. 'calcHist',
  33. 'circle',
  34. 'compareHist',
  35. 'connectedComponents',
  36. 'connectedComponentsWithStats',
  37. 'contourArea',
  38. 'convexHull',
  39. 'convexityDefects',
  40. 'cornerHarris',
  41. 'cornerMinEigenVal',
  42. 'createCLAHE',
  43. 'createLineSegmentDetector',
  44. 'cvtColor',
  45. 'demosaicing',
  46. 'dilate',
  47. 'distanceTransform',
  48. 'distanceTransformWithLabels',
  49. 'drawContours',
  50. 'ellipse',
  51. 'ellipse2Poly',
  52. 'equalizeHist',
  53. 'erode',
  54. 'filter2D',
  55. 'findContours',
  56. 'fitEllipse',
  57. 'fitLine',
  58. 'floodFill',
  59. 'getAffineTransform',
  60. 'getPerspectiveTransform',
  61. 'getRotationMatrix2D',
  62. 'getStructuringElement',
  63. 'goodFeaturesToTrack',
  64. 'grabCut',
  65. #'initUndistortRectifyMap', # 4.x: moved to calib3d
  66. 'integral',
  67. 'integral2',
  68. 'isContourConvex',
  69. 'line',
  70. 'matchShapes',
  71. 'matchTemplate',
  72. 'medianBlur',
  73. 'minAreaRect',
  74. 'minEnclosingCircle',
  75. 'moments',
  76. 'morphologyEx',
  77. 'pointPolygonTest',
  78. 'putText',
  79. 'pyrDown',
  80. 'pyrUp',
  81. 'rectangle',
  82. 'remap',
  83. 'resize',
  84. 'sepFilter2D',
  85. 'threshold',
  86. #'undistort', # 4.x: moved to calib3d
  87. 'warpAffine',
  88. 'warpPerspective',
  89. 'warpPolar',
  90. 'watershed',
  91. 'fillPoly',
  92. 'fillConvexPoly',
  93. 'polylines',
  94. ],
  95. 'CLAHE': ['apply', 'collectGarbage', 'getClipLimit', 'getTilesGridSize', 'setClipLimit', 'setTilesGridSize'],
  96. 'segmentation_IntelligentScissorsMB': [
  97. 'IntelligentScissorsMB',
  98. 'setWeights',
  99. 'setGradientMagnitudeMaxLimit',
  100. 'setEdgeFeatureZeroCrossingParameters',
  101. 'setEdgeFeatureCannyParameters',
  102. 'applyImage',
  103. 'applyImageFeatures',
  104. 'buildMap',
  105. 'getContour'
  106. ],
  107. }
  108. objdetect = {'': ['groupRectangles'],
  109. 'HOGDescriptor': ['load', 'HOGDescriptor', 'getDefaultPeopleDetector', 'getDaimlerPeopleDetector', 'setSVMDetector', 'detectMultiScale'],
  110. 'CascadeClassifier': ['load', 'detectMultiScale2', 'CascadeClassifier', 'detectMultiScale3', 'empty', 'detectMultiScale'],
  111. 'QRCodeDetector': ['QRCodeDetector', 'decode', 'decodeCurved', 'detect', 'detectAndDecode', 'detectMulti', 'setEpsX', 'setEpsY']}
  112. video = {
  113. '': [
  114. 'CamShift',
  115. 'calcOpticalFlowFarneback',
  116. 'calcOpticalFlowPyrLK',
  117. 'createBackgroundSubtractorMOG2',
  118. 'findTransformECC',
  119. 'meanShift',
  120. ],
  121. 'BackgroundSubtractorMOG2': ['BackgroundSubtractorMOG2', 'apply'],
  122. 'BackgroundSubtractor': ['apply', 'getBackgroundImage'],
  123. # issue #21070: 'Tracker': ['init', 'update'],
  124. 'TrackerMIL': ['create'],
  125. 'TrackerMIL_Params': [],
  126. }
  127. dnn = {'dnn_Net': ['setInput', 'forward', 'setPreferableBackend'],
  128. '': ['readNetFromCaffe', 'readNetFromTensorflow', 'readNetFromTorch', 'readNetFromDarknet',
  129. 'readNetFromONNX', 'readNet', 'blobFromImage']}
  130. features2d = {'Feature2D': ['detect', 'compute', 'detectAndCompute', 'descriptorSize', 'descriptorType', 'defaultNorm', 'empty', 'getDefaultName'],
  131. 'BRISK': ['create', 'getDefaultName'],
  132. 'ORB': ['create', 'setMaxFeatures', 'setScaleFactor', 'setNLevels', 'setEdgeThreshold', 'setFirstLevel', 'setWTA_K', 'setScoreType', 'setPatchSize', 'getFastThreshold', 'getDefaultName'],
  133. 'MSER': ['create', 'detectRegions', 'setDelta', 'getDelta', 'setMinArea', 'getMinArea', 'setMaxArea', 'getMaxArea', 'setPass2Only', 'getPass2Only', 'getDefaultName'],
  134. 'FastFeatureDetector': ['create', 'setThreshold', 'getThreshold', 'setNonmaxSuppression', 'getNonmaxSuppression', 'setType', 'getType', 'getDefaultName'],
  135. 'AgastFeatureDetector': ['create', 'setThreshold', 'getThreshold', 'setNonmaxSuppression', 'getNonmaxSuppression', 'setType', 'getType', 'getDefaultName'],
  136. 'GFTTDetector': ['create', 'setMaxFeatures', 'getMaxFeatures', 'setQualityLevel', 'getQualityLevel', 'setMinDistance', 'getMinDistance', 'setBlockSize', 'getBlockSize', 'setHarrisDetector', 'getHarrisDetector', 'setK', 'getK', 'getDefaultName'],
  137. # 'SimpleBlobDetector': ['create'],
  138. 'KAZE': ['create', 'setExtended', 'getExtended', 'setUpright', 'getUpright', 'setThreshold', 'getThreshold', 'setNOctaves', 'getNOctaves', 'setNOctaveLayers', 'getNOctaveLayers', 'setDiffusivity', 'getDiffusivity', 'getDefaultName'],
  139. 'AKAZE': ['create', 'setDescriptorType', 'getDescriptorType', 'setDescriptorSize', 'getDescriptorSize', 'setDescriptorChannels', 'getDescriptorChannels', 'setThreshold', 'getThreshold', 'setNOctaves', 'getNOctaves', 'setNOctaveLayers', 'getNOctaveLayers', 'setDiffusivity', 'getDiffusivity', 'getDefaultName'],
  140. 'DescriptorMatcher': ['add', 'clear', 'empty', 'isMaskSupported', 'train', 'match', 'knnMatch', 'radiusMatch', 'clone', 'create'],
  141. 'BFMatcher': ['isMaskSupported', 'create'],
  142. '': ['drawKeypoints', 'drawMatches', 'drawMatchesKnn']}
  143. photo = {'': ['createAlignMTB', 'createCalibrateDebevec', 'createCalibrateRobertson', \
  144. 'createMergeDebevec', 'createMergeMertens', 'createMergeRobertson', \
  145. 'createTonemapDrago', 'createTonemapMantiuk', 'createTonemapReinhard', 'inpaint'],
  146. 'CalibrateCRF': ['process'],
  147. 'AlignMTB' : ['calculateShift', 'shiftMat', 'computeBitmaps', 'getMaxBits', 'setMaxBits', \
  148. 'getExcludeRange', 'setExcludeRange', 'getCut', 'setCut'],
  149. 'CalibrateDebevec' : ['getLambda', 'setLambda', 'getSamples', 'setSamples', 'getRandom', 'setRandom'],
  150. 'CalibrateRobertson' : ['getMaxIter', 'setMaxIter', 'getThreshold', 'setThreshold', 'getRadiance'],
  151. 'MergeExposures' : ['process'],
  152. 'MergeDebevec' : ['process'],
  153. 'MergeMertens' : ['process', 'getContrastWeight', 'setContrastWeight', 'getSaturationWeight', \
  154. 'setSaturationWeight', 'getExposureWeight', 'setExposureWeight'],
  155. 'MergeRobertson' : ['process'],
  156. 'Tonemap' : ['process' , 'getGamma', 'setGamma'],
  157. 'TonemapDrago' : ['getSaturation', 'setSaturation', 'getBias', 'setBias', \
  158. 'getSigmaColor', 'setSigmaColor', 'getSigmaSpace','setSigmaSpace'],
  159. 'TonemapMantiuk' : ['getScale', 'setScale', 'getSaturation', 'setSaturation'],
  160. 'TonemapReinhard' : ['getIntensity', 'setIntensity', 'getLightAdaptation', 'setLightAdaptation', \
  161. 'getColorAdaptation', 'setColorAdaptation']
  162. }
  163. aruco = {'': ['detectMarkers', 'drawDetectedMarkers', 'drawAxis', 'estimatePoseSingleMarkers', 'estimatePoseBoard', 'estimatePoseCharucoBoard', 'interpolateCornersCharuco', 'drawDetectedCornersCharuco'],
  164. 'aruco_Dictionary': ['get', 'drawMarker'],
  165. 'aruco_Board': ['create'],
  166. 'aruco_GridBoard': ['create', 'draw'],
  167. 'aruco_CharucoBoard': ['create', 'draw'],
  168. 'aruco_DetectorParameters': ['create']
  169. }
  170. calib3d = {
  171. '': [
  172. 'findHomography',
  173. 'calibrateCameraExtended',
  174. 'drawFrameAxes',
  175. 'estimateAffine2D',
  176. 'getDefaultNewCameraMatrix',
  177. 'initUndistortRectifyMap',
  178. 'Rodrigues',
  179. 'solvePnP',
  180. 'solvePnPRansac',
  181. 'solvePnPRefineLM',
  182. 'projectPoints',
  183. 'undistort',
  184. # cv::fisheye namespace
  185. 'fisheye_initUndistortRectifyMap',
  186. 'fisheye_projectPoints',
  187. ],
  188. }
  189. white_list = makeWhiteList([core, imgproc, objdetect, video, dnn, features2d, photo, aruco, calib3d])
  190. # namespace_prefix_override['dnn'] = '' # compatibility stuff (enabled by default)
  191. # namespace_prefix_override['aruco'] = '' # compatibility stuff (enabled by default)