Esempio n. 1
0
    return isinstance(haar_cascade, CvHaarClassifierCascade) and \
        haar_cascade.flags&CV_MAGIC_MASK==CV_HAAR_MAGIC_VAL

''')


z = sb.mb.class_('CvConnectedComp')
sb.init_class(z)
sb.register_ti('CvConnectedComp')
sb.expose_class_vector('CvConnectedComp')
sb.finalize_class(z)
sb.expose_class_Seq('CvConnectedComp')

# cvEndFindContours -- from cv_h_gen.py
z = sb.mb.free_fun('cvEndFindContours')
FT.expose_func(z, ward_indices=(1,))
FT.add_underscore(z)
sb.cc.write('''
def endFindContours(scanner):
    z = _ext._cvEndFindContours(scanner)
    scanner._ownershiplevel = 0 # not owning the structure anymore
    return z
endFindContours.__doc__ = _ext._cvEndFindContours.__doc__
''')

# CvContourScanner
z = sb.mb.class_('_CvContourScanner')
sb.init_class(z)
z.rename('CvContourScanner')
sb.insert_del_interface('CvContourScanner', '_ext._cvEndFindContours')
sb.finalize_class(z)
Esempio n. 2
0
CV_COVAR_SCRAMBLED = 0
CV_COVAR_NORMAL = 1
CV_COVAR_USE_AVG = 2
CV_COVAR_SCALE = 4
CV_COVAR_ROWS = 8
CV_COVAR_COLS = 16

CV_PCA_DATA_AS_ROW = 0
CV_PCA_DATA_AS_COL = 1
CV_PCA_USE_AVG = 2

''')

# cvRange
z = sb.mb.free_fun('cvRange')
FT.expose_func(z, return_arg_index=1)
z.rename('range_')  # to avoid conflict with Python's range builtin function

