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

 
 

bug #51986: [octave forge] (image) Failing unit test for cp2tform

Submitted by:  Rafael Laboissiere <rlaboiss>
Submitted on:  Sun 10 Sep 2017 07:11:44 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

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 21 Nov 2017 09:37:27 AM UTC, comment #4: 

Thank you. I have adjusted the tolerance accordingly.
http://hg.code.sf.net/p/octave/image/rev/22ca8c0ee911

Carnë Draug <carandraug>
Project Member
Sun 12 Nov 2017 09:20:52 PM UTC, comment #3: 

Running 4.2.1 32 bit version on Windows machine,
I have found that the first test (projective) needs slightly more than one eps.  2*eps will suffice.

The last test (polynomial, ord=4) needs 6*eps

Avinoam Kalma <avinoam>
Project Member
Fri 10 Nov 2017 12:53:14 PM UTC, comment #2: 

I couldn't reproduce this after 500 iterations. Maybe because I'm running in x86-64 ?

If the issue is i386 only, could you please suggest an appropriate tolerance value.

Carnë Draug <carandraug>
Project Member
Thu 09 Nov 2017 08:14:13 PM UTC, comment #1: 

It seems like a tolerance problem. Increasing the tolerance will stop these random fails.

Avinoam Kalma <avinoam>
Project Member
Sun 10 Sep 2017 07:11:44 PM UTC, original submission:  

The following units test for function cp2tform in package image fail randomly:

+verbatim
%!test
%! npt = 100000;
%! [crw, cap] = coords (npt);
%! ttype = 'projective';
%! T = cp2tform (crw, cap, ttype);
%! crw2 = tforminv (T, cap);
%! finalerr = norm (crw - crw2)/npt;
%! assert (finalerr < eps, "norm = %3.2e ( > eps)", finalerr)

%!test
%! npt = 100000;
%! [crw, cap] = coords (npt);
%! ttype = 'affine';
%! T = cp2tform (crw, cap, ttype);
%! crw2 = tforminv (T, cap);
%! finalerr = norm (crw - crw2)/npt;
%! assert (finalerr < eps, "norm = %3.2e ( > eps)", finalerr)

%!test
%! npt = 100000;
%! [crw, cap] = coords (npt);
%! ttype = 'nonreflective similarity';
%! T = cp2tform (crw, cap, ttype);
%! crw2 = tforminv (T, cap);
%! finalerr = norm (crw - crw2)/npt;
%! assert (finalerr < eps, "norm = %3.2e ( > eps)", finalerr)

%!test
%! npt = 100000;
%! [crw, cap] = coords (npt);
%! cap(:,2) *= -1; % reflection around y axis
%! ttype = 'similarity';
%! T = cp2tform (crw, cap, ttype);
%! crw2 = tforminv (T, cap);
%! finalerr = norm (crw - crw2)/npt;
%! assert (finalerr < eps, "norm = %3.2e ( > eps)", finalerr)
-verbatim-

This is an example of how the bug can be triggered:

octave:1> pkg load image
octave:2> function [crw, cap] = coords (npt = 1000, scale = 2, dtheta = pi/3, dx = 2, dy = -6, sig2noise = 1e32)
  theta = (rand(npt, 1)*2-1)*2*pi;
  R = rand(npt,1);
  y = R.*sin(theta);
  x = R.*cos(theta);
  crw = [y x];

  thetap = theta + dtheta;
  Rap = R * scale;

  yap = Rap.*sin(thetap);
  yap = yap + dy;
  yap = yap + rand (size (yap)) * norm (yap) / sig2noise;

  xap = Rap.*cos(thetap);
  xap = xap + dx;
  xap = xap + rand (size (xap)) * norm (xap) / sig2noise;
  cap = [yap xap];
endfunction

while 1
npt = 100000;
[crw, cap] = coords (npt);
cap(:,2) *= -1;        % reflection around y axis
ttype = 'similarity';
T = cp2tform (crw, cap, ttype);
crw2 = tforminv (T, cap);
finalerr = norm (crw - crw2)/npt;
assert (finalerr < eps, "norm = %3.2e ( > eps)", finalerr)
endwhile
error: norm = 2.25e-16 ( > eps)
error: called from
    assert at line 94 column 11

Rafael Laboissiere <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 avinoam (Posted a comment)
  • -email is unavailable- added by avinoam
  • -email is unavailable- added by rlaboiss (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-11-21 carandraug StatusNone => Fixed
        Open/ClosedOpen => Closed
    2017-11-09 avinoam Carbon-Copy- => Added carandraug@octave.org

    Back to the top


    Powered by Savane 3.5