'**SUMMARY**
Apply a binary mask to the image. The white areas of the mask will be kept,
and the black areas removed. The removed areas will be set to the color of
bg_color.
**PARAMETERS**
* *mask* - the binary mask image. White areas are kept, black areas are removed.
* *bg_color* - the color of the background on the mask.
**RETURNS**
A binary (black/white) image mask as a SimpleCV Image.
**EXAMPLE**
>>> img = Image("lenna")
>>> mask = img.createBinaryMask(color1=(0,128,128),color2=(255,255,255)
>>> result = img.applyBinaryMask(mask)
>>> result.show()
**SEE ALSO**
:py:meth:`createBinaryMask`
:py:meth:`createAlphaMask`
:py:meth:`applyBinaryMask`
:py:meth:`blit`
:py:meth:`threshold`'

def applyBinaryMask(self, mask, bg_color=Color.BLACK):

    newCanvas = cv.CreateImage((self.width, self.height), cv.IPL_DEPTH_8U, 3)
    cv.SetZero(newCanvas)
    newBG = cv.RGB(bg_color[0], bg_color[1], bg_color[2])
    cv.AddS(newCanvas, newBG, newCanvas)
    if ((mask.width != self.width) or (mask.height != self.height)):
        logger.warning("Image.applyBinaryMask:    your    mask    and    image    don't    match    sizes,    if    the    mask    doesn't    fit,    you    can't    apply    it!    Try    using    the    scale    function.    ")
        return None
    cv.Copy(self.getBitmap(), newCanvas, mask.getBitmap())
    return Image(newCanvas, colorSpace=self._colorSpace)
