<s> from SimpleCV . base import * <EOL> class HaarCascade ( ) : <EOL> """<STR_LIT>""" <EOL> _mCascade = None <EOL> _mName = None <EOL> _cache = { } <EOL> _fhandle = None <EOL> def __init__ ( self , fname = None , name = None ) : <EOL> if ( name is None ) : <EOL> self . _mName = fname <EOL> else : <EOL> self . _mName = name <EOL> if fname is not None : <EOL> if os . path . exists ( fname ) : <EOL> self . _fhandle = os . path . abspath ( fname ) <EOL> else : <EOL> self . _fhandle = os . path . join ( LAUNCH_PATH , '<STR_LIT>' , '<STR_LIT>' , fname ) <EOL> if ( not os . path . exists ( self . _fhandle ) ) : <EOL> logger . warning ( "<STR_LIT>" + fname ) <EOL> logger . warning ( "<STR_LIT>" ) <EOL> return None <EOL> self . _mCascade = cv . Load ( self . _fhandle ) <EOL> if HaarCascade . _cache . has_key ( self . _fhandle ) : <EOL> self . _mCascade = HaarCascade . _cache [ self . _fhandle ] <EOL> return <EOL> HaarCascade . _cache [ self . _fhandle ] = self . _mCascade <EOL> def load ( self , fname = None , name = None ) : <EOL> if ( name is None ) : <EOL> self . _mName = fname <EOL> else : <EOL> self . _mName = name <EOL> if fname is not None : <EOL> if os . path . exists ( fname ) : <EOL> self . _fhandle = os . path . abspath ( fname ) <EOL> else : <EOL> self . _fhandle = os . path . join ( LAUNCH_PATH , '<STR_LIT>' , '<STR_LIT>' , fname ) <EOL> if ( not os . path . exists ( self . _fhandle ) ) : <EOL> logger . warning ( "<STR_LIT>" + fname ) <EOL> logger . warning ( "<STR_LIT>" ) <EOL> return None <EOL> self . _mCascade = cv . Load ( self . _fhandle ) <EOL> if HaarCascade . _cache . has_key ( self . _fhandle ) : <EOL> self . _mCascade = HaarCascade . _cache [ fname ] <EOL> return <EOL> HaarCascade . _cache [ self . _fhandle ] = self . _mCascade <EOL> else : <EOL> logger . warning ( "<STR_LIT>" ) <EOL> def getCascade ( self ) : <EOL> return self . _mCascade <EOL> def getName ( self ) : <EOL> return self . _mName <EOL> def setName ( self , name ) : <EOL> self . _mName = name <EOL> def getFHandle ( self ) : <EOL> return self . _fhandle </s>
