octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #45456] hsv2rgb is very strict about its input


From: Carnë Draug
Subject: [Octave-bug-tracker] [bug #45456] hsv2rgb is very strict about its input values
Date: Thu, 16 Jul 2015 13:08:59 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.8.0

Follow-up Comment #8, bug #45456 (project octave):

Apparently, Matlab hsv2rgb in 2010b was quite buggy and the behaviour has
changed on recent versions. On Matlab 2013, Matlab returns NaN for invalid RGB
colors:


carandraug:   would you mind also tell me what "hsv2rgb ([2.9 1 .5])"
returns?
carandraug:   and "hsv2rgb ([2.9 1.5 .5])"
xyzwhatever:  NaN   NaN   NaN
carandraug:   for the two examples?
xyzwhatever:  yeah both


However, I kinda disagree with part of input check. The hue in hsv (first
column) is an angle on a cylinder.  Therefore we can simply do:


  ## The value of hue is an angle therefore 0 = 1 = 0° = 360°.
  ## Fix for values outside the [0 1] range which mess up the maths.
  hsv(:,1) = mod (hsv(:,1), 1);


which means that "hsv2rgb ([2.9 1 .5])", which Matlab returns NaNs, could be
computed like "hsv2rgb ([0.9 1 .5])" and would still be correct.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?45456>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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