[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: |
Tue, 4 Dec 2018 11:25:00 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0 |
Follow-up Comment #13, bug #55059 (project octave):
I've just realised that my (Matlab) test results in comment #9 are not what I
wanted to test. Their calls probably fall into the syntax "grayslice(I, n)",
generating n slices.
Here is a new test code, that makes sure that the syntax "grayslice(I, v)" is
called with a vector v:
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)]
erg0506 = grayslice(vec, [0.5 0.6]);
first1_ind = find(erg0506);
first1_erg0506 = vec(first1_ind(1))
erg56 = grayslice(vec, [5 6]);
first1_ind = find(erg56);
first1_erg56 = vec(first1_ind(1))
int56 = uint8([5 6]);
ergint56 = grayslice(vec, int56);
first1_ind = find(ergint56);
first1_ergint56 = vec(first1_ind(1))
end
And here are the corresponding Matlab results:
----------
klasse =
'uint8'
min_max =
1x2 uint8 row vector
0 255
first1_erg0506 =
uint8
1
first1_erg56 =
uint8
5
first1_ergint56 =
uint8
5
----------
klasse =
'uint16'
min_max =
1x2 uint16 row vector
0 65535
first1_erg0506 =
uint16
1
first1_erg56 =
uint16
5
first1_ergint56 =
uint16
5
----------
klasse =
'int16'
min_max =
1x2 int16 row vector
-32768 32767
first1_erg0506 =
int16
-32767
first1_erg56 =
int16
-32763
first1_ergint56 =
int16
-32763
----------
klasse =
'single'
min_max =
0 1
first1_erg0506 =
0.5000
first1_erg56 =
1
first1_ergint56 =
1
----------
klasse =
'double'
min_max =
0 1
first1_erg0506 =
0.5000
first1_erg56 =
1
first1_ergint56 =
1
Those outputs are different from the results in comment #9.
My implications from this are:
* giving v=[5 6] does the same, it does not matter if v is double or uint8. I
suspect that the CLASS OF V does not matter at all.
* giving v=[5 6] on an IMAGE I of a INTEGER class, does the first "cut" at the
5th smalles value that is possible in the (integer class) of I. I suspect that
for those integer images, the vector v is taken relative to intmin of the
image.
* giving v=[5 6] on an IMAGE I of FLOAT class, does the cut at the value of 1
(probably float inputs are expected to be between 0 and 1, and that's why 5 is
kind of Inf in this case). I suspect that for float images, the vector v is
cast to a float class (and maybe afterwards trunctated to the interval 0..1)
Does this make sense? Any thoughts?
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?55059>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/