'Return a binary image of a particular contour sequence.'

def _getMask(self, seq, bb):

    mask = cv.CreateImage((bb[2], bb[3]), cv.IPL_DEPTH_8U, 1)
    cv.Zero(mask)
    cv.DrawContours(mask, seq, 255, 0, 0, thickness=(-1), offset=(((-1) * bb[0]), ((-1) * bb[1])))
    holes = seq.v_next()
    if (holes is not None):
        cv.DrawContours(mask, holes, 0, 255, 0, thickness=(-1), offset=(((-1) * bb[0]), ((-1) * bb[1])))
        while (holes.h_next() is not None):
            holes = holes.h_next()
            if (holes is not None):
                cv.DrawContours(mask, holes, 0, 255, 0, thickness=(-1), offset=(((-1) * bb[0]), ((-1) * bb[1])))
    return mask
