bugGNU Octave - Bugs: bug #37410, image.m has a wrong check for...


bug #37410: image.m has a wrong check for linearly-spaced x and y

Submitted by:  Francesco Potortì <pot>
Submitted on:  Thu Sep 20 11:44:33 2012  
Category: LibrariesSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Regression
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: 3.6.2Operating System: GNU/Linux

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

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


(Jump to the original submission Jump to the original submission)

Mon Oct 14 01:09:14 2013, comment #6:

We don't necessarily need std(), but we would like something that is dimensionless and the coefficient of variation was one such measure.

Consider the following example which has small, but non-linear, spacing and would still pass your criterion.

which displays "linear".

I think this code should work which uses the percentage change (dimensionless) from the mean delta.

I checked it in here http://hg.savannah.gnu.org/hgweb/octave/rev/a433244dd697.

Rik <rik5>
Project Administrator
Sat Oct 12 14:18:31 2013, comment #5:

I guess your testcase is

Why do we need std in the linearity check? Isn't something like

sufficient? Regards, Andy

Andreas Weber <andy1978>
Project Member
Thu Sep 20 13:50:18 2012, comment #4:

I'd like to eliminate the use of length in Octave because the definition of length (inherited from prehistoric Matlab) is weird. So please use numel instead unless there is some specific case that actually needs the strange behavior of the length function. And in that case, please comment why it is needed.

John W. Eaton <jwe>
Project Administrator
Thu Sep 20 13:29:14 2012, comment #3:

Yes. This is the code as I am currently using it:

dx = diff (x);
dy = diff (y);
dx = std (dx) / mean (abs (dx));
dy = std (dy) / mean (abs (dy));
tol = 100*eps;
if (any (dx > length(x)tol) || any (dy > length(y)tol))
warning ("Image does not map to non-linearly spaced coordinates")

The only change is in the 'if' condition.

Francesco Potortì <pot>
Thu Sep 20 13:18:12 2012, comment #2:

Did you mean:
tol = 100length(x) eps;

Doug Stewart <dastew>
Thu Sep 20 12:05:25 2012, comment #1:

Sorry, I meant length(x) rather than rows(x).

Francesco Potortì <pot>
Thu Sep 20 11:44:33 2012, original submission:

The check in image.m is

dx = diff (x);
dx = std (dx) / mean (abs (dx));
tol = 100*eps;
if (any (dx > tol))

but this is too strict.

I stumbled upon it with x=linspace(0,10.43,743);

I suggest to set

tol = 100*rows(x);

Francesco Potortì <pot>


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

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by andy1978 (Posted a comment)
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by dastew (Posted a comment)
  • -unavailable- added by pot (Submitted the item)

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

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon Oct 14 01:09:14 2013rik5StatusNone=>Fixed

    Back to the top

    Powered by Savane 3.1-cleanup1