bugGNU Octave - Bugs: bug #37689, imread strange result

 
 

bug #37689: imread strange result

Submitted by:  None
Submitted on:  Wed 07 Nov 2012 10:38:54 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: Originator Email: -unavailable-
Open/Closed: ClosedRelease: 3.6.2
Operating System: GNU/Linux

Add a New Comment (Rich MarkupRich 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)

Fri 02 Aug 2013 06:21:04 PM UTC, comment #7:

The reason of this bug comes from GraphicsMagick (the library responsible for image IO) changing the type for optimal memory management.

Anyway, I believe to have fixed the MxNx3 to MxNx1 part with cset 73a3c1580974. The uint8 to logical was fixed last week.

Carnë Draug <carandraug>
Project Member
Tue 26 Feb 2013 12:01:11 AM UTC, comment #6:

I would not say converting the data type of the input image to something else, especially something that is not valid for any image format I know of, should be the default behavior.
If the file you read in is encoded in uint8 it should stay uint8 unless the user specifies otherwise.

If you end up joining two images together, one that is "logical" and one that is not, and save the result you end up with a corrupted image because of the incompatible data types.
That is the problem I ran into with this behavior and working around it becomes very annoying when you have to check if every image has been converted to a "logical" data type and then correct that.

Automatic grayscale conversion (MxNx3 to MxNx1) has similar issues but is not as baffling as conversion to "logical" since the data at least is still in "unit8".

Andrew Hout <arclance>
Mon 25 Feb 2013 11:31:48 PM UTC, comment #5:

Thanks for the example. I can verify what Octave is doing.

Quoting from the documentation for imread

Octave notices that all zeros (black) or max intensity (255) can be represented with just a boolean matrix. If you change the parameters of the image away from this in any way then it will return a uint8 matrix. For example, I made a completely white image (all 255) with a single pixel of value (1) in the GIMP and this is read in as MxNx3 of uint8.

I suppose this is still a problem when you next want to do something with the MxNx3 image because now you can't set the intensity to anything besides 0 or 1 without first calling

Rik <rik5>
Project Administrator
Mon 25 Feb 2013 10:32:33 PM UTC, comment #4:

I just attached a .png image that is read in as a boolean matrix.

octave:1> [img, map, alpha] = imread("tile_1x3_rgb_hqx2.png");
octave:2> typeinfo(img)
ans = bool matrix

It should report

ans = uint8 matrix

instead.

Andrew Hout <arclance>
Mon 25 Feb 2013 04:46:46 AM UTC, comment #3:

Can you attach the actual image file to this bug report so that I can experiment with it.

Rik <rik5>
Project Administrator
Mon 25 Feb 2013 02:44:06 AM UTC, comment #2:

I can reproduce this by opening a image that is a single solid color.

Andrew Hout <arclance>
Wed 07 Nov 2012 10:42:49 PM UTC, comment #1:

Could you attach the file that is causing problems to this bug report? This will allow us to replicate what you are seeing and more easily debug it.

Rik <rik5>
Project Administrator
Wed 07 Nov 2012 10:38:54 PM UTC, original submission:

I'm loading a 24bit BMP image (the used by a professor for exercises) which contains 3 areas one RGB(255,0,0) another RGB(0,255,0) and another RGB(0,0,255).
If i load it with imread instad of returning an MxNx3 matrix of uint8 return an MxNx3 matrix of logical

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #27529:  tile_1x3_rgb_hqx2.png added by arclance (221B - image/png - solid color png image - read as bool matrix)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by arclance (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  •  

    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 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 02 Aug 2013 06:21:04 PM UTCcarandraugStatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Mon 25 Feb 2013 11:31:48 PM UTCrik5StatusNeed Info=>Confirmed
    Mon 25 Feb 2013 10:29:14 PM UTCarclanceAttached File-=>Added tile_1x3_rgb_hqx2.png, #27529
    Wed 07 Nov 2012 10:42:49 PM UTCrik5Item GroupMatlab Compatibility=>Incorrect Result
      StatusNone=>Need Info

    Back to the top


    Powered by Savane 3.1-cleanup