Azzera filtri
Azzera filtri

Better "probabilities"?

2 visualizzazioni (ultimi 30 giorni)
Roger Breton
Roger Breton il 13 Mag 2024
Commentato: Roger Breton il 21 Mag 2024
I created a small script in which I present two random colors to the user. See attached script.
As you can see, on the left, are the two RGB colors calculated using "rand" function. On the left is the colors plotted on an CIE ab diagram. I intend to use this script with my students to discuss "Color Harmonies". This is a "diad". Next up, is a "trad".
First question
What I'd like to know is how "effective" is the rand function? Would there be more "advanced" ways of coming up with those two colors?
The motivation behind this script is to get the students thinking "outside of the box", to move them away from getting "inspiration" from all kinds of "real-world" objects and only look at the "sensation" produced b the colors.
Second question
I would like to explore generating random colors from my Munsell Book of Color 1600 measured CIE Lab colors. This is how I bring in my Munsell color data from an Excel file:
% Import TAB-delimited file
file_path = 'Munsell Glossy All Colors Extracted (2024 03 21) TAB.txt';
my_table = readtable(file_path, 'Delimiter', '\t', 'ReadVariableNames', false);
MunsellNotationTMP = my_table{:, 1}; % Text data
MunsellNotation = string(MunsellNotationTMP);
HVCcolumns_Lab = my_table{:, 2:4}; % Numeric data
HVC_Lab = [HVCcolumns_Lab(:, 1), HVCcolumns_Lab(:, 2), HVCcolumns_Lab(:, 3)];

Risposte (1)

John D'Errico
John D'Errico il 13 Mag 2024
Modificato: John D'Errico il 13 Mag 2024
How effective is rand? I'm not sure what you mean by "effective", or for that matter, "advanced". It is a state of the art random number generator. So no, you cannot do better in terms of randomness, and what you did with it seems reasonable. Perhaps only with the caveat that you could, randomly, have two colors that were very near each other, even indistinguishable to the eye. I don't know if that is an issue. If it was, then you could test to see if the distance (in terms of Euclidean distance when mapped to L*a*b* perhaps) between the two colors generated is too small, and if so, then generate a new set until you get colors that are significantly different.
Anyway, in terms of randomness, literally any random number generator would arguably be sufficient for a simple problem like this. You don't need sophistication.
Your second question is not a question at all, as it looks like you stopped writing before you asked anything. You read in a set of Munsell colors. Then what? Are you looking to choose randomly from that set? RANDI might be useful then, to choose a random index into that set.
  8 Commenti
Roger Breton
Roger Breton il 14 Mag 2024
Solved my problem. I cheated a lot, using global variables but the final product is fine. I'm satisfied.
Now I can experiment with selecting Munsell colors at random :-)
Roger Breton
Roger Breton il 21 Mag 2024
The randi() function seems to yield more interesting pairs of Munsell colors than the randperm() I was using before. Still have to look at your code, William? I understand the idea of sampling the CIE Lab color space more evenly.

Accedi per commentare.

Categorie

Scopri di più su Tables in Help Center e File Exchange

Prodotti


Release

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by