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

 
 

bug #44799: [octave forge] (image) imrotate chrashes when using 'spline' as interpolation method

Submitter:  Max Görner <maxg>
Submitted:  Fri 10 Apr 2015 01:41:44 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Wont Fix 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
   

Jump to the original submission

Mon 22 Aug 2022 05:19:34 AM UTC, comment #13: 


Closing as "Wont Fix"
Thank you all guys.

Avinoam Kalma <avinoam>
Group Member
Tue 08 Feb 2022 08:09:30 PM UTC, comment #12: 
Avinoam Kalma <avinoam>
Group Member
Mon 07 Feb 2022 08:31:38 AM UTC, comment #11: 

In Matlab (R2019b) I get the following result when running the code from comment #0:


>> M = rand(50);
>> N = imrotate(M,45,'spline');
Error using imrotate>checkStringValidity (line 291)
Unknown interpolation method or BBOX: spline

Error in imrotate>parse_inputs (line 244)
    checkStringValidity(idx,arg);

Error in imrotate (line 67)
[A,ang,method,bbox] = parse_inputs(args{:});


Matlab does not always what its documentation says. But in this case it really simply throws an error message, since the "spline" method is just not supported by its imrotate function.

So I would also be fine with only updating the documentation of our image package function imrotate accordingly. We could say there for example that "in current versions of core Octave (up to version 7) the 'spline' method is not supported by imrotate". That would leave the possibility open that the spline method might work in the future if core Octave ever fixes this issue in interp2 (see Carne's comment #7).

Hartmut <hardy>
Sun 06 Feb 2022 05:44:02 AM UTC, comment #10: 

Thanks, @Nick, I will update the documentation.

Avinoam Kalma <avinoam>
Group Member
Fri 04 Feb 2022 12:36:29 PM UTC, comment #9: 

So it sounds like, if spline is never expected to work (comment #7), and MATLAB doesn't expect it to work (removing compatibility concerns), and it in fact just throws an error, this should be fixed by editing imrotate to throw an informative error when spline is requested and adjust the documentation accordingly.

Nicholas Jankowski <nrjank>
Group Member
Fri 04 Feb 2022 12:28:51 PM UTC, comment #8: 

Reading MATLAB documentation,
https://www.mathworks.com/help/images/ref/imrotate.html
"spline" is not a valid interpolation method. Only "nearest", "bilinear" and "bicubic" are allowed.

Avinoam Kalma <avinoam>
Group Member
Tue 09 May 2017 01:39:15 AM UTC, comment #7: 

I would like to avoid saying that the spline method does not work on the documentation, because once it does work in core, it automatically works in the image package.  I made mention of the core version then:

http://hg.code.sf.net/p/octave/image/rev/7f31f3eef4c9

As a fix, I tried to replace interp2 with interpn whose implementation of spline seems to work fine for out of order grids.  However, seems like interpn behaves slightly different and different methods had different issues.  They were not wrong, theyr were rotate around a corner instead a center, or rotated in the other direction, or things like that. Not sure if an issues with interpn or the preparation of data to interpn.

Carnë Draug <carandraug>
Group Member
Mon 03 Apr 2017 05:40:38 PM UTC, comment #6: 

As long as this (Octave core) issue is not fixed, should we maybe change the documentation in the image package accordingly?

Currently the help string of imrotate.m reads:

The optional argument METHOD defines the interpolation method to be used.  All methods supported by 'interp2' can be used.


And the help string of interp2.m (in Octave core) then claims:

The interpolation METHOD is one of:
[...]
"spline"
[...]


This leads users of imrotate to the wrong conclusion, that "spline" is a valid option for the method parameter of imrotate. But imrotate then only throws an (interp2) error, since a rotated pixel grid is nearly never evenly spaced, as currently needed by interp2 (more precise: needed by _splinen_.m).

So if (core) interp2.m isn't fixed in the near future, I would suggest to add the text "(except for 'spline')" to the help string of (image package) imrotate. This help text would then read like this:

The optional argument METHOD defines the interpolation method to be used.  All methods supported by 'interp2' can be used (except for 'spline').  In addition, Fourier interpolation by decomposing the rotation matrix into 3 shears can be used with the 'fourier' method.  By default, the 'nearest' method is used.

For MATLAB compatibility, the methods 'bicubic' (same as 'cubic'), 'bilinear' and 'triangle' (both the same as 'linear') are also supported.


Hartmut <hardy>
Tue 14 Mar 2017 07:14:07 AM UTC, comment #5: 

it is a bit weird that interp2(..., 'spline') requires the interpolation points to be on a regular grid, as they're normally scattered (contrary to the original grid itself).

Felipe G. Nievinski <fgnievinski>
Fri 23 Dec 2016 10:46:49 PM UTC, comment #4: 

This issue is still present in Octave 4.2.0 with image-2.6.1.

Since the underlying issue is with interp2.m, this bug report should be re-labeled to be an Octave CORE issue, not only an image package issue.

Hartmut <hardy>
Fri 10 Apr 2015 03:04:14 PM UTC, comment #3: 

interp2 with "spline" can't handle arbitrary grids yet (There is a "FIXME: Allow arbitrary grids..." in _splinen_.m)


interp2 (magic(3), [1,2;1,2], [1,1.5;2,2], "spline")
error: interp2: XI, YI must have uniform spacing ('meshgrid' format)


Andreas Weber <andy1978>
Group Member
Fri 10 Apr 2015 02:34:09 PM UTC, comment #2: 

I'm sorry, I just stumbled across this error.
Currently I do not have the time to analyse the source code and to create a patch then.

Max Görner <maxg>
Fri 10 Apr 2015 02:18:28 PM UTC, comment #1: 

Confirmed in image package version 2.4.0

Could you please submit a changeset/patch?

Carnë Draug <carandraug>
Group Member
Fri 10 Apr 2015 01:41:44 PM UTC, original submission:  

It is quite simple:


M = rand(50);
N = imrotate(M,45,'cubic');
N = imrotate(M,45,'spline');
error: interp2: input data must have 'meshgrid' format
error: called from:
error:   /usr/share/octave/3.8.2/m/general/interp2.m at line 409, column 9
error:   /usr/share/octave/packages/image-2.2.2/imremap.m at line 84, column 12
error:   /usr/share/octave/packages/image-2.2.2/imremap.m at line 66, column 12
error:   /usr/share/octave/packages/image-2.2.2/imperspectivewarp.m at line 125, column 17
error:   /usr/share/octave/packages/image-2.2.2/imrotate.m at line 162, column 20


Max Görner <maxg>

 

(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 nrjank (Posted a comment)
  • -email is unavailable- added by avinoam (Posted a comment)
  • -email is unavailable- added by jwe (Updated the item)
  • -email is unavailable- added by fgnievinski (Posted a comment)
  • -email is unavailable- added by hardy (Posted a comment)
  • -email is unavailable- added by andy1978 (Posted a comment)
  • -email is unavailable- added by maxg (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 group members can vote.

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-08-22 avinoam StatusConfirmed Wont Fix
        Open/ClosedOpen Closed
    2022-02-04 mtmiller Carbon-CopyRemoved 80942 -
    2017-08-13 jwe Summaryimage package: imrotate chrashes when using 'spline' as interpolation method [octave forge] (image) imrotate chrashes when using 'spline' as interpolation method
    2015-05-05 mtmiller Item GroupSegfault, Bus Error, etc. Incorrect Result
        StatusNone Confirmed
        Operating SystemGNU/Linux Any
    2015-04-10 carandraug Release3.8.2 other
        Summaryimrotate chrashes when using \'spline\' as interpolation method image package: imrotate chrashes when using 'spline' as interpolation method

    Back to the top

    Powered by Savane 3.13-cf05.
    Corresponding source code