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

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

[Octave-bug-tracker] [bug #55373] [octave forge] (image) random failure


From: Hartmut
Subject: [Octave-bug-tracker] [bug #55373] [octave forge] (image) random failure of unit test in imadjust.m
Date: Wed, 23 Dec 2020 16:46:24 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0

Follow-up Comment #1, bug #55373 (project octave):

I have found why this BIST is randomly failing: It works with random numbers.
And it compares the result of imadjust on an integer type image with the
result of imadjust on the same image that has been cast do double before. But
this comparison happens in the integer domain, so the result from the double
image needs to be cast back into the integer domain (see code below). And
during this last step it can happen that the double result is something like
120.5000000000. Depending on a "rounding error" of the size eps this can give
120 or 121. And voila: a failing test for a value difference of one.

I plan to change all the assert lines in the last BIST (this is the only BIST
making trouble) in the following way. The idea is to do the comparison in the
floating point domain and to allow for a rounding error of the size of "a bit
more than a 0.5 integer step".

In code, my proposal to change those assert lines in the last BIST looks like
follows:


in_u8 = randi ([0 255], 5, 5, 2, 3, "uint8");
in_u8_d = im2double (in_u8);
lim_u8 =  eps + 0.5/double (intmax ("uint8")); # NEW

# old assert line in last BIST:
assert (imadjust (in_u8), im2uint8 (imadjust (in_u8_d)))

# my proposal for NEW assert line in last BIST:
assert (im2double (imadjust (in_u8)), imadjust (in_u8_d), lim_u8)


Has anyone comments on this? If I do not "hear" any objections, I will prepare
a patch to change all (12) assert lines in the last BIST of imadjust in this
way.

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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