Skip to content

adjustable greyscale #1

@vivarose

Description

@vivarose

Right now, there is only function to convert the color movie to greyscale:

@pims.pipeline
def grayscale(frame):
    """Converts a frame to grayscale."""
    # This function is for use with pims pipelines, which expect RGB.
    # For single frames with OpenCV, use cv2.cvtColor.
    red = frame[:, :, 0]
    green = frame[:, :, 1]
    blue = frame[:, :, 2]
    return (1/3.0) * red + (1/3.0) * green + (1/3.0) * blue

This is a simple way to greyscale but it won't work in every situation. For example, if I want to track green particles but not red particles or vice versa (ref: https://arxiv.org/pdf/1806.05760, page 5, Fig. 2), then I need flexibility in the greyscale function.

Maybe a fun and elegant way to do it would be to make sliders for R G and B. (This could be a new page instead of trying to fit it on an existing page.)
Then code it so that the three colors are proportionate to the sliders. (Note that they must be scaled before adding because PIMS will mod 256, which is super annoying.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions