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

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

[Octave-bug-tracker] [bug #55059] [octave forge] (image) Failing unit te


From: Hartmut
Subject: [Octave-bug-tracker] [bug #55059] [octave forge] (image) Failing unit test for grayslice
Date: Mon, 3 Dec 2018 08:52:06 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0

Follow-up Comment #9, bug #55059 (project octave):

Here is the current Matlab (R2017b I think) behavior:


klassen = {'uint8', 'uint16', 'int16', 'single', 'double'};
for num = 1:length(klassen)
    disp('----------');
    klasse = klassen{num}
    if any(strcmp(klasse, {'uint8', 'int8', 'uint16', 'int16'}))
        vec = [intmin(klasse): intmax(klasse)];
    else
        vec = [0:0.001:1];
        cast(vec, klasse);
    end
    min_max = [min(vec), max(vec)]
    
    erg05 = grayslice(vec, [0.5]);
    first1_ind = find(erg05);
    first1_erg05 = vec(first1_ind(1))
    
    erg5 = grayslice(vec, [5]);
    first1_ind = find(erg5);
    first1_erg5 = vec(first1_ind(1))
    
    int5 = uint8(5);
    ergint5 = grayslice(vec, [int5]);
    first1_ind = find(ergint5);
    first1_ergint5 = vec(first1_ind(1)) 
end


gives the following results in Matlab:


 ----------
 klasse =
     'uint8'
 min_max =
   1x2 uint8 row vector
      0   255
 first1_erg05 =
   uint8
    1
 first1_erg5 =
   uint8
    51
 first1_ergint5 =
   uint8
    51
 ----------
 klasse =
     'uint16'
 min_max =
   1x2 uint16 row vector
        0   65535
 first1_erg05 =
   uint16
    1
 first1_erg5 =
   uint16
    13107
 first1_ergint5 =
   uint16
    13107
 ----------
 klasse =
     'int16'
 min_max =
   1x2 int16 row vector
    -32768    32767
 first1_erg05 =
   int16
    -32767
 first1_erg5 =
   int16
    -19661
 first1_ergint5 =
   int16
    -19661
 ----------
 klasse =
     'single'
 min_max =
      0     1
 first1_erg05 =
     0.5000
 first1_erg5 =
     0.2000
 first1_ergint5 =
     0.2000
 ----------
 klasse =
     'double'
 min_max =
      0     1
 first1_erg05 =
     0.5000
 first1_erg5 =
     0.2000
 first1_ergint5 =
     0.2000
 


I have not had a very thorough look at the output. But my conclusions at a
first glance would be
* All results for ergint5 are the same as for erg5. So the class of the V
vector does not seem to matter: double(5) gives the same splitting as
uint8(5).
* The vector [0.5] (used for result erg05) never does separate into two
halfes. Except for float input images. 
* For integer images, the levels V seem to be understood in the same class

This is very different from what the Matlab help page made me think.

Please have a closer look at those Matlab outputs and let's try to make our
function Matlab compatible (and do a better documentation as they did).


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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