[Top][All Lists]

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

[Octave-bug-tracker] [bug #49130] uint8 images are not shown correctly b

From: Dan Sebald
Subject: [Octave-bug-tracker] [bug #49130] uint8 images are not shown correctly by imshow with gnuplot
Date: Wed, 28 Sep 2016 21:15:23 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0

Follow-up Comment #14, bug #49130 (project octave):

I'm attaching a new changeset which puts all the color transforming code into
one subroutine.  It actually reduces a lot of conditional code in the main

There are a couple bug fixes hadn't been acknowledged beyond the general bug
fix.  One is that I removed the code that sets some parent/graphics-object
properties when the image data is logical.  That caused a problem with
whatever follows the logical example:

I = uint8 (255*rand (64,64));
imshow (I)
[looks fine]

I = (rand (64,64) >= 0.5);
imshow (I)

I = uint8 (255*rand (64,64));
imshow (I)
[shows up mostly black if the colormap is set by logical]

With the fix, the behavior is consistent with qt toolkit.

The second bug was the true color case.  In some sense, it might be nice if
gnuplot behaved slightly different, but as it is the cbrange also affects
three component RGB data.  That complicates matters since cbrange needs to be
proper for the colormap as well.  So, what I've done is use the colormaps
length as an input to the inverse mapping of what gnuplot uses when applying
its cbrange formula.

I've tested with the patch with the following:

x = uint8 ((1:128)' + (1:128));
y = repmat (x, 1, 1, 3);
imshow (x)
imshow (y)

I = (rand (64,64) >= 0.5);
imshow (I)

I = uint8 (255*rand (64,64));
imshow (I)

demo imshow

demo patch

comparing against qt toolkit.  I also reran the tests here:


to make sure that behavior hasn't changed inadvertently.

(file #38621)

Additional Item Attachment:

File name: octave-gnuplot_color_scale_bug49130-djs2016sep28.patch Size:7 KB


Reply to this item at:


  Message sent via/by Savannah

reply via email to

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