diff scripts/image/rgb2hsv.m @ 20665:67e6343cd29a

Add support for colorspace conversion of signed integers images (patch #8709) * scripts/image/private/colorspace_conversion_input_check.m: add support for signed integers. 16 bit signed integers are common and supported by the image package. We might as well support 8 bit signed as well. * scripts/image/hsv2rgb.m, scripts/image/rgb2hsv.m, scripts/image/rgb2ntsc.m: add tests for signed integer images.
author Carnë Draug <carandraug@octave.org>
date Wed, 28 Oct 2015 22:34:43 +0000
parents a278de349250
children 1672bb8882dd
line wrap: on
line diff
--- a/scripts/image/rgb2hsv.m	Wed Oct 28 19:51:02 2015 +0000
+++ b/scripts/image/rgb2hsv.m	Wed Oct 28 22:34:43 2015 +0000
@@ -166,6 +166,7 @@
 %! rgb_double = reshape ([1 0 1 .5 1 1 0 .5 0 1 1 .5], [2 2 3]);
 %! rgb_uint8  = reshape (uint8 ([255 0 255 128 255 255 0 128 0 255 255 128]),
 %!                       [2 2 3]);
+%! rgb_int16 = int16 (double (rgb_double * uint16 (65535)) -32768);
 %! expected = reshape ([1/6 1/2 5/6 0 1 1 1 0 1 1 1 .5], [2 2 3]);
 %!
 %! assert (rgb2hsv (rgb_double), expected)