comparison scripts/image/hsv2rgb.m @ 11587:c792872f8942

all script files: untabify and strip trailing whitespace
author John W. Eaton <jwe@octave.org>
date Thu, 20 Jan 2011 17:35:29 -0500
parents fd0a3ac60b0e
children 72c96de7a403
comparison
equal deleted inserted replaced
11586:12df7854fa7c 11587:c792872f8942
16 ## along with Octave; see the file COPYING. If not, see 16 ## along with Octave; see the file COPYING. If not, see
17 ## <http://www.gnu.org/licenses/>. 17 ## <http://www.gnu.org/licenses/>.
18 18
19 ## -*- texinfo -*- 19 ## -*- texinfo -*-
20 ## @deftypefn {Function File} {@var{rgb_map} =} hsv2rgb (@var{hsv_map}) 20 ## @deftypefn {Function File} {@var{rgb_map} =} hsv2rgb (@var{hsv_map})
21 ## Transform a colormap or image from the HSV space to the RGB space. 21 ## Transform a colormap or image from the HSV space to the RGB space.
22 ## @seealso{rgb2hsv} 22 ## @seealso{rgb2hsv}
23 ## @end deftypefn 23 ## @end deftypefn
24 24
25 ## Author: Kai Habel <kai.habel@gmx.de> 25 ## Author: Kai Habel <kai.habel@gmx.de>
26 ## Adapted-by: jwe 26 ## Adapted-by: jwe
62 62
63 ## fill rgb map with v*(1-s) 63 ## fill rgb map with v*(1-s)
64 rgb_map = kron ([1, 1, 1], hsv_map(:,3) .* (1 - hsv_map(:,2))); 64 rgb_map = kron ([1, 1, 1], hsv_map(:,3) .* (1 - hsv_map(:,2)));
65 65
66 ## red(hue-2/3)=green(hue)=blue(hue-1/3) 66 ## red(hue-2/3)=green(hue)=blue(hue-1/3)
67 ## apply modulo 1 for red and blue 67 ## apply modulo 1 for red and blue
68 t = hsv_map(:,1); 68 t = hsv_map(:,1);
69 tp = t'; 69 tp = t';
70 hue = [(tp - 2/3 - floor (t - 2/3)'); 70 hue = [(tp - 2/3 - floor (t - 2/3)');
71 tp; 71 tp;
72 (tp - 1/3 - floor (t - 1/3)')]'; 72 (tp - 1/3 - floor (t - 1/3)')]';