# Array Statistics
sb.cc.write('''
#-----------------------------------------------------------------------------
# Array Statistics
#-----------------------------------------------------------------------------

    
CV_REDUCE_SUM = 0
CV_REDUCE_AVG = 1
CV_REDUCE_MAX = 2
CV_REDUCE_MIN = 3

Esempio n. 3
0
        'cvGetWindowName',
        'cvConvertImage',
        # 'cvWaitKey', 'cvGrabFrame', 'cvGetCaptureProperty', 'cvSetCaptureProperty', 'cvGetCaptureDomain',
        # 'cvWriteFrame',
):
    sb.mb.free_fun(z).include()

# CV_FOURCC -- turn it off, we've got ctypes code for it
try:
    sb.mb.free_fun('CV_FOURCC').exclude()
except:
    pass

# cvInitSystem
FT.expose_func(sb.mb.free_fun('cvInitSystem'),
               return_pointee=False,
               transformer_creators=[FT.input_list_of_string('argv', 'argc')])

# cvGetWindowHandle, wait until requested

# setMouseCallback
z = sb.mb.free_fun('cvSetMouseCallback')
FT.expose_func(
    z, transformer_creators=[FT.mouse_callback_func('on_mouse', 'param')])
FT.add_underscore(z)
sb.cc.write('''
def setMouseCallback(window_name, on_mouse, param=None):
    _windows_callbacks.setdefault(window_name,{})["mouse"] = _ext._cvSetMouseCallback(window_name, on_mouse, param=param)
setMouseCallback.__doc__ = _ext._cvSetMouseCallback.__doc__
''')
Esempio n. 4
0
from pyplusplus.module_builder import call_policies as CP
import sdpypp
sb = sdpypp.SdModuleBuilder('cvaux', number_of_files=6)
sb.load_regs('cv_hpp_reg.sdd')



sb.cc.write('''
#=============================================================================
# cvaux.h
#=============================================================================


''')

FT.expose_func(sb.mb.free_fun('cvSegmentImage'), ward_indices=(5,))

# Eigen Objects -- TODO
sb.cc.write('''
#-----------------------------------------------------------------------------
# Eigen Objects
#-----------------------------------------------------------------------------


''')

# 1D/2D HMM - TODO
sb.cc.write('''
#-----------------------------------------------------------------------------
# 1D/2D HMM
#-----------------------------------------------------------------------------
Esempio n. 5
0
CV_COVAR_SCRAMBLED = 0
CV_COVAR_NORMAL = 1
CV_COVAR_USE_AVG = 2
CV_COVAR_SCALE = 4
CV_COVAR_ROWS = 8
CV_COVAR_COLS = 16

CV_PCA_DATA_AS_ROW = 0
CV_PCA_DATA_AS_COL = 1
CV_PCA_USE_AVG = 2

''')

# cvRange
z = sb.mb.free_fun('cvRange')
FT.expose_func(z, return_arg_index=1)
z.rename('range_') # to avoid conflict with Python's range builtin function

    
# Array Statistics
sb.cc.write('''
#-----------------------------------------------------------------------------
# Array Statistics
#-----------------------------------------------------------------------------

    
CV_REDUCE_SUM = 0
CV_REDUCE_AVG = 1
CV_REDUCE_MAX = 2
CV_REDUCE_MIN = 3
Esempio n. 6
0
from pygccxml import declarations as D
from pyplusplus.module_builder import call_policies as CP
import sdpypp

sb = sdpypp.SdModuleBuilder('cvaux', number_of_files=6)
sb.load_regs('cv_hpp_reg.sdd')

sb.cc.write('''
#=============================================================================
# cvaux.h
#=============================================================================


''')

FT.expose_func(sb.mb.free_fun('cvSegmentImage'), ward_indices=(5, ))

# Eigen Objects -- TODO
sb.cc.write('''
#-----------------------------------------------------------------------------
# Eigen Objects
#-----------------------------------------------------------------------------


''')

# 1D/2D HMM - TODO
sb.cc.write('''
#-----------------------------------------------------------------------------
# 1D/2D HMM
#-----------------------------------------------------------------------------
Esempio n. 7
0
    x.arguments[0].type.partial_decl_string.startswith('::cv::FileNode')):
    z.include()
    if z.arguments[1].name == 'keypoints':
        z._transformer_creators.append(FT.arg_output('keypoints'))
    else:
        z._transformer_creators.append(FT.output(z.arguments[1].name))
        FT.doc_output(z, z.arguments[1])
    t = D.remove_const(D.remove_reference(z.arguments[1].type))
    name = 'read_' + C_to_Python_name_dict[t.partial_decl_string]
    z._transformer_kwds['alias'] = name

# getPerspectiveTransform, getAffineTransform
for t in ('getPerspectiveTransform', 'getAffineTransform'):
    FT.expose_func(sb.mb.free_fun(t),
                   return_pointee=False,
                   transformer_creators=[
                       FT.input_array1d('src'),
                       FT.input_array1d('dst')
                   ])

# goodFeaturesToTrack
FT.expose_func(sb.mb.free_fun('goodFeaturesToTrack'),
               return_pointee=False,
               transformer_creators=[FT.arg_output('corners')])

# 'HoughCircles', 'HoughLines', 'HoughLinesP'
FT.expose_func(sb.mb.free_fun('HoughCircles'),
               return_pointee=False,
               transformer_creators=[FT.arg_output('circles')])
FT.expose_func(sb.mb.free_fun('HoughLines'),
               return_pointee=False,
               transformer_creators=[FT.arg_output('lines')])
Esempio n. 8
0
# FileNode's 'read' functions
for z in sb.mb.free_funs(lambda x: x.name=='read' and \
    x.arguments[0].type.partial_decl_string.startswith('::cv::FileNode')):
    z.include()
    if z.arguments[1].name=='keypoints':
        z._transformer_creators.append(FT.arg_output('keypoints'))
    else:
        z._transformer_creators.append(FT.output(z.arguments[1].name))
        FT.doc_output(z, z.arguments[1])   
    t = D.remove_const(D.remove_reference(z.arguments[1].type))
    name = 'read_'+C_to_Python_name_dict[t.partial_decl_string]
    z._transformer_kwds['alias'] = name

# getPerspectiveTransform, getAffineTransform
for t in ('getPerspectiveTransform', 'getAffineTransform'):
    FT.expose_func(sb.mb.free_fun(t), return_pointee=False, 
        transformer_creators=[FT.input_array1d('src'), FT.input_array1d('dst')])
        
# goodFeaturesToTrack
FT.expose_func(sb.mb.free_fun('goodFeaturesToTrack'), return_pointee=False, 
    transformer_creators=[FT.arg_output('corners')])

# 'HoughCircles', 'HoughLines', 'HoughLinesP'
FT.expose_func(sb.mb.free_fun('HoughCircles'), return_pointee=False, 
    transformer_creators=[FT.arg_output('circles')])
FT.expose_func(sb.mb.free_fun('HoughLines'), return_pointee=False, 
    transformer_creators=[FT.arg_output('lines')])
FT.expose_func(sb.mb.free_fun('HoughLinesP'), return_pointee=False, 
    transformer_creators=[FT.arg_output('lines')])

# getOptimalNewCameraMatrix
FT.expose_func(sb.mb.free_fun('getOptimalNewCameraMatrix'), return_pointee=False, 
Esempio n. 9
0
    'cvStartWindowThread', 'cvResizeWindow', 'cvMoveWindow', 
    'cvGetWindowName', 
    'cvConvertImage', 
    # 'cvWaitKey', 'cvGrabFrame', 'cvGetCaptureProperty', 'cvSetCaptureProperty', 'cvGetCaptureDomain',
    # 'cvWriteFrame',
    ):
    sb.mb.free_fun(z).include()
    
# CV_FOURCC -- turn it off, we've got ctypes code for it
try:
    sb.mb.free_fun('CV_FOURCC').exclude()
except:
    pass
    
# cvInitSystem
FT.expose_func(sb.mb.free_fun('cvInitSystem'), return_pointee=False, transformer_creators=[
    FT.input_list_of_string('argv', 'argc')])

# cvGetWindowHandle, wait until requested

# setMouseCallback
z = sb.mb.free_fun('cvSetMouseCallback')
FT.expose_func(z, transformer_creators=[FT.mouse_callback_func('on_mouse', 'param')])
FT.add_underscore(z)
sb.cc.write('''
def setMouseCallback(window_name, on_mouse, param=None):
    _windows_callbacks.setdefault(window_name,{})["mouse"] = _ext._cvSetMouseCallback(window_name, on_mouse, param=param)
setMouseCallback.__doc__ = _ext._cvSetMouseCallback.__doc__
''')

# destroyWindow
z = sb.mb.free_fun('cvDestroyWindow')
Esempio n. 10
0
def CV_IS_HAAR_CLASSIFIER(haar_cascade):
    return isinstance(haar_cascade, CvHaarClassifierCascade) and \
        haar_cascade.flags&CV_MAGIC_MASK==CV_HAAR_MAGIC_VAL

''')

z = sb.mb.class_('CvConnectedComp')
sb.init_class(z)
sb.register_ti('CvConnectedComp')
sb.expose_class_vector('CvConnectedComp')
sb.finalize_class(z)
sb.expose_class_Seq('CvConnectedComp')

# cvEndFindContours -- from cv_h_gen.py
z = sb.mb.free_fun('cvEndFindContours')
FT.expose_func(z, ward_indices=(1, ))
FT.add_underscore(z)
sb.cc.write('''
def endFindContours(scanner):
    z = _ext._cvEndFindContours(scanner)
    scanner._ownershiplevel = 0 # not owning the structure anymore
    return z
endFindContours.__doc__ = _ext._cvEndFindContours.__doc__
''')

# CvContourScanner
z = sb.mb.class_('_CvContourScanner')
sb.init_class(z)
z.rename('CvContourScanner')
sb.insert_del_interface('CvContourScanner', '_ext._cvEndFindContours')
sb.finalize_class(z)