bugGNU Octave - Bugs: bug #47506, rgb2ind creates colormap...

 
 

bug #47506: rgb2ind creates colormap incompartible to ind2rgb

Submitted by:  Daniel Roeske <dmjr>
Submitted on:  Wed 23 Mar 2016 08:33:45 AM UTC  
 
Category: LibrariesSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: DuplicateAssigned to: None
Originator Name: Open/Closed: Closed
Release: 4.0.0Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Wed 23 Mar 2016 05:06:56 PM UTC, comment #2:

Thanks for the quick response, problem solved.

Daniel Roeske <dmjr>
Wed 23 Mar 2016 04:14:29 PM UTC, comment #1:

The problem is that your image M is not really a RGB image (or not a very sensible one at least). It will work if you change its type to uint8.

Your rgb image is of class double therefore its values should be in the range [0 1]. The real issue is with ind2rgb not handling values outside that range. This has been addressed in bug #41851 and already fixed (it will be part of 4.2 or whatever is the upcoming minor release).

Note that even with the fix, you will not get back the same values. Your values will be clipped to the [0 1] range.

Carnë Draug <carandraug>
Project Member
Wed 23 Mar 2016 08:33:45 AM UTC, original submission:

When running the following code, which converts rgb to ind and back to rgb, the following exception is raised:

Mrgb=ind2rgb(Mind,map)
error: ind2rgb: MAP must be a valid colormap
error: called from
ind2x at line 37 column 5
ind2rgb at line 49 column 10

Example code

M(:,:,1) = [225 230 250 243 20 3 244 247 255 255
242 252 239 0 239 224 27 252 255 255
224 239 28 243 236 231 240 11 255 255
243 252 15 224 15 12 251 0 255 255
224 11 252 227 0 11 232 251 0 255
243 4 255 228 19 4 243 224 0 255

  1. 255 236 251 228 251 224 243 255 0

19 236 255 224 27 12 251 236 255 0
0 255 255 255 255 255 255 255 255 0
255 0 0 0 0 0 0 0 0 255];
M(:,:,2) =[255 255 255 255 0 0 255 255 255 255
255 255 255 0 255 255 0 255 255 255
255 255 0 255 255 255 255 0 255 255
255 255 0 255 0 0 255 0 255 255
255 0 255 255 0 0 255 255 0 255
255 0 255 255 0 0 255 255 0 255

  1. 255 255 255 255 255 255 255 255 0
  2. 255 255 255 0 0 255 255 255 0
  3. 255 255 255 255 255 255 255 255 0

255 0 0 0 0 0 0 0 0 255];
M(:,:,3) = [255 255 255 255 0 0 255 255 255 255
255 255 255 0 0 0 0 255 255 255
255 255 0 0 0 0 0 0 255 255
255 255 0 0 0 0 0 0 255 255
255 0 0 0 0 0 0 0 0 255
255 0 0 0 0 0 0 0 0 255

  1. 0 0 0 0 0 0 0 0 0
  2. 0 0 0 0 0 0 0 0 0
  3. 0 0 0 0 0 0 0 0 0

255 0 0 0 0 0 0 0 0 255];
[Mind map]=rgb2ind(M)
Mrgb=ind2rgb(Mind,map)

Daniel Roeske <dmjr>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by dmjr (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 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 23 Mar 2016 04:14:49 PM UTCcarandraugOpen/ClosedOpen=>Closed
    Wed 23 Mar 2016 04:14:29 PM UTCcarandraugItem GroupSegfault, Bus Error, etc.=>Incorrect Result
      StatusNone=>Duplicate
      Dependencies-=>Depends on bugs #41851

    Back to the top


    Powered by Savane 3.1-cleanup1