Mercurial > octave
changeset 23494:b9c66b9b5fc8
gray2ind.m: revert accidental changes included in bf063fafeca5
author | Carnë Draug <carandraug@octave.org> |
---|---|
date | Mon, 15 May 2017 16:09:35 +0100 |
parents | bf063fafeca5 |
children | 8308417aff1c |
files | scripts/image/gray2ind.m |
diffstat | 1 files changed, 3 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/image/gray2ind.m Mon May 15 15:58:57 2017 +0100 +++ b/scripts/image/gray2ind.m Mon May 15 16:09:35 2017 +0100 @@ -43,8 +43,8 @@ print_usage (); elseif (! isreal (I) || issparse (I) || ! ismatrix(I)) error ("gray2ind: I must be a grayscale or binary image"); - elseif (! isscalar (n) || n < 1 ) - error ("gray2ind: N must be a positive integer"); + elseif (! isscalar (n) || n < 1 || n > 65536) + error ("gray2ind: N must be a positive integer in the range [1, 65536]"); endif ## default n is different if image is logical @@ -76,14 +76,8 @@ ## type conversion does that automatically. if (n <= 256) I = uint8 (I); - elseif (n <= 65536) + else I = uint16 (I); - elseif (n <= 4294967296) - I = uint32 (I); - elseif (n <= intmax ("uint64")) - I = uint64 (I); - else - error ("gray2ind: N is larger than uint64 max value"); endif endfunction @@ -107,7 +101,6 @@ %! assert (class (gray2ind ([0.0 0.5 1.0], 255)), "uint8"); %! assert (class (gray2ind ([0.0 0.5 1.0], 256)), "uint8"); %! assert (class (gray2ind ([0.0 0.5 1.0], 257)), "uint16"); -%! assert (class (gray2ind ([0.0 0.5 1.0], 655537)), "uint32") ## Test input validation %!error gray2ind ()