bugGNU Octave - Bugs: bug #47115, label2rgb from image-package...

 
 

bug #47115: label2rgb from image-package doesn't work for labels with value above the uint16 limit

Submitted by:  None
Submitted on:  Thu 11 Feb 2016 06:59:13 AM UTC  
 
Category: Octave Forge PackageSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: FixedAssigned to: None
Originator Name: FilipOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 4.0.0
Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

(Jump to the original submission Jump to the original submission)

Wed 10 May 2017 07:08:37 PM UTC, comment #7:

> We could still do "better" than Matlab and also support uint32 in ind2x.m (called from ind2rgb.m) if this doesn't harm any other function that also uses ind2x.m.


Agreed. So I pushed http://hg.savannah.gnu.org/hgweb/octave/rev/3ace16b8f062

This doesn't add support for the actual display functions but at least the functinos that convert between image types could support this. May be worth to look into other similar functions such as cmunique and gray2ind.

Carnë Draug <carandraug>
Project Member
Wed 29 Mar 2017 06:57:16 PM UTC, comment #6:

When running the "example code" from comment #0 in Matlab, then I do NOT get an error. The result is of class uint8 and the values are 255 everywhere, and at position (1,1) the value is (128,0,0). I get the same Matlab result, when I use uint32(lw) as input for label2rgb.

In the Matlab documentation for label2rgb they say that "The input label matrix L can have any numeric class. It must contain finite, nonnegative integers. The output of label2rgb is of class uint8."

In the Matlab documentation for ind2rgb they say that "[The input] X can be of class uint8, uint16, or double. [The output] RGB is an m-by-n-by-3 array of class double."

Conclusion: The class support of (core) Octave's ind2rgb seems to be Matlab compatible. But the class support of (image packag's) label2rgb seems to NOT be Matlab compatible, currently.

We could still do "better" than Matlab and also support uint32 in ind2x.m (called from ind2rgb.m) if this doesn't harm any other function that also uses ind2x.m.

Hartmut <hardy>
Sun 26 Mar 2017 02:58:57 AM UTC, comment #5:

> But even if Matlab does not support uint32 in ind2rgb, why can't we do the same?


I obviously meant "But even if Matlab does not support uint32 in ind2rgb, why do we do the same?". I think it should be fine to add it in core, even if Matlab does not support it.

Carnë Draug <carandraug>
Project Member
Sun 26 Mar 2017 02:57:53 AM UTC, comment #4:

The label2rgb on the image package just calls ind2rgb from Octave core. And I remember something about indexed images being only up to uint16 in Matlab and we copying this behaviour.

We could fix the image package to support uint32 too or maybe we need to fix Octave core ind2rgb. Anyone with Matlab could check this? But even if Matlab does not support uint32 in ind2rgb, why can't we do the same?

Carnë Draug <carandraug>
Project Member
Thu 21 Apr 2016 06:49:48 AM UTC, comment #3:

OP here. Just to clarify, the reason for reporting this bug is because the test code works in Matlab, but not in Octave. I also can't really see any reason why label2rgb() shouldn't work with uint32 and higher.

Filip <fsund>
Tue 29 Mar 2016 07:40:53 PM UTC, comment #2:

Sorry for the confusion: The file ind2x.m sits in the core Octave repository (image subfolder), not in the image repo.

Hartmut <hardy>
Tue 29 Mar 2016 07:37:44 PM UTC, comment #1:

The Octave file ind2x.m has currently (image repo) an explicit test for only the two integer classes uint8 and uint16:

Maybe we can change this to allow also uint32 and uint64 integers? Or would this harm any other user of this helper function?

Hartmut <hardy>
Thu 11 Feb 2016 06:59:13 AM UTC, original submission:

When running label2rgb() on a labelled image with labels larger than 65535 (the 16 bit unsigned integer limit), the function returns an error:

Example code:

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by avinoam (Updated the item)
  • -unavailable- added by fsund (Posted a comment)
  • -unavailable- added by hardy (Posted a comment)
  • -unavailable- added by hardy
  • -unavailable- added by None (Submitted the item)
  •  

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

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 10 May 2017 07:08:37 PM UTCcarandraugStatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Mon 06 Mar 2017 05:15:06 AM UTCavinoamStatusNone=>Confirmed
    Mon 12 Dec 2016 05:49:40 AM UTCavinoamItem GroupNone=>Matlab Compatibility
    Tue 29 Mar 2016 07:37:44 PM UTChardyCarbon-Copy-=>Added carandraug
    Mon 15 Feb 2016 11:57:47 PM UTCrik5Carbon-CopyRemoved 72865=>-
    Mon 15 Feb 2016 11:57:24 PM UTCrik5CategoryOctave Function=>Octave Forge Package

    Back to the top


    Powered by Savane 3.1-cleanup1