blob
index
c:\users\sarah\projects\ihart\server\src\blob.py

Models an instance of detected motion or a detected face.

 
Classes
       
Blob

 
class Blob
    Stores the starting (leftX, topY) and ending (rightX, bottomY) coordinates of
either an area of motion, or a face. Performs slight analysis of the coordinates
by checking for overlap with another (given) Blob, and by scaling the coordinates
for a given set of dimensions when also given the current width and height.
 
  Methods defined here:
__init__(self, leftX, rightX, topY, bottomY, width, height)
Initializes all instance fields of Blob. Requires leftX and topY, and either
rightX and bottomY or width and height (will fill in the two excluded fields
using the given four). To exclude a field, pass in -1 or None.
 
@param leftX: the starting x of the blob.
@param rightX: the ending x of the blob.
               (can be substituted with both width and height)
               (to exclude, pass in -1)
@param topY: the starting y of the blob.
@param bottomY: the ending y of the blob.
                (can be substituted with both width and height)
                (to exclude, pass in -1)
@param width: the width of the blob.
              (can be substituted with rightX and bottomY)
              (to exclude, pass in -1)
@param height: the height of the blob.
               (can be substituted with rightX and bottomY)
               (to exclude, pass in -1)
@return: none
__iter__(self)
Defined so that Blob can be added to a list.
object.__iter__ is called when one needs to iterate over an object.
@return: self
next(self)
Defined so that Blob can be added to a list.
Since Blob does not contain data to be iterated over within itself,
stops iteration immediately by raising StopIteration.
@return: none
overlap(self, other, withinAmount)
Determines whether the blob (itself) intersects with the given blob.
withinAmount should be between 0 and 0.9, inclusive, but does not have to be.
withinAmount is used to increase the chances of intersection: for each comparison
between two fields of the blobs, one of those is multiplied by (1 + withinAmount) or
(1 - withinAmount). Without a withinAmount larger than 0, it is unlikely that two blobs
would ever intersect.
 
@param other: The Blob to check for intersection with.
@param withinAmount: The amount to increase or decrease a field by to increase chances of intersection.
                     Expected: 0 to 0.9, inclusive
@return: True it the two Blobs overlap with each other; False if they don't.
scaleXYWH(self, currentArea, newWidth, newHeight)
Scales the dimensions for a new width and height. This allows the clients to receive data
according to the dimensions of their program. Returns the new dimensions as a tuple,
(leftX, topW, width, height). This call does not change the fields of the blob itself.
@param currentArea: the AreaOfInterest that the blob is in.
                    The Blob can be in multiple areas of interest, and when the message
                    string is being created, scaleXYWH will be called for each one.
                    width and height, and leftX and topY of currentArea are used as part
                    of the calculation to scale the coordinates.
@param newWidth: the width to scale to.
@param newHeight: the height to scale to.
@return list, the scaled [leftX, topY, width, height] of the blob.
updateEndingBoundaries(self)
Recalculates rightX and bottomY using leftX, topY, width, and height
@return: none
updateWH(self)
Recalculates width and height using leftX, rightX, topY, and bottomY.
@return: none

Data and other attributes defined here:
bottomY = 0
height = 0
leftX = 0
rightX = 0
topY = 0
width = 0