Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential test case: Convert RGB image to CMY #158

Open
Romain-Laine opened this issue Nov 29, 2024 · 1 comment
Open

Potential test case: Convert RGB image to CMY #158

Romain-Laine opened this issue Nov 29, 2024 · 1 comment

Comments

@Romain-Laine
Copy link

Here's a snippet that converts an RGB image into a CMY (Cyan Magenta Yellow) image.

def convert_rgb_to_cmy(rgb_image: np.ndarray) --> np.ndarray:
    """
    Convert and RGB image into a CMY image
    Arguments:
    - rgb_image: input RGB image of shape [width, height, 3]
    Output:
    - CMY image
    """
    cmy_image = np.zeros((imgs.shape[0], imgs.shape[1], 3))
    cmy_image[:, :, 0] = rgb_image[:, :, 0] + rgb_image[:, :, 2]
    cmy_image[:, :, 1] = rgb_image[:, :, 0] + rgb_image[:, :, 1]
    cmy_image[:, :, 2] = rgb_image[:, :, 2] + rgb_image[:, :, 1]

    return np.clip(cmy_image, 0, 1)
@haesleinhuepf
Copy link
Owner

Hi @Romain-Laine ,

that's a good one! Would you mind sending a Pull-request with this? Also consider rewriting the docstring a bit so that it's more like a sentence a human has written, and less technically formatted.

Thanks!

Best,
Robert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants