提交 74c77d82 编写于 作者: A Alexander Mordvintsev

base class name resolution

fixed find_obj.py
上级 40d0f853
......@@ -16,6 +16,7 @@ endforeach(mp)
ocv_list_filterout(candidate_deps "^opencv_cud(a|ev)")
ocv_list_filterout(candidate_deps "^opencv_matlab$")
ocv_list_filterout(candidate_deps "^opencv_ts$")
ocv_list_filterout(candidate_deps "^opencv_adas$")
ocv_add_module(${MODULE_NAME} BINDINGS OPTIONAL ${candidate_deps})
......@@ -35,6 +36,7 @@ ocv_list_filterout(opencv_hdrs ".h$")
ocv_list_filterout(opencv_hdrs "cuda")
ocv_list_filterout(opencv_hdrs "cudev")
ocv_list_filterout(opencv_hdrs "opencv2/objdetect/detection_based_tracker.hpp")
ocv_list_filterout(opencv_hdrs "opencv2/ximgproc/structured_edge_detection.hpp")
set(cv2_generated_hdrs
"${CMAKE_CURRENT_BINARY_DIR}/pyopencv_generated_include.h"
......
......@@ -267,7 +267,7 @@ class ClassInfo(object):
#return sys.exit(-1)
if self.bases and self.bases[0].startswith("cv::"):
self.bases[0] = self.bases[0][4:]
if self.bases and self.bases[0] == "cv::Algorithm":
if self.bases and self.bases[0] == "Algorithm":
self.isalgorithm = True
for m in decl[2]:
if m.startswith("="):
......@@ -752,8 +752,19 @@ class PythonWrapperGenerator(object):
% (classinfo.name, classinfo.cname))
sys.exit(-1)
self.classes[classinfo.name] = classinfo
if classinfo.bases and not classinfo.isalgorithm:
classinfo.isalgorithm = self.classes[classinfo.bases[0].replace("::", "_")].isalgorithm
if classinfo.bases:
chunks = classinfo.bases[0].split('::')
base = '_'.join(chunks)
while base not in self.classes and len(chunks)>1:
del chunks[-2]
base = '_'.join(chunks)
if base not in self.classes:
print("Generator error: unable to resolve base %s for %s"
% (classinfo.bases[0], classinfo.name))
sys.exit(-1)
classinfo.bases[0] = "::".join(chunks)
classinfo.isalgorithm |= self.classes[base].isalgorithm
def split_decl_name(self, name):
chunks = name.split('.')
......
......@@ -4,7 +4,7 @@
Feature-based image matching sample.
USAGE
find_obj.py [--feature=<sift|surf|orb|brisk>[-flann]] [ <image1> <image2> ]
find_obj.py [--feature=<sift|surf|orb|akaze|brisk>[-flann]] [ <image1> <image2> ]
--feature - Feature to use. Can be sift, surf, orb or brisk. Append '-flann'
to feature name to use Flann-based matcher instead bruteforce.
......@@ -23,14 +23,17 @@ FLANN_INDEX_LSH = 6
def init_feature(name):
chunks = name.split('-')
if chunks[0] == 'sift':
detector = cv2.SIFT()
detector = cv2.xfeatures2d.SIFT()
norm = cv2.NORM_L2
elif chunks[0] == 'surf':
detector = cv2.SURF(800)
detector = cv2.xfeatures2d.SURF(800)
norm = cv2.NORM_L2
elif chunks[0] == 'orb':
detector = cv2.ORB(400)
norm = cv2.NORM_HAMMING
elif chunks[0] == 'akaze':
detector = cv2.AKAZE()
norm = cv2.NORM_HAMMING
elif chunks[0] == 'brisk':
detector = cv2.BRISK()
norm = cv2.NORM_HAMMING
......@@ -136,8 +139,8 @@ if __name__ == '__main__':
try:
fn1, fn2 = args
except:
fn1 = '../c/box.png'
fn2 = '../c/box_in_scene.png'
fn1 = '../cpp/box.png'
fn2 = '../cpp/box_in_scene.png'
img1 = cv2.imread(fn1, 0)
img2 = cv2.imread(fn2, 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册