octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rgb2gray


From: Rik
Subject: Re: rgb2gray
Date: Wed, 17 Jan 2018 09:32:59 -0800

On 01/17/2018 09:00 AM, Carnë Draug wrote:
> On 17 January 2018 at 16:47, Rik <address@hidden> wrote:
>> Carnë,
>>
>> According to the Matlab documentation, input images for rgb2gray and
>> rgb2hsv can only be of type double, single, uint8, uint16.  However, the
>> input validation is also accepting int8 and int16:
>>
>>     if (! any (strcmp (cls, {"uint8", "int8", "int16", "uint16", ...
>>                              "single", "double"})))
>>       error ("%s: %s of invalid data type '%s'", func, arg_name, cls);
>>
>> Should we remove support for int8 and int16, or is there undocumented
>> Matlab voodoo and images of those types are accepted?
>>
>> I've finished up with rgb2gray, except for this issue.
> In Matlab, rgb2hsv fails with int8 and int16 types, while rgb2gray
> accepts both int8 and int16.
>
> The int16 is a valid image data type, and Matlab has a im2int16
> function and other im2X functions will accept int16 type.  int8 is not
> recognized but often works fine too.  I prefer to support all of those
> data types since the code is usually the same, it's more work to
> actually filter them out, and makes the image processing functions
> more consistent.

I made rgb2gray consistent with Matlab along the lines you suggested.  See
http://hg.savannah.gnu.org/hgweb/octave/rev/6c8822790411.  As Doug pointed
out, there's no reason we can't be better than Matlab so I included support
for int8 and int16 as well as a BIST test for that.

--Rik



reply via email to

[Prev in Thread] Current Thread [Next in Thread]