Better "probabilities"?
조회 수: 2 (최근 30일)
이전 댓글 표시
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)];
댓글 수: 0
답변 (1개)
John D'Errico
2024년 5월 13일
편집: John D'Errico
2024년 5월 13일
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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!