bugGNU Octave - Bugs: bug #39887, imresize (in image package)...


bug #39887: imresize (in image package) function behaves differently from matlab version

Submitted by:  None
Submitted on:  Wed 28 Aug 2013 03:06:37 PM UTC  
Category:  Octave Forge Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  Closed Release:  3.6.4
Operating System:  Any

Add a New Comment(Rich Markup)

You are not logged in

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


Mon 09 Sep 2013 10:55:26 AM UTC, comment #3:

Thank you very much. I have pushed your changes


Carnë Draug <carandraug>
Project Member
Sat 07 Sep 2013 11:18:51 PM UTC, comment #2:

I'm not the original reporter, but it seemed so easy I went ahead and made a changeset for you (see attached).

While I was testing this however, I noticed that we actually get different behavior from MATLAB when passing fractional sizes. For example, say I do:

In octave, we round the target size, and end up with a 3x8 result. MATLAB seems to do a ceil() on the target size instead, because there the result is 4x9.

I also attached a second changeset that (when applied after the first one) fixes that problem too. Maybe a second bug report would have been better, but since the changesets are intertwined, this seems more logical.

(file #29044, file #29045)

Ben Kurtz <bkurtz>
Wed 28 Aug 2013 05:13:06 PM UTC, comment #1:

That should be easy to fix. Could you prepare a changeset for that? The repository for the image package is at https://sourceforge.net/p/octave/image/

Carnë Draug <carandraug>
Project Member
Wed 28 Aug 2013 03:06:37 PM UTC, original submission:

When doing

imresize(img, [400, NaN])

in matlab, it resizes the image "img" to a height of 400 and a width that is proportional to the image before. Doing the same in octave results in an image of size (400, 1)

See also the matlab documentation when giving "NaN" for width or height:




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

Attach Files:

Attached Files
file #29044:  imresize.cs added by bkurtz (3KiB - application/octet-stream)
file #29045:  imresize_ceil.cs added by bkurtz (1KiB - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by bkurtz (Updated the item)
  • -email is unavailable- added by rggjan

    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.


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



    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    Mon 09 Sep 2013 10:55:26 AM UTC carandraug StatusNone => Fixed
        Open/ClosedOpen => Closed
    Sat 07 Sep 2013 11:18:51 PM UTC bkurtz Attached File- => Added imresize.cs, #29044
        Attached File- => Added imresize_ceil.cs, #29045
    Wed 28 Aug 2013 03:08:48 PM UTC rggjan Carbon-Copy- => Added -email is unavailable-

    Back to the top

    Powered by Savane 3.3