bugGNU Octave - Bugs: bug #51982, [octave forge] (image) Failing...

 
 

bug #51982: [octave forge] (image) Failing unit test for nlfilter

Submitter:  Rafael Laboissière <rlaboiss>
Submitted:  Sun 10 Sep 2017 04:29:58 PM UTC
 
Category:  Octave Forge Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * other Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

Sun 23 Dec 2018 04:28:30 AM UTC, comment #1: 

Thank you for the report.  Finally got the bottom of this.

This is caused because of what nlfilter assumes to be the center of for a sliding window with even length which is different from imdilate. In imdilate it is:

floor ((size (nhood) +1) /2)

while in nlfilter is:

ceil ((size (nhood) +1) /2)

So while we were using imdilate to check if nlfilter was doing what it should with the max filter, the results would always be wrong.

The reason on why the test was almost always passing was pure stupidity on my part.  I was using a very large image of random integers in the range [1 10] because it makes it easier to visualize.  However, I was using a very large window (size 3x4x7x5) so it almost always included the value 10 so the result was almost always a large arrays of 10s.

More details in the commit message 3af35ac9ead9

Carnë Draug <carandraug>
Project Member
Sun 10 Sep 2017 04:29:58 PM UTC, original submission:  

The following unit test for function nlfilter in package image is failing randomly:

%!test
%! a = randi (10, 15, 15, 4, 8, 3);
%! assert (nlfilter (a, [3 4 7 5], @(x) max(x(:))),
%!         imdilate (a, ones ([3 4 7 5])))

This is a way of triggering the bug:

octave:1> pkg load image
octave:2> while 1
octave:3>   a = randi (10, 15, 15, 4, 8, 3);
octave:4>   assert (nlfilter (a, [3 4 7 5], @(x) max(x(:))),
octave:5>           imdilate (a, ones ([3 4 7 5])))
octave:6> endwhile
error: ASSERT errors for:  assert (nlfilter (a, [3, 4, 7, 5], @(x) max (x (:))),imdilate (a, ones ([3, 4, 7, 5])))

  Location  |  Observed  |  Expected  |  Reason
(1,1,1,7,1)       10           9         Abs err 1 exceeds tol 0
(1,1,2,7,1)       10           9         Abs err 1 exceeds tol 0
(1,1,3,7,1)       10           9         Abs err 1 exceeds tol 0
(1,1,4,7,1)       10           9         Abs err 1 exceeds tol 0
(1,1,1,8,1)       10           9         Abs err 1 exceeds tol 0
(1,1,2,8,1)       10           9         Abs err 1 exceeds tol 0
(1,1,3,8,1)       10           9         Abs err 1 exceeds tol 0
(1,1,4,8,1)       10           9         Abs err 1 exceeds tol 0

Rafael Laboissière <rlaboiss>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rlaboiss (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only project members can vote.

     

     

     

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-12-23 carandraug StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top


    Powered by Savane 3.9