'**SUMMARY**
This method attemps to convert the image to the BGR colorspace.
If the color space is unknown we assume it is in the BGR format.
**RETURNS**
Returns the converted image if the conversion was successful,
otherwise None is returned.
**EXAMPLE**
>>> img = Image("lenna")
>>> BGRImg = img.toBGR()
**SEE ALSO**
:py:meth:`isBGR`'

def toBGR(self):

    retVal = self.getEmpty()
    if ((self._colorSpace == ColorSpace.RGB) or (self._colorSpace == ColorSpace.UNKNOWN)):
        cv.CvtColor(self.getBitmap(), retVal, cv.CV_RGB2BGR)
    elif (self._colorSpace == ColorSpace.HSV):
        cv.CvtColor(self.getBitmap(), retVal, cv.CV_HSV2BGR)
    elif (self._colorSpace == ColorSpace.HLS):
        cv.CvtColor(self.getBitmap(), retVal, cv.CV_HLS2BGR)
    elif (self._colorSpace == ColorSpace.XYZ):
        cv.CvtColor(self.getBitmap(), retVal, cv.CV_XYZ2BGR)
    elif (self._colorSpace == ColorSpace.YCrCb):
        cv.CvtColor(self.getBitmap(), retVal, cv.CV_YCrCb2BGR)
    elif (self._colorSpace == ColorSpace.BGR):
        retVal = self.getBitmap()
    else:
        logger.warning('Image.toBGR:    There    is    no    supported    conversion    to    BGR    colorspace')
        return None
    return Image(retVal, colorSpace=ColorSpace.BGR)
