def color_select(self, color='R', binary=True, thresh=None):
    img = np.copy(self.caller.image)
    RGB_colors = {'R': 0, 'G': 1, 'B': 2}
    HLS_colors = {'H': 0, 'L': 1, 'S': 2}
    if (color in RGB_colors):
        channel = img[:, :, RGB_colors[color]]
    elif (color in HLS_colors):
        img = cv2.cvtColor(img, cv2.COLOR_RGB2HLS)
        channel = img[:, :, HLS_colors[color]]
    else:
        channel = self.grayscale()
    if binary:
        if (not thresh):
            thresh = self.threshold
        binary_output = np.zeros_like(img[:, :, 0])
        binary_output[((channel > thresh[0]) & (channel <= thresh[1]))] = 1
        return binary_output
    else:
        return channel
def color_select(self, color='R', binary=True, thresh=None):
    img = np.copy(self.caller.image)
    RGB_colors = {'R': 0, 'G': 1, 'B': 2}
    HLS_colors = {'H': 0, 'L': 1, 'S': 2}
    if (color in RGB_colors):
        channel = img[:, :, RGB_colors[color]]
    elif (color in HLS_colors):
        img = cv2.cvtColor(img, cv2.COLOR_RGB2HLS)
        channel = img[:, :, HLS_colors[color]]
    else:
        channel = self.grayscale()
    if binary:
        if (not thresh):
            thresh = self.threshold
        binary_output = np.zeros_like(img[:, :, 0])
        binary_output[((channel > thresh[0]) & (channel <= thresh[1]))] = 1
        return binary_output
    else:
        return channel