Open hmswaffles opened 3 years ago
It's a good idea. The original RGBA example was nice just because it was a simple to explain 4D space that people could still have some basic intuition for. I would be happy to look at a PR for the same walkthrough with CIELab or similar.
So I've started working on this... Using CIELab coordinates results in UMAP reductions with more intuitive color <=> spatial differences (especially for the N=1 component image -- all of the points are nicely separated into colored bands.) On the other hand, CIELab is only a three-dimensional space, which means that the N=3 components reduction is moot.
Perhaps you could interleave the two options, explaining why CIELab makes more sense, but use the RGBa where appropriate. The different metrics section at the end is also probably easier in straight RGBa. So perhaps there is a nice balance between the two?
I think I've solved the problem another way due to the fact that CIELab is about color and alpha is about transparency. I can generate 4D coordinates where the first three are Lab coordinates, and the fourth is an alpha coordinate. Such 4d points can be run through UMap. Then for coloring I can convert the Lab coordinates to RGB, and combine them with the appropriate alpha coordinate... Voila, perceptual RGBa.
Colorspace purists (?) might balk, but the initial results look good.
Color space purists will definitely balk more at the pure RGBa version.
In the documentation about parameters, 4-dimensional RGBa color coordinates are visualized in 2D, and colored, to showcase how various UMAP parameters affect the final reduction. However, RGBa is not a perceptual color space, which means readers' intuitions about which points should be grouped together based on color similarity will be off.
One could instead convert the RGBa coordinates to CIELab (a perceptual colorspace). One way to do this is to go from RGBa to RGB, and then RGB to CIELab (a perceptual color space) via the color transformation functions found here: https://scikit-image.org/docs/dev/api/skimage.color.html. There might be other ways to do this conversion as well.