def makecoloredlayer(img, mask, color=(0, 255, 0)):
    ' Create an image based on provided mask, dimensions and color (default is red)\n\n    :param mask: binary mask defining the zone needing color, the rest will be black\n    :param img: numpy.array used for dimensions\n    :param color: 3 dimension tuple (B,G,R)\n    :return:\n    '
    coloredlayer = np.zeros(img.shape, dtype='uint8')
    cv2.rectangle(coloredlayer, (0, 0), (img.shape[1], img.shape[0]), color, (- 1))
    maskedlayer = cv2.bitwise_or(img, coloredlayer, mask=mask)
    return maskedlayer
Create an image based on provided mask, dimensions and color (default is red)

:param mask: binary mask defining the zone needing color, the rest will be black
:param img: numpy.array used for dimensions
:param color: 3 dimension tuple (B,G,R)
:return:
def makecoloredlayer(img, mask, color=(0, 255, 0)):
    ' Create an image based on provided mask, dimensions and color (default is red)\n\n    :param mask: binary mask defining the zone needing color, the rest will be black\n    :param img: numpy.array used for dimensions\n    :param color: 3 dimension tuple (B,G,R)\n    :return:\n    '
    coloredlayer = np.zeros(img.shape, dtype='uint8')
    cv2.rectangle(coloredlayer, (0, 0), (img.shape[1], img.shape[0]), color, (- 1))
    maskedlayer = cv2.bitwise_or(img, coloredlayer, mask=mask)
    return maskedlayer