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

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

[Octave-bug-tracker] [bug #65384] image 'cdata' property fails to update


From: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #65384] image 'cdata' property fails to update class-dependent color behavior
Date: Thu, 29 Feb 2024 23:45:19 -0500 (EST)

Follow-up Comment #4, bug#65384 (group octave):

ok, out at m-code level, yes that whole block seems unnecessary.  but i don't
think the caxis('auto') is needed.

set('clim') both changes the clim values to [intmin intmax], and setting it
also sets the 'climmode' to manual.  Removing it keeps the 'auto' setting so
that  clim is adjusted after the subsequent set command no matter whether
cdata was type int.  I'm not sure if maybe that block was put there because of
former matlab behavior or not, but it can't find any case where it's necessary
for compatibility now.  running a make check on that now, but of course we
don't exactly have a large test suite for the graphics functions. (e.g., i see
imagesc doesn't have any)

i do notice something else though after fixing that.  clim should apparently
only be adjusted when using a 2d cdata.  for a 3d cdata matlab leaves clim
alone. that change appears to be done by ___go_image__ though, so i haven't
been able to step through to see where exactly it happens.

the main issue only occurred when the image was created as RGB and with an
integer. below are some test results for both before and after the fix and
compared with matlab. I'll work up some BISTs.

Matlab 2023b, same output whether uint8 or not, makes colored blocks:

close all; clear;
hf = figure;hax = gca;
get(hax, 'clim'), get(hax,'climmode')
ans =  0     1

ans = 'auto'

him = imagesc(uint8(randi([1 64], 16, 16, 3)));
get(hax, 'clim'), get(hax,'climmode'),get(him, 'cdatamapping')

ans =   0     1

ans = 'auto'

ans = 'scaled'

set(him, 'cdata', rand(16,16))
get(hax, 'clim'), get(hax,'climmode'),get(him, 'cdatamapping')

ans = 0.0046    0.9961

ans = 'auto'

ans = 'scaled'



Octave 9.0.90, with double input, makes colored blocks:

close all; clear;
hf = figure;hax = gca;
get(hax, 'clim'), get(hax,'climmode')
ans =

   0   1

ans = auto
him = imagesc(randi([1 64], 16, 16, 3));
get(hax, 'clim'), get(hax,'climmode'), get(him, 'clim'), get(him,
'cdatamapping')
ans =

    1   64

ans = auto
ans =

     1    64     1  -Inf

ans = scaled
set(him, 'cdata', rand(16,16))
get(hax, 'clim'), get(hax,'climmode'), get(him, 'clim'), get(him,
'cdatamapping')
ans =

   4.8908e-03   9.9539e-01

ans = auto
ans =

   4.8908e-03   9.9539e-01   4.8908e-03         -Inf

ans = scaled


Octave 9.0.90, with uint8 input, before fix, makes solid purple block:

close all; clear;
hf = figure;hax = gca;
get(hax, 'clim'), get(hax,'climmode')
ans =

   0   1

ans = auto
him = imagesc(uint8(randi([1 64], 16, 16, 3)));
get(hax, 'clim'), get(hax,'climmode'), get(him, 'clim'), get(him,
'cdatamapping')
ans =

     0   255

ans = manual
ans =

     1    64     1  -Inf

ans = scaled
set(him, 'cdata', rand(16,16))
get(hax, 'clim'), get(hax,'climmode'), get(him, 'clim'), get(him,
'cdatamapping')
ans =

     0   255

ans = manual
ans =

   2.6834e-03   9.9864e-01   2.6834e-03         -Inf

ans = scaled


Octave 9.0.90, with uint8 input, after fix, makes colored blocks:

>> close all; clear;
>> hf = figure;hax = gca;
>> get(hax, 'clim'), get(hax,'climmode')
ans =

   0   1

ans = auto
>> him = imagesc(uint8(randi([1 64], 4, 4, 3)));
>> get(hax, 'clim'), get(hax,'climmode'), get(him, 'clim'), get(him,
'cdatamapping')
ans =

    3   64

ans = auto
ans =

     3    64     3  -Inf

ans = scaled
>> set(him, 'cdata', rand(16,16))
>> get(hax, 'clim'), get(hax,'climmode'), get(him, 'clim'), get(him,
'cdatamapping')
ans =

   9.1291e-04   9.9972e-01

ans = auto
ans =

   9.1291e-04   9.9972e-01   9.1291e-04         -Inf

ans = scaled




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?65384>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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