bugGNU Octave - Bugs: bug #45131, rgb2hsv is not compatible to Matlab

 
 

bug #45131: rgb2hsv is not compatible to Matlab

Submitter:  Avinoam Kalma <avinoam>
Submitted:  Mon 18 May 2015 02:26:23 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Avinoam Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 19 Jul 2015 04:54:03 PM UTC, comment #5: 

This has been fixed as part of fixing bug #45456.

However, I would caution against having floating point values outside the range [0 1] in functions that convert between color spaces since such things are not defined.

Instead of "rgb2hsv (double(I))" I would recommend using "rgb2hsv (im2double (I))".

Carnë Draug <carandraug>
Group Member
Wed 01 Jul 2015 08:08:21 PM UTC, comment #4: 

I do not know what Matlab does with floating points with values below zero.

I have Matlab program with the line
J = rgb2hsv(double(I)) which works fine in Matlab, but
stops with error in Octave.

Avinoam Kalma <avinoam>
Group Member
Sun 14 Jun 2015 11:12:47 PM UTC, comment #3: 

What about floating points with values below zero? What does Matlab do about them? Historically, Matlab only handled double precision images with values in the range [0 1]. Any handling of values outside of that range was due to Matlab lack of input checking and therefore not defined.  I believe you may find many similar issue sin Octave functions.

Carnë Draug <carandraug>
Group Member
Mon 01 Jun 2015 08:47:08 PM UTC, comment #2: 

... "will solve"....

Avinoam Kalma <avinoam>
Group Member
Mon 01 Jun 2015 08:46:20 PM UTC, comment #1: 

Removing
|| any (rgb(:) > 1)

from the line

 elseif (isfloat (rgb) && (any (rgb(:) < 0) || any (rgb(:) > 1)))
    error ("rgb2hsv: floating point images may only contain values between 0 and 1");
  endif

while solve this problem. What do you think?

Avinoam Kalma <avinoam>
Group Member
Mon 18 May 2015 02:26:23 PM UTC, original submission:  


In Matlab 2010A


>> B = uint8(100*ones(2,2,3));
>> rgb2hsv(double(B))

ans(:,:,1) =

     0     0
     0     0


ans(:,:,2) =

     0     0
     0     0


ans(:,:,3) =

   100   100
   100   100


In Octave


>> B = uint8(100*ones(2,2,3));
>> rgb2hsv(double(B))
error: rgb2hsv: floating point images may only contain values between 0 and 1
error: called from
    rgb2hsv at line 47 column 5


double(B) is in the range [0:255] and not in [0:1]
 

Avinoam Kalma <avinoam>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by avinoam (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-07-19 carandraug StatusNone Fixed
        Open/ClosedOpen Closed
    2015-06-14 carandraug CategoryOctave Package Octave Function
        Summaryimage package: rgb2hsv is not compatible to Matlab rgb2hsv is not compatible to Matlab

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code