bugGNU Octave - Bugs: bug #49941, image package: rgb2gray of a...

 
 

bug #49941: image package: rgb2gray of a single image produces a double image

Submitted by:  Avinoam Kalma <avinoam>
Submitted on:  Tue 27 Dec 2016 08:45:36 PM UTC  
 
Category:  Octave Forge Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  Carnë Draug <carandraug>
Originator Name:  Avinoam Open/Closed:  Closed
Release:  other Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun 29 Jan 2017 04:08:57 PM UTC, comment #3: 

Not a duplicate of bug #50152, only very similar (sorry, I was reading incorrectly because I was in a rush).  Fixed now with http://hg.code.sf.net/p/octave/image/rev/ec1a16084bfc

Carnë Draug <carandraug>
Project MemberIn charge of this item.
Sun 29 Jan 2017 04:00:11 PM UTC, comment #2: 

I believe anonymous is right about the skipping the conversion to double completely on the case of images of class single.  I have fixed like that for the bug #50152 (a duplicate of this).

To Avinoam:

you don't need to

assert (isequal(class(rgb2gray(ones(3,3,3,'single'))),'single'))

because assert takes an observed and expected arguments.  Instead, use:

assert (class (rgb2gray (ones (3, 3, 3, 'single'))), 'single')

Carnë Draug <carandraug>
Project MemberIn charge of this item.
Thu 26 Jan 2017 10:05:57 AM UTC, comment #1: 

Actually, it might be an idea to handle the line

gray = im2double (rgb)...

differently and convert to double only in the case of uint8/uint16. This way if the input is single, the calculation is also done at single precision (saves a lot for very large images).

Also see bug #50152

Anonymous
Tue 27 Dec 2016 08:45:36 PM UTC, original submission:  

rgb2gray of a single image produces a double image, while in
MATLAB the result is single.

The fix is very simple: instead of

    case {"single", "double"}
      ## do nothing. All is good

There should be:

    case "single"
      im = single(im);
    case "double"
      ## do nothing. All is good

A BIST:

assert (isequal(class(rgb2gray(ones(3,3,3,'single'))),'single'))

Avinoam Kalma <avinoam>
Project Member

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-01-29 carandraug StatusNone => Fixed
        Open/ClosedOpen => Closed
    2017-01-29 carandraug Dependencies- => Depends on bugs #50152
    2016-12-27 avinoam Carbon-Copy- => Added a.kalma@gmail.com

    Back to the top


    Powered by Savane 3.5