All OpenCV constants being exported into matlab class and C++ map templates

This commit is contained in:
hbristow
2013-06-26 15:45:05 -07:00
parent 0b9ff11537
commit e51bdbeb2d
4 changed files with 45 additions and 2 deletions

View File

@@ -172,7 +172,18 @@ class Constant(object):
return ('const ' if self.const else '')+self.tp+self.ref+\
' '+self.name+('='+self.default if self.default else '')+';'
def constants(tree):
if isinstance(tree, dict) and 'constants' in tree and isinstance(tree['constants'], list):
for node in tree['constants']:
yield (node['name'], node['default'])
if isinstance(tree, dict):
for key, val in tree.items():
for gen in constants(val):
yield gen
if isinstance(tree, list):
for val in tree:
for gen in constants(val):
yield gen
def todict(obj, classkey=None):
if isinstance(obj, dict):