mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 06:03:15 +08:00
JavaScript bindings for features2d module
This commit is contained in:
parent
43e66e7ff9
commit
e9f99063c7
@ -1,2 +1,2 @@
|
|||||||
set(the_description "2D Features Framework")
|
set(the_description "2D Features Framework")
|
||||||
ocv_define_module(features2d opencv_imgproc OPTIONAL opencv_flann opencv_highgui WRAP java python)
|
ocv_define_module(features2d opencv_imgproc OPTIONAL opencv_flann opencv_highgui WRAP java python js)
|
||||||
|
@ -137,7 +137,11 @@ public:
|
|||||||
|
|
||||||
/** @brief Abstract base class for 2D image feature detectors and descriptor extractors
|
/** @brief Abstract base class for 2D image feature detectors and descriptor extractors
|
||||||
*/
|
*/
|
||||||
|
#ifdef __EMSCRIPTEN__
|
||||||
|
class CV_EXPORTS_W Feature2D : public Algorithm
|
||||||
|
#else
|
||||||
class CV_EXPORTS_W Feature2D : public virtual Algorithm
|
class CV_EXPORTS_W Feature2D : public virtual Algorithm
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~Feature2D();
|
virtual ~Feature2D();
|
||||||
|
@ -126,7 +126,22 @@ video = {'': ['CamShift', 'calcOpticalFlowFarneback', 'calcOpticalFlowPyrLK', 'c
|
|||||||
'BackgroundSubtractor': ['apply', 'getBackgroundImage']}
|
'BackgroundSubtractor': ['apply', 'getBackgroundImage']}
|
||||||
|
|
||||||
dnn = {'dnn_Net': ['setInput', 'forward'],
|
dnn = {'dnn_Net': ['setInput', 'forward'],
|
||||||
'': ['readNetFromCaffe', 'readNetFromTensorflow', 'readNetFromTorch', 'readNetFromDarknet', 'blobFromImage']}
|
'': ['readNetFromCaffe', 'readNetFromTensorflow', 'readNetFromTorch', 'readNetFromDarknet',
|
||||||
|
'readNetFromONNX', 'readNet', 'blobFromImage']}
|
||||||
|
|
||||||
|
features2d = {'Feature2D': ['detect', 'compute', 'detectAndCompute', 'descriptorSize', 'descriptorType', 'defaultNorm', 'empty', 'getDefaultName'],
|
||||||
|
'BRISK': ['create', 'getDefaultName'],
|
||||||
|
'ORB': ['create', 'setMaxFeatures', 'setScaleFactor', 'setNLevels', 'setEdgeThreshold', 'setFirstLevel', 'setWTA_K', 'setScoreType', 'setPatchSize', 'getFastThreshold', 'getDefaultName'],
|
||||||
|
'MSER': ['create', 'detectRegions', 'setDelta', 'getDelta', 'setMinArea', 'getMinArea', 'setMaxArea', 'getMaxArea', 'setPass2Only', 'getPass2Only', 'getDefaultName'],
|
||||||
|
'FastFeatureDetector': ['create', 'setThreshold', 'getThreshold', 'setNonmaxSuppression', 'getNonmaxSuppression', 'setType', 'getType', 'getDefaultName'],
|
||||||
|
'AgastFeatureDetector': ['create', 'setThreshold', 'getThreshold', 'setNonmaxSuppression', 'getNonmaxSuppression', 'setType', 'getType', 'getDefaultName'],
|
||||||
|
'GFTTDetector': ['create', 'setMaxFeatures', 'getMaxFeatures', 'setQualityLevel', 'getQualityLevel', 'setMinDistance', 'getMinDistance', 'setBlockSize', 'getBlockSize', 'setHarrisDetector', 'getHarrisDetector', 'setK', 'getK', 'getDefaultName'],
|
||||||
|
# 'SimpleBlobDetector': ['create'],
|
||||||
|
'KAZE': ['create', 'setExtended', 'getExtended', 'setUpright', 'getUpright', 'setThreshold', 'getThreshold', 'setNOctaves', 'getNOctaves', 'setNOctaveLayers', 'getNOctaveLayers', 'setDiffusivity', 'getDiffusivity', 'getDefaultName'],
|
||||||
|
'AKAZE': ['create', 'setDescriptorType', 'getDescriptorType', 'setDescriptorSize', 'getDescriptorSize', 'setDescriptorChannels', 'getDescriptorChannels', 'setThreshold', 'getThreshold', 'setNOctaves', 'getNOctaves', 'setNOctaveLayers', 'getNOctaveLayers', 'setDiffusivity', 'getDiffusivity', 'getDefaultName'],
|
||||||
|
'DescriptorMatcher': ['add', 'clear', 'empty', 'isMaskSupported', 'train', 'match', 'knnMatch', 'radiusMatch', 'clone', 'create'],
|
||||||
|
'BFMatcher': ['isMaskSupported', 'create'],
|
||||||
|
'': ['FAST', 'AGAST', 'drawKeypoints', 'drawMatches']}
|
||||||
|
|
||||||
def makeWhiteList(module_list):
|
def makeWhiteList(module_list):
|
||||||
wl = {}
|
wl = {}
|
||||||
@ -138,7 +153,7 @@ def makeWhiteList(module_list):
|
|||||||
wl[k] = m[k]
|
wl[k] = m[k]
|
||||||
return wl
|
return wl
|
||||||
|
|
||||||
white_list = makeWhiteList([core, imgproc, objdetect, video, dnn])
|
white_list = makeWhiteList([core, imgproc, objdetect, video, dnn, features2d])
|
||||||
|
|
||||||
# Features to be exported
|
# Features to be exported
|
||||||
export_enums = False
|
export_enums = False
|
||||||
@ -219,7 +234,8 @@ def handle_ptr(tp):
|
|||||||
|
|
||||||
def handle_vector(tp):
|
def handle_vector(tp):
|
||||||
if tp.startswith('vector_'):
|
if tp.startswith('vector_'):
|
||||||
tp = 'std::vector<' + "::".join(tp.split('_')[1:]) + '>'
|
tp = handle_vector(tp[tp.find('_') + 1:])
|
||||||
|
tp = 'std::vector<' + "::".join(tp.split('_')) + '>'
|
||||||
return tp
|
return tp
|
||||||
|
|
||||||
|
|
||||||
@ -845,13 +861,12 @@ class JSWrapperGenerator(object):
|
|||||||
[class_info.cname, property.name])))
|
[class_info.cname, property.name])))
|
||||||
|
|
||||||
dv = ''
|
dv = ''
|
||||||
base = Template("""base<$base$isPoly>""")
|
base = Template("""base<$base>""")
|
||||||
|
|
||||||
assert len(class_info.bases) <= 1 , "multiple inheritance not supported"
|
assert len(class_info.bases) <= 1 , "multiple inheritance not supported"
|
||||||
|
|
||||||
if len(class_info.bases) == 1:
|
if len(class_info.bases) == 1:
|
||||||
dv = "," + base.substitute(base=', '.join(class_info.bases),
|
dv = "," + base.substitute(base=', '.join(class_info.bases))
|
||||||
isPoly = " ,true" if class_info.name=="Feature2D" else "")
|
|
||||||
|
|
||||||
self.bindings.append(class_template.substitute(cpp_name=class_info.cname,
|
self.bindings.append(class_template.substitute(cpp_name=class_info.cname,
|
||||||
js_name=name,
|
js_name=name,
|
||||||
|
@ -131,7 +131,7 @@ class Builder:
|
|||||||
"-DBUILD_opencv_apps=OFF",
|
"-DBUILD_opencv_apps=OFF",
|
||||||
"-DBUILD_opencv_calib3d=OFF",
|
"-DBUILD_opencv_calib3d=OFF",
|
||||||
"-DBUILD_opencv_dnn=ON",
|
"-DBUILD_opencv_dnn=ON",
|
||||||
"-DBUILD_opencv_features2d=OFF",
|
"-DBUILD_opencv_features2d=ON",
|
||||||
"-DBUILD_opencv_flann=OFF",
|
"-DBUILD_opencv_flann=OFF",
|
||||||
"-DBUILD_opencv_ml=OFF",
|
"-DBUILD_opencv_ml=OFF",
|
||||||
"-DBUILD_opencv_photo=OFF",
|
"-DBUILD_opencv_photo=OFF",
|
||||||
|
Loading…
Reference in New Issue
Block a user