def binarize(img):
    ' Take an RGB image and binarize it.\n\n    :param img: cv2 image\n    :return:\n    '
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    (ret, bin) = cv2.threshold(gray, 1, 255, cv2.THRESH_BINARY)
    return bin
Take an RGB image and binarize it.

:param img: cv2 image
:return:
def binarize(img):
    ' Take an RGB image and binarize it.\n\n    :param img: cv2 image\n    :return:\n    '
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    (ret, bin) = cv2.threshold(gray, 1, 255, cv2.THRESH_BINARY)
    return bin