Mercurial > hg > simscene-py
comparison nonExposed/randomColormap.m @ 34:39399de892ef
better handling of displays with pleasantness colors
author | Mathieu Lagrange <mathieu.lagrange@cnrs.fr> |
---|---|
date | Fri, 09 Jun 2017 16:37:50 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
33:d0ceb549f734 | 34:39399de892ef |
---|---|
1 function cmap = randomColormap (sceneObjects) | |
2 % returns a colormap with randomly chosen colors somewhat evenly spread in | |
3 % the color spectrum, to be used for the graphical representations of a | |
4 % synthesized scene. | |
5 | |
6 % Background sounds will have a saturation of .3, foreground sounds of 1 | |
7 % Value is always let to .5, since modifying it would erroneously suggest | |
8 % a difference of intensity | |
9 | |
10 % This program was written by Mathias Rossignol & Grégoire Lafay | |
11 % is Copyright (C) 2015 IRCAM <http://www.ircam.fr> | |
12 % | |
13 % This program is free software: you can redistribute it and/or modify it | |
14 % under the terms of the GNU General Public License as published by the Free | |
15 % Software Foundation, either version 3 of the License, or (at your option) | |
16 % any later version. | |
17 % | |
18 % This program is distributed in the hope that it will be useful, but | |
19 % WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
20 % or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
21 % for more details. | |
22 % | |
23 % You should have received a copy of the GNU General Public License along | |
24 % with this program. If not, see <http://www.gnu.org/licenses/>. | |
25 | |
26 nbTracks = length(sceneObjects); | |
27 | |
28 % Colors for figures | |
29 % Choosing color hues evenly spread in the color spectrum, then randomizing their order | |
30 hues = (0:1/nbTracks:1); | |
31 hues = hues(1:nbTracks); | |
32 hues = hues(randperm(nbTracks)); | |
33 % Generate a colormap: | |
34 for c=1:nbTracks | |
35 if (sceneObjects(c).isBackground) | |
36 cmap(c,:) = hsl2rgb([hues(c), .3, .5]); | |
37 else | |
38 cmap(c,:) = hsl2rgb([hues(c), 1, .5]); | |
39 end | |
40 end | |
41 end |