'Extract the bulk of the data from a give blob. If the blob\'s are is too large
or too small the method returns none.'

def _extractData(self, seq, color, minsize, maxsize, appx_level):

    if ((seq is None) or (not len(seq))):
        return None
    area = cv.ContourArea(seq)
    if ((area < minsize) or (area > maxsize)):
        return None
    retVal = Blob()
    retVal.image = color
    retVal.mArea = area
    retVal.mMinRectangle = cv.MinAreaRect2(seq)
    bb = cv.BoundingRect(seq)
    retVal.x = (bb[0] + (bb[2] / 2))
    retVal.y = (bb[1] + (bb[3] / 2))
    retVal.mPerimeter = cv.ArcLength(seq)
    if (seq is not None):
        retVal.mContour = list(seq)
        try:
            import cv2
            if (retVal.mContour is not None):
                retVal.mContourAppx = []
                appx = cv2.approxPolyDP(np.array([retVal.mContour], 'float32'), appx_level, True)
                for p in appx:
                    retVal.mContourAppx.append((int(p[0][0]), int(p[0][1])))
        except:
            pass
    xx = bb[0]
    yy = bb[1]
    ww = bb[2]
    hh = bb[3]
    retVal.points = [(xx, yy), ((xx + ww), yy), ((xx + ww), (yy + hh)), (xx, (yy + hh))]
    retVal._updateExtents()
    chull = cv.ConvexHull2(seq, cv.CreateMemStorage(), return_points=1)
    retVal.mConvexHull = list(chull)
    del chull
    moments = cv.Moments(seq)
    retVal.m00 = area
    try:
        retVal.m10 = moments.m10
        retVal.m01 = moments.m01
        retVal.m11 = moments.m11
        retVal.m20 = moments.m20
        retVal.m02 = moments.m02
        retVal.m21 = moments.m21
        retVal.m12 = moments.m12
    except:
        retVal.m10 = cv.GetSpatialMoment(moments, 1, 0)
        retVal.m01 = cv.GetSpatialMoment(moments, 0, 1)
        retVal.m11 = cv.GetSpatialMoment(moments, 1, 1)
        retVal.m20 = cv.GetSpatialMoment(moments, 2, 0)
        retVal.m02 = cv.GetSpatialMoment(moments, 0, 2)
        retVal.m21 = cv.GetSpatialMoment(moments, 2, 1)
        retVal.m12 = cv.GetSpatialMoment(moments, 1, 2)
    retVal.mHu = cv.GetHuMoments(moments)
    mask = self._getMask(seq, bb)
    retVal.mAvgColor = self._getAvg(color.getBitmap(), bb, mask)
    retVal.mAvgColor = retVal.mAvgColor[0:3]
    retVal.mHoleContour = self._getHoles(seq)
    retVal.mAspectRatio = (retVal.mMinRectangle[1][0] / retVal.mMinRectangle[1][1])
    return retVal
