def rgb_to_brightness(r, g, b, grayscale=False):
    """
    Calc a brightness factor according to rgb color
    """
    if grayscale:
        return 0.2126*r + 0.7152*g + 0.0722*b
    else:
        return 0.267*r + 0.642*g + 0.091*b

    Calc a brightness factor according to rgb color
    
video_to_ascii/render_strategy/image_processor.py