octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #41851] ind2rgb tests


From: Rik
Subject: [Octave-bug-tracker] [bug #41851] ind2rgb tests
Date: Thu, 13 Mar 2014 21:42:20 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:27.0) Gecko/20100101 Firefox/27.0

Follow-up Comment #3, bug #41851 (project octave):

I don't know what Matlab is doing, but I think Octave is correct in rejecting
the variable img as not being an indexed image.

When the img is of type double, a 1 in the matrix points to the first row in
the colormap.  When the img is an integer type, such as uint8, then an offset
of 1 is used such that a 0 in the matrix points to the first row in the
colormap.  See Matlab's own documentation for more information
(http://www.mathworks.com/help/matlab/creating_plots/image-types.html).

In the posted code, the image is originally in uint8 format and thus has 0
values.  Using double() to convert a uint8 image is not correct.  You actually
need to do


img_double = double (img) + 1;




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?41851>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]