Mercurial > octave-nkf
annotate scripts/image/hsv2rgb.m @ 20614:10ec79b47808
use new string_value method to handle value extraction errors
* __voronoi__.cc, chol.cc, colamd.cc, fftw.cc:
Use new string_value method.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 08 Oct 2015 18:15:56 -0400 |
parents | 131ce8cfaa80 |
children |
rev | line source |
---|---|
19731
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
1 ## Copyright (C) 1999-2015 Kai Habel |
20393
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
2 ## Copyright (C) 2015 Carnë Draug |
3803 | 3 ## |
4 ## This file is part of Octave. | |
5 ## | |
6 ## Octave is free software; you can redistribute it and/or modify it | |
7 ## under the terms of the GNU General Public License as published by | |
7016 | 8 ## the Free Software Foundation; either version 3 of the License, or (at |
9 ## your option) any later version. | |
3803 | 10 ## |
11 ## Octave is distributed in the hope that it will be useful, but | |
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 ## General Public License for more details. | |
15 ## | |
16 ## You should have received a copy of the GNU General Public License | |
7016 | 17 ## along with Octave; see the file COPYING. If not, see |
18 ## <http://www.gnu.org/licenses/>. | |
3803 | 19 |
20 ## -*- texinfo -*- | |
14260
1f911333ed3d
doc: Update docstrings for functions in image/ directory
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
21 ## @deftypefn {Function File} {@var{rgb_map} =} hsv2rgb (@var{hsv_map}) |
1f911333ed3d
doc: Update docstrings for functions in image/ directory
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
22 ## @deftypefnx {Function File} {@var{rgb_img} =} hsv2rgb (@var{hsv_img}) |
20393
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
23 ## Transform a colormap or image from HSV to RGB color space. |
15683
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
14552
diff
changeset
|
24 ## |
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
14552
diff
changeset
|
25 ## A color in HSV space is represented by hue, saturation and value |
20393
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
26 ## (brightness) levels in a cylindrical coordinate system. Hue is the |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
27 ## azimuth and describes the dominant color. Saturation is the radial |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
28 ## distance and gives the amount of hue mixed into the color. Value is |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
29 ## the height and is the amount of light in the color. |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
30 ## |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
31 ## The input can be both a colormap or RGB image. In the case of floating |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
32 ## point input, values are expected to be on the [0 1] range. In the case |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
33 ## of hue (azimuth), since the value corresponds to an angle, |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
34 ## @code{mod (h, 1)} is used. |
15683
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
14552
diff
changeset
|
35 ## |
20393
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
36 ## @example |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
37 ## >> hsv2rgb ([0.5 1 1]) |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
38 ## @result{} ans = 0 1 1 |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
39 ## |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
40 ## >> hsv2rgb ([2.5 1 1]) |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
41 ## @result{} ans = 0 1 1 |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
42 ## |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
43 ## >> hsv2rgb ([3.5 1 1]) |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
44 ## @result{} ans = 0 1 1 |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
45 ## @end example |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
46 ## |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
47 ## Output class and size will be the same as input. |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
48 ## |
14260
1f911333ed3d
doc: Update docstrings for functions in image/ directory
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
49 ## @seealso{rgb2hsv, ind2rgb, ntsc2rgb} |
3803 | 50 ## @end deftypefn |
51 | |
52 ## Author: Kai Habel <kai.habel@gmx.de> | |
53 ## Adapted-by: jwe | |
54 | |
20393
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
55 function rgb = hsv2rgb (hsv) |
3803 | 56 |
14260
1f911333ed3d
doc: Update docstrings for functions in image/ directory
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
57 ## Each color value x = (r,g,b) is calculated with |
1f911333ed3d
doc: Update docstrings for functions in image/ directory
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
58 ## x = (1-sat)*val+sat*val*f_x(hue) |
1f911333ed3d
doc: Update docstrings for functions in image/ directory
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
59 ## where f_x(hue) is a piecewise defined function for |
1f911333ed3d
doc: Update docstrings for functions in image/ directory
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
60 ## each color with f_r(hue-2/3) = f_g(hue) = f_b(hue-1/3). |
3803 | 61 |
62 if (nargin != 1) | |
6046 | 63 print_usage (); |
3803 | 64 endif |
65 | |
20404
131ce8cfaa80
Relax input in functions that convert between colorspaces (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
20393
diff
changeset
|
66 [hsv, cls, sz, is_im, is_nd, is_int] ... |
131ce8cfaa80
Relax input in functions that convert between colorspaces (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
20393
diff
changeset
|
67 = colorspace_conversion_input_check ("hsv2rgb", "HSV", hsv); |
3803 | 68 |
20393
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
69 h = hsv(:,1); |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
70 s = hsv(:,2); |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
71 v = hsv(:,3); |
3803 | 72 |
20393
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
73 ## Values of Saturation and Value should also be in the [0 1] range. With |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
74 ## the exception of hue, values outside this range don't make any sense |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
75 ## in a cylindrical coordinate system but we must return something for |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
76 ## Matlab compatibility. User case is when a function returns an hsv |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
77 ## image just slightly outside the range due to floating point rounding |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
78 ## errors. |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
79 |
15683
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
14552
diff
changeset
|
80 ## Prefill rgb map with v*(1-s) |
20393
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
81 rgb = repmat (v .* (1 - s), 1, 3); |
15683
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
14552
diff
changeset
|
82 |
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
14552
diff
changeset
|
83 ## red = hue-2/3 : green = hue : blue = hue-1/3 |
20393
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
84 ## Apply modulo 1 to keep within range [0, 1] |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
85 hue = mod ([h-2/3 h h-1/3], 1); |
3803 | 86 |
87 ## factor s*v -> f | |
15683
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
14552
diff
changeset
|
88 f = repmat (s .* v, 1, 3); |
3803 | 89 |
15683
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
14552
diff
changeset
|
90 ## add s*v*hue-function to rgb map |
20393
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
91 rgb += f .* (6 * (hue < 1/6) .* hue |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
92 + (hue >= 1/6 & hue < 1/2) |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
93 + (hue >= 1/2 & hue < 2/3) .* (4 - 6 * hue)); |
3803 | 94 |
20404
131ce8cfaa80
Relax input in functions that convert between colorspaces (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
20393
diff
changeset
|
95 rgb = colorspace_conversion_revert (rgb, cls, sz, is_im, is_nd, is_int); |
7375 | 96 |
3803 | 97 endfunction |
15683
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
14552
diff
changeset
|
98 |
19867
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19731
diff
changeset
|
99 ## Test pure colors |
20393
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
100 %!assert (hsv2rgb ([0 0 1]), [1 1 1]) |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
101 %!assert (hsv2rgb ([1 1 0]), [0 0 0]) |
15683
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
14552
diff
changeset
|
102 %!assert (hsv2rgb ([0 1 1]), [1 0 0]) |
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
14552
diff
changeset
|
103 %!assert (hsv2rgb ([1 1 1]), [1 0 0]) |
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
14552
diff
changeset
|
104 %!assert (hsv2rgb ([1/3 1 1]), [0 1 0]) |
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
14552
diff
changeset
|
105 %!assert (hsv2rgb ([2/3 1 1]), [0 0 1]) |
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
14552
diff
changeset
|
106 |
20393
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
107 %!assert (hsv2rgb ([0 0.5 0.5]), hsv2rgb ([1 0.5 0.5])) |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
108 |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
109 ## Not Matlab compatible (Matlab would return [1/2 1/12 1/12]) but |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
110 ## it's also invalid input. This is, however, the same output as python |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
111 ## colorsys module. |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
112 %!assert (hsv2rgb ([0.5 -0.5 0.5]), [0.75 0.5 0.5]) |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
113 |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
114 ## Not Matlab compatible. Matlab returns NaN when hue is outside the |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
115 ## [0 1] range. But since it's an angle, we can manage it. |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
116 %!assert (hsv2rgb ([0 0.5 0.5]), hsv2rgb ([2 0.5 0.5])) |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
117 %!assert (hsv2rgb ([0.5 0.5 0.5]), hsv2rgb ([2.5 0.5 0.5]), eps) |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
118 |
15683
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
14552
diff
changeset
|
119 %!test |
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
14552
diff
changeset
|
120 %! hsv_map = rand (64, 3); |
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
14552
diff
changeset
|
121 %! assert (rgb2hsv (hsv2rgb (hsv_map)), hsv_map, 1e-6); |
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
14552
diff
changeset
|
122 |
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
14552
diff
changeset
|
123 %!test |
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
14552
diff
changeset
|
124 %! hsv_img = rand (64, 64, 3); |
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
14552
diff
changeset
|
125 %! assert (rgb2hsv (hsv2rgb (hsv_img)), hsv_img, 1e-6); |
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
14552
diff
changeset
|
126 |
20393
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
127 ## support sparse input |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
128 %!assert (hsv2rgb (sparse ([0 0 1])), sparse ([1 1 1])) |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
129 %!assert (hsv2rgb (sparse ([0 1 1])), sparse ([1 0 0])) |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
130 %!assert (hsv2rgb (sparse ([1 1 1])), sparse ([1 0 0])) |
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
131 |
19867
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19731
diff
changeset
|
132 ## Test input validation |
15683
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
14552
diff
changeset
|
133 %!error hsv2rgb () |
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
14552
diff
changeset
|
134 %!error hsv2rgb (1,2) |
806ea52af230
Overhaul m-files in image directory to provide better support for images stored as integers.
Rik <rik@octave.org>
parents:
14552
diff
changeset
|
135 %!error <invalid data type> hsv2rgb ({1}) |
20393
84ca63c8a038
hsv2rgb: relax input check and support for N dimensional images (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
19867
diff
changeset
|
136 %!error <HSV must be a colormap or HSV image> hsv2rgb (ones (2,2)) |
20404
131ce8cfaa80
Relax input in functions that convert between colorspaces (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
20393
diff
changeset
|
137 |
131ce8cfaa80
Relax input in functions that convert between colorspaces (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
20393
diff
changeset
|
138 ## Test ND input |
131ce8cfaa80
Relax input in functions that convert between colorspaces (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
20393
diff
changeset
|
139 %!test |
131ce8cfaa80
Relax input in functions that convert between colorspaces (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
20393
diff
changeset
|
140 %! hsv = rand (16, 16, 3, 5); |
131ce8cfaa80
Relax input in functions that convert between colorspaces (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
20393
diff
changeset
|
141 %! rgb = zeros (size (hsv)); |
131ce8cfaa80
Relax input in functions that convert between colorspaces (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
20393
diff
changeset
|
142 %! for i = 1:5 |
131ce8cfaa80
Relax input in functions that convert between colorspaces (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
20393
diff
changeset
|
143 %! rgb(:,:,:,i) = hsv2rgb (hsv(:,:,:,i)); |
131ce8cfaa80
Relax input in functions that convert between colorspaces (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
20393
diff
changeset
|
144 %! endfor |
131ce8cfaa80
Relax input in functions that convert between colorspaces (bug #45456)
Carnë Draug <carandraug@octave.org>
parents:
20393
diff
changeset
|
145 %! assert (hsv2rgb (hsv), rgb) |