Mercurial > octave-antonio
comparison scripts/image/hsv2rgb.m @ 19833:9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Try to trim long lines to < 80 chars.
Use '##' for single line comments.
Use '(...)' around tests for if/elseif/switch/while.
Abut cell indexing operator '{' next to variable.
Abut array indexing operator '(' next to variable.
Use space between negation operator '!' and following expression.
Use two newlines between endfunction and start of %!test or %!demo code.
Remove unnecessary parens grouping between short-circuit operators.
Remove stray extra spaces (typos) between variables and assignment operators.
Remove stray extra spaces from ends of lines.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 23 Feb 2015 14:54:39 -0800 |
parents | 4197fc428c7d |
children |
comparison
equal
deleted
inserted
replaced
19832:a1acca0c2216 | 19833:9fc020886ae9 |
---|---|
104 endif | 104 endif |
105 | 105 |
106 endfunction | 106 endfunction |
107 | 107 |
108 | 108 |
109 %% Test pure colors | 109 ## Test pure colors |
110 %!assert (hsv2rgb ([0 1 1]), [1 0 0]) | 110 %!assert (hsv2rgb ([0 1 1]), [1 0 0]) |
111 %!assert (hsv2rgb ([1 1 1]), [1 0 0]) | 111 %!assert (hsv2rgb ([1 1 1]), [1 0 0]) |
112 %!assert (hsv2rgb ([1/3 1 1]), [0 1 0]) | 112 %!assert (hsv2rgb ([1/3 1 1]), [0 1 0]) |
113 %!assert (hsv2rgb ([2/3 1 1]), [0 0 1]) | 113 %!assert (hsv2rgb ([2/3 1 1]), [0 0 1]) |
114 | 114 |
118 | 118 |
119 %!test | 119 %!test |
120 %! hsv_img = rand (64, 64, 3); | 120 %! hsv_img = rand (64, 64, 3); |
121 %! assert (rgb2hsv (hsv2rgb (hsv_img)), hsv_img, 1e-6); | 121 %! assert (rgb2hsv (hsv2rgb (hsv_img)), hsv_img, 1e-6); |
122 | 122 |
123 %% Test input validation | 123 ## Test input validation |
124 %!error hsv2rgb () | 124 %!error hsv2rgb () |
125 %!error hsv2rgb (1,2) | 125 %!error hsv2rgb (1,2) |
126 %!error <invalid data type> hsv2rgb ({1}) | 126 %!error <invalid data type> hsv2rgb ({1}) |
127 %!error <must be a matrix of size Nx3> hsv2rgb (ones (2,2)) | 127 %!error <must be a matrix of size Nx3> hsv2rgb (ones (2,2)) |
128 %!error <must be a matrix of size Nx3> hsv2rgb (sparse (ones(1,3))) | 128 %!error <must be a matrix of size Nx3> hsv2rgb (sparse (ones(1,3))) |