Hi everybody,
is there any grasshopper plugin that allows me to draw a 3D colour space in rhino in form of a point cloud? or something similar? I’d like to draw colour spaces in rhino and extract points from those spaces based on proximity to other points.
If you want to suggest other software or web apps to do this task let me know!
Just a note on this, in the last years it happened I had to work on a few projects that involved color quantization, and if you want to use euclidean distance (let’s say Closest Point) to find the closest match for a given color from a smaller palette then, in order to simulate the human eye behavior, RGB color space is very much not the best option
if possible go for LAB color space for those kind ok proximity match
yep, that’s exactly what i wanted to do, my plan was to use oklab space, but I still have no idea on how to place it in rhino 3D space, do you have any resource that deals with it?
generally speaking, not only euclidean distance between different colors is more reliable in Lab than in RGB color space, but also clusterizing colors (for instance k-means) yelds better results
this def will work on R8 only, and will take maybe a couple of minutes at very first launch because it has to download the colormath Python library
it just happened today I had to exhume those buried rgb/lab experiments
this topic came to my mind and I thought of dropping a brief visual-note
after sampling image-pixel colors in a grid, which results in a list of RGB, K-means clustering was used on both the RGB color list and the very same color translated into LAB to find 20 clusters
example of LAB k-means clustering result
then, each grid point was given the color of the average of the respective group, and here is a result
as k-means method implies a random starting position (seed) you can run the algorithm n times and get n different groupings, but the results are somehow similar among each other
this said, it also depends on the image you are working on, its lighting, color variation etc…
but generally speaking, for most seeds my eyes prefer the result calculated through LAB color space
but if you have an image and you want to reproduce it using a given, fixed, limited palette of different colors that have already been chosen ahead (which is more or less what I’m working on now), in that case:
a) you don’t want to get “islands” of the very same color, even if that particular color is the closest you can get from your available palette, and
b) you want to use as many palette-available-colors as possible, despite some of them being very far away from the colors in your image…
it kinda worked, but the result oklab 3D gamut is very deformed and I don’t think it’s correct especially because there is a big gap between blue shades, anyone can help me understand what did I do wrong?
attached you can find the GH script.
To install the library I’ve located Rhino python folder and I’ve installed the library via powershel by typing “pip install --user colour-science”, but this is not really convenient, if you have a better way to do it let me know!
I had to change windows environment variables to make windows able to see rhino python as explained here: https://www.youtube.com/watch?v=dj5oOPaeIqI
PS, I’ve also tried to convert from XYZ to oklab with the help of CHat GPT which didn’t require any plug in and gave me very very similar results to the plugin I’ve used (just a tiny bit translated) you can check it by turning of the relative preview node.