Simulate-Correct-ColorBlindness icon indicating copy to clipboard operation
Simulate-Correct-ColorBlindness copied to clipboard

Collapse when correcting images with alpha channel

Open Krankheit opened this issue 1 year ago • 0 comments

I am so grateful for your excellent work! However, the program collapses when I tried to correct an image with alpha channel.

Solution: Alpha channel should be ignored when reading an image.

class Utils:
    """
    Couple of utils for loading the images.
    """
    @staticmethod
    def load_rgb(path):
        img_rgb = np.array(Image.open(path)) / 255
        return img_rgb # Here should be img_rgb[:,:,:3] like in load_lms()

    @staticmethod
    def load_lms(path):
        img_rgb = np.array(Image.open(path)) / 255
        img_lms = np.dot(img_rgb[:,:,:3], Transforms.rgb_to_lms())

        return img_lms

Krankheit avatar May 09 '23 10:05 Krankheit