bugGNU Octave - Bugs: bug #37681, imread function when used with...

 
 

bug #37681: imread function when used with indexed images returns a matrix with 0 values, that are not accepted by other image funcs

Submitter:  None
Submitted:  Tue 06 Nov 2012 05:12:15 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Assigned to:  None
Originator Name:  Lucas Sa Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.6.2
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 10 Dec 2012 11:41:50 PM UTC, comment #4: 

Carnë's patches work for me.  There has been a lot of changes to the image files and this fix won't be backported to the 3.6.X branch.  To see the fix you will need to build from Mercurial sources or wait for the next stable release of Octave.

Rik <rik5>
Group administrator
Mon 12 Nov 2012 04:56:56 AM UTC, comment #3: 

I have made another commit to expand the fix to ind2gray. As the two functins had a fair ammount in common but ind2gray had almost no input check, I made a private function for the shared code ratyer than copy and paste.

Please pull changeset 14b7679891dd from https://bitbucket.org/carandraug/octave/ after the changeset mentinoed on the previous comment.

Carnë Draug <carandraug>
Group Member
Mon 12 Nov 2012 04:31:27 AM UTC, comment #2: 

I have made a commit that corrects this behavior at least in ind2rgb. Please pull changeset 4db08f52a6ed from https://bitbucket.org/carandraug/octave/

Carnë Draug <carandraug>
Group Member
Mon 12 Nov 2012 02:07:19 AM UTC, comment #1: 

The range of values for indexed images is dependent on their class and this may be the origin for confusion. If the indexed image is of an integer class, their indexes start at 0 so there's an offset of 1 for the colormap. However, some index images can be of class double in which case there's no offset and the minimum index should be 1.

Carnë Draug <carandraug>
Group Member
Tue 06 Nov 2012 05:12:15 PM UTC, original submission:  

Using <b>[X, map] = imread</b> will give me a matrix X with values from 0 to n-1, while all other image functions expect index mapping from 1 to n, such as imshow, ind2rgb, ind2gray.

This fact makes the execution of a simple <b>imshow('some_file.gif')</b> to show something different from the original image. imshow(<b>X+1</b>, map) would show it fine as well.

The function ind2rgb, for example, even has a validation for indices less than 1 in line 43 of ind2rgb.m:

  ## Check if X is an indexed image.
  if (ndims (x) != 2 || any (x(:) != fix (x(:))) || <b>min (x(:)) < 1</b>)
    error ("ind2rgb: X must be an indexed image");


To replicate the error, you can imread any indexed image (such as GIF) and try to use the referred functions with the results.

Is it normal to receive 0 values in X matrix? I am using octave 3.6.2 and graphicsmagick 1.3.16.

Anonymous

 

(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 rik5 (Posted a comment)
  • -email is unavailable- added by jordigh (Updated the item)
  • -email is unavailable- added by carandraug (Posted a comment)
  • -email is unavailable- added by None (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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-12-10 rik5 StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2012-11-12 jordigh StatusNone Patch Submitted

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code