Module Expr Str Import alias identifier Import alias identifier Import alias Import alias Assign NameStore Str Assign NameStore Str Assign NameStore Str Assign NameStore Str ClassDef bases body FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Num NameLoad body Expr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Raise NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr If AttributeLoad NameLoad attr body Assign NameStore BinOpSub Num BinOpPow AttributeLoad NameLoad attr BinOpDiv UnaryOpUSub BinOpMult Num NameLoad AttributeLoad NameLoad attr orelse Assign NameStore CompareGt Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr Return Call AttributeLoad NameLoad attr BinOpMult NameLoad Num decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Num NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Num attr Assign NameStore Call AttributeLoad Call AttributeLoad AttributeLoad NameLoad attr attr attr Assign NameStore Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Num attr Assign NameStore Call AttributeLoad NameLoad attr BinOpSub NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr BinOpSub NameLoad NameLoad Return Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Num NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr If Call AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str For NameStore Call NameLoad Call NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr SubscriptLoad AttributeLoad NameLoad attr Index NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Call NameLoad AttributeLoad NameLoad attr Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index Num Assign NameStore NameLoad For NameStore Call NameLoad Num BinOpDiv NameLoad Num body If CompareEq NameLoad NameLoad body Assign NameStore AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad attr orelse Assign NameStore BinOpMult NameLoad AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad attr Assign TupleStore NameStore NameStore NameStore AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr Num Expr Call AttributeLoad NameLoad attr NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad Call AttributeLoad NameLoad attr Num Num BinOpSub NameLoad Num BinOpSub NameLoad Num attr Expr Call AttributeLoad NameLoad attr NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index BinOpSub NameLoad Num Assign NameStore NameLoad For NameStore Call NameLoad BinOpSub NameLoad Num BinOpDiv NameLoad Num Num body If CompareEq NameLoad NameLoad body Assign NameStore AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad attr orelse Assign NameStore BinOpMult NameLoad AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad attr Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index BinOpDiv NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr BinOpSub NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr BinOpSub NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Return Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Num NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr keyword Num Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad Call AttributeLoad AttributeLoad NameLoad attr attr attr Assign NameStore Call AttributeLoad NameLoad attr Return BinOpSub NameLoad NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Num NameLoad body If UnaryOpNot Call AttributeLoad NameLoad attr body Raise Call NameLoad Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Assign NameStore BinOpMult CompareGt NameLoad NameLoad Num Assign NameStore BinOpMult CompareLt NameLoad NameLoad Num Assign AttributeStore NameLoad attr BinOpSub BinOpAdd AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad Call AttributeLoad AttributeLoad NameLoad attr attr attr Assign NameStore AttributeLoad NameLoad attr Return BinOpSub NameLoad NameLoad decorator_list decorator_list
N/A N/A 
Created on Oct 22, 2010
@author: Stephen O'Hara
 N/A scipy sp N/A pyvision pv N/A math N/A cv N/A BG_SUBTRACT_FD BG_SUBTRACT_FD N/A BG_SUBTRACT_MCFD BG_SUBTRACT_MCFD N/A BG_SUBTRACT_MF BG_SUBTRACT_MF N/A BG_SUBTRACT_AMF BG_SUBTRACT_AMF AbstractBGModel N/A N/A __init__ N/A N/A self imageBuffer thresh soft_thresh N/A 20 False N/A N/A 
        @param imageBuffer: An ImageBuffer object that has already been filled
        with the appropriate number of images. (Provide a full buffer...so a few
        frames of initialization will be required in most cases to fill up a
        newly created buffer.)     
        @param thresh: A noise threshold to remove very small differences.    
         N/A N/A self _imageBuffer imageBuffer N/A N/A self _threshold thresh N/A N/A self _softThreshold soft_thresh N/A _computeBGDiff N/A N/A self N/A N/A N/A 
        This private method should be overridden by a concrete background subtraction
        class to yield a difference image from the background model.
         N/A NotImplemented N/A getForegroundMask N/A N/A self N/A N/A N/A 
        @return: A mask image indicating which pixels are considered foreground.
          Depending on whether soft-thresholding is used, this may be a binary image
          with values of [0 or 255], or image of weights [0.0-255.0], which will
          have to be divided by 255 to get weights [0.0-1.0].         
        @note: One may wish to perform additional morphological operations
            on the foreground mask prior to use.
         N/A diff N/A N/A self _computeBGDiff N/A N/A self _softThreshold N/A N/A mask N/A 1 N/A N/A math e N/A N/A N/A 1.0 diff N/A self _threshold N/A N/A mask N/A N/A N/A sp absolute diff N/A self _threshold N/A N/A N/A pv Image N/A mask 255.0 N/A N/A FrameDifferencer N/A AbstractBGModel N/A N/A 
    This class is useful for simple N-frame differencing method of
    background subtraction. If you have a stationary camera, this can
    be a simple and effective way to isolate people/moving objects
    from the background scene.
    
    FrameDifferencer uses ImageBuffer for operation. Assume the buffer
    size is 5. The output of the frame differencing operation will
    be based on the middle image, the 3rd in the buffer. The output
    is the intersection of the following two absolute differences:
    abs(Middle-First) AND abs(Last-Middle).
     __init__ N/A N/A self imageBuffer thresh soft_thresh N/A 20 False N/A N/A N/A N/A AbstractBGModel __init__ self imageBuffer thresh soft_thresh N/A _computeBGDiff N/A N/A self N/A N/A N/A prevImg N/A N/A N/A N/A self _imageBuffer N/A 0 asMatrix2D N/A curImg N/A N/A N/A N/A N/A self _imageBuffer getMiddle asMatrix2D N/A nextImg N/A N/A N/A N/A self _imageBuffer N/A -1 asMatrix2D N/A delta1 N/A N/A sp absolute N/A curImg prevImg N/A delta2 N/A N/A sp absolute N/A nextImg curImg N/A N/A N/A sp minimum delta1 delta2 N/A N/A MotionCompensatedFrameDifferencer N/A AbstractBGModel N/A N/A 
    This class represents a more sophisticated frame differencing
    algorithm that takes into account potential camera motion, and
    applies a registration method to align subsequent images prior
    to frame subtraction.
     __init__ N/A N/A self imageBuffer thresh soft_thresh N/A 20 False N/A N/A N/A N/A AbstractBGModel __init__ self imageBuffer thresh soft_thresh N/A N/A self _flow N/A N/A pv OpticalFlow N/A N/A N/A imageBuffer isFull N/A N/A N/A N/A self _initFlow N/A _initFlow N/A N/A self N/A N/A N/A 
        Should be called after buffer is full to compute the optical flow
        information on the buffered frames. Only needs to be called once,
        prior to first call of _computeBGDiff(), because from then on,
        the flow will be updated as new frames are added to the buffer.
         N/A i N/A range N/A len N/A self _imageBuffer N/A N/A N/A N/A N/A self _flow update N/A N/A self _imageBuffer N/A i N/A getOpticalFlow N/A N/A self N/A N/A N/A 
        @return: A handle to the pv.OpticalFlow object being used by this object.
         N/A N/A self _flow N/A setOpticalFlow N/A N/A self OF_Object N/A N/A N/A 
        This is an optional method that allows the user to provide an
        optical flow object (pv.OpticalFlow) with non-default settings.
        @param OF_Object: The optical flow object desired for use in computing the
        motion compensated frame difference.
         N/A N/A self _flow OF_Object N/A _computeBGDiff N/A N/A self N/A N/A N/A N/A N/A N/A self _flow update N/A N/A N/A self _imageBuffer getLast N/A n N/A len N/A self _imageBuffer N/A prev_im N/A N/A self _imageBuffer N/A 0 N/A forward None N/A i N/A range 0 N/A n 2 N/A N/A N/A forward None N/A N/A forward N/A N/A N/A self _imageBuffer N/A i to_next N/A N/A forward N/A forward N/A N/A N/A self _imageBuffer N/A i to_next N/A N/A w h size N/A prev_im size N/A mask N/A N/A cv CreateImage size N/A cv IPL_DEPTH_8U 1 N/A N/A N/A cv Set mask 0 N/A interior N/A N/A cv GetSubRect mask N/A N/A N/A N/A pv Rect 2 2 N/A w 4 N/A h 4 asOpenCV N/A N/A N/A cv Set interior 255 N/A mask N/A N/A pv Image mask N/A prev_im N/A forward prev_im N/A prev_mask N/A forward mask N/A next_im N/A N/A self _imageBuffer N/A N/A n 1 N/A back None N/A i N/A range N/A n 1 N/A n 2 -1 N/A N/A N/A back None N/A N/A back N/A N/A N/A self _imageBuffer N/A i to_prev N/A N/A back N/A back N/A N/A N/A self _imageBuffer N/A i to_prev N/A next_im N/A back next_im N/A next_mask N/A back mask N/A curr_im N/A N/A self _imageBuffer N/A N/A n 2 N/A prevImg N/A N/A prev_im asMatrix2D N/A curImg N/A N/A curr_im asMatrix2D N/A nextImg N/A N/A next_im asMatrix2D N/A prevMask N/A N/A prev_mask asMatrix2D N/A nextMask N/A N/A next_mask asMatrix2D N/A delta1 N/A N/A sp absolute N/A curImg prevImg N/A delta2 N/A N/A sp absolute N/A nextImg curImg N/A delta1 N/A N/A sp minimum delta1 prevMask N/A delta2 N/A N/A sp minimum delta2 nextMask N/A N/A N/A sp minimum delta1 delta2 N/A N/A MedianFilter N/A AbstractBGModel N/A N/A 
    Uses median pixel values of the images in a buffer to
    approximate a background model.
     __init__ N/A N/A self imageBuffer thresh soft_thresh N/A 20 False N/A N/A N/A N/A AbstractBGModel __init__ self imageBuffer thresh soft_thresh N/A _getMedianVals N/A N/A self N/A N/A N/A 
        @return: A scipy matrix representing the gray-scale median values of the image stack.
           If you want a pyvision image, just wrap the result in pv.Image(result).
         N/A N/A self _imageStack N/A N/A N/A self _imageBuffer asStackBW N/A medians N/A N/A sp median N/A self _imageStack axis 0 N/A medians N/A _computeBGDiff N/A N/A self N/A N/A N/A imgGray N/A N/A N/A N/A N/A self _imageBuffer getLast asMatrix2D N/A imgBG N/A N/A self _getMedianVals N/A N/A imgGray imgBG N/A N/A ApproximateMedianFilter N/A MedianFilter N/A N/A 
    Approximates the median pixels via an efficient incremental algorithm that
    would converge to the true median in a perfect world. It initializes a
    median image based on the images in the initial image buffer, but
    then only updates the median image using the last (newest) image in the
    buffer.
     __init__ N/A N/A self imageBuffer thresh soft_thresh N/A 20 False N/A N/A N/A N/A N/A imageBuffer isFull N/A N/A N/A ValueError Image Buffer must be full before initializing Approx. Median Filter. N/A N/A N/A MedianFilter __init__ self imageBuffer thresh soft_thresh N/A N/A self _medians N/A N/A self _getMedianVals N/A _updateMedian N/A N/A self N/A N/A N/A curImg N/A N/A N/A self _imageBuffer getLast N/A curMat N/A N/A curImg asMatrix2D N/A median N/A self _medians N/A up N/A N/A curMat median 1.0 N/A down N/A N/A curMat median 1.0 N/A N/A self _medians N/A N/A N/A self _medians up down N/A _computeBGDiff N/A N/A self N/A N/A N/A N/A N/A self _updateMedian N/A imgGray N/A N/A N/A N/A N/A self _imageBuffer getLast asMatrix2D N/A imgBG N/A self _medians N/A N/A imgGray imgBG N/A N/A