'**SUMMARY**
This method finds the average color of all the pixels in the image and displays tuple in the colorspace specfied by the user.
If no colorspace is specified , (B,G,R) colorspace is taken as default.
**RETURNS**
A tuple of the average image values. Tuples are in the channel order. *For most images this means the results are (B,G,R).*
**EXAMPLE**
>>> img = Image(\'lenna\')
>>> colors = img.meanColor()        # returns tuple in Image\'s colorspace format.
>>> colors = img.meanColor(\'BGR\')   # returns tuple in (B,G,R) format.
>>> colors = img.meanColor(\'RGB\')   # returns tuple in (R,G,B) format.
>>> colors = img.meanColor(\'HSV\')   # returns tuple in (H,S,V) format.
>>> colors = img.meanColor(\'XYZ\')   # returns tuple in (X,Y,Z) format.
>>> colors = img.meanColor(\'Gray\')  # returns float of mean intensity.
>>> colors = img.meanColor(\'YCrCb\') # returns tuple in (Y,Cr,Cb) format.
>>> colors = img.meanColor(\'HLS\')   # returns tuple in (H,L,S) format.'

def meanColor(self, colorSpace=None):

    if (colorSpace == None):
        return tuple(cv.Avg(self.getBitmap())[0:3])
    elif (colorSpace == 'BGR'):
        return tuple(cv.Avg(self.toBGR().getBitmap())[0:3])
    elif (colorSpace == 'RGB'):
        return tuple(cv.Avg(self.toRGB().getBitmap())[0:3])
    elif (colorSpace == 'HSV'):
        return tuple(cv.Avg(self.toHSV().getBitmap())[0:3])
    elif (colorSpace == 'XYZ'):
        return tuple(cv.Avg(self.toXYZ().getBitmap())[0:3])
    elif (colorSpace == 'Gray'):
        return cv.Avg(self._getGrayscaleBitmap())[0]
    elif (colorSpace == 'YCrCb'):
        return tuple(cv.Avg(self.toYCrCb().getBitmap())[0:3])
    elif (colorSpace == 'HLS'):
        return tuple(cv.Avg(self.toHLS().getBitmap())[0:3])
    else:
        logger.warning("Image.meanColor:    There    is    no    supported    conversion    to    the    specified    colorspace.    Use    one    of    these    as    argument:    'BGR'    ,    'RGB'    ,    'HSV'    ,    'Gray'    ,    'XYZ'    ,    'YCrCb'    ,    'HLS'    .")
        return None
