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

Add a function like rgbplot for other color formats and generic data #580

Open
eugenioLR opened this issue Mar 28, 2023 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@eugenioLR
Copy link
Contributor

eugenioLR commented Mar 28, 2023

I think it would be a good idea to make a function like rgbplot, showing the channels of each image separately, but not assuming it's an image in RGB, it could be an image in other color formats or even generic data (as could be the case in a deep learning problem) where there could be any number of channels to an image.

It could also be a good idea to make something like ImageGrid, but where each row is a different image and each column is a different channel of the image, but i'm not so sure about this because you can manually do it with existing functions.

I've made some code in this respect already, so if it this seems like a good idea i can make a pull request when we have discussed all the necesary details.

@eugenioLR eugenioLR changed the title Add function like rgbplot for other color formats and generic data Add a function like rgbplot for other color formats and generic data Mar 28, 2023
@SarthakJariwala
Copy link
Owner

Thanks for the suggestions, @eugenioLR!

Re your first suggestion: Please correct me if I'm misunderstanding your suggestion, but I thinkImageGrid already does this for generic data and all color formats, and rgbplot is just meant to be a specialized case of ImageGrid. Or are you suggesting a function like cmykplot?

Re second suggestion: I really like this idea and am open to having it as a feature. It could be a value add to make plotting these kinds of data easier. Can you propose the API you have in mind for this? And I agree; let's hash out the details about the API before the PR.

@SarthakJariwala SarthakJariwala added the enhancement New feature or request label Apr 21, 2023
@eugenioLR
Copy link
Contributor Author

eugenioLR commented Apr 21, 2023

For the first idea:
Now that i think about it, you are right, you can already do this. However it could be nice to have the option to make the distinction between a sequence of images and a single image with multiple channels in terms of the names of the function, this could be implemented just as an alias, which is not that different from rgbplot.

This could be further distinguished from ImageGrid by having some default colormaps given by a parameter that could be called "img_format" or something like that, and could have as a value RGB, CMYK, HSV... that would assume the input image was in one of those formats and apply some colors by default. Maybe it could be interesting to also convert from RGB to HSV for example, but it is still true that i didn't realize you could do that already and it maybe is not as necessary as i thought.

For the second idea:
The function to implement this could be called plot_channels or something similar and would receive a (N,X,Y,C) array or a list of N images of size (X, Y, C) as the input data. It would generate a NxC grid of images, where each row is a different image and each column is a different channel. The parameters that are passed as lists in ImageGrid like cmap would need to have a length of C, instead of the NxC size that was required with the other method and would be applied equally on each row. Esencially the API would be similar to ImageGrid but the parameters are given for each channel and replicated for each image.

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

No branches or pull requests

2 participants