octave-maintainers
[Top][All Lists]
Advanced

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

Re: Move rgb2ntsc and ntsc2rgb to image package


From: Carnë Draug
Subject: Re: Move rgb2ntsc and ntsc2rgb to image package
Date: Wed, 17 Jan 2018 17:32:50 +0000

On 17 January 2018 at 16:22, Rik <address@hidden> wrote:
> On 01/17/2018 07:20 AM, Carnë Draug wrote:
>> [...]
>> Finally, the reshaping back to the original shape can be done with the
>> existing private function colorspace_conversion_revert [2].
> I tried using that function at first, but had to give up because I couldn't
> get ND-images to work correctly.  The problem is that, unlike rgb2ntsc, the
> third dimension is removed.  I can't mimic that by just deleting the
> dimension from the sz vector because colorspace_conversion_revert expects 4
> dimensions.  The code in question is
>
>     if (is_nd)
>       rv = reshape (rv, [sz(1:2) sz(4) sz(3)]);
>       rv = permute (rv, [1 2 4 3]);
>
> We could recode this to be more general, or we could just make rgb2gray a
> one-off function.  I'm inclined to do the latter, but if you see a strong
> reason for modifying colorspace_conversion_revert we could do that.
>

The thing is that in a grayscale image, the 3rd dimension must be one,
the 4th dimension can't simply be shifted to the 3rd dimension like it
is happening now on core.  The test unit for ND images is also
incorrect.  I have attached a diff that fixes it.

Carnë

Attachment: fix-rgb2gray-sz.diff
Description: Text document


reply via email to

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