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


bug #55202: [octave forge] (image) imresize fails for method nearest and image of 1 row

Submitter:  Tis Veugen <tis>
Submitted:  Tue 11 Dec 2018 09:34:34 AM UTC
Category:  Octave Forge Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  Tis Veugen Open/Closed:  * Closed
Release:  * 4.2.1 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Sat 28 Aug 2021 02:10:56 PM UTC, comment #4: 

This bug has been fixed while solving bug #60946.
Closing as fixed.

Avinoam Kalma <avinoam>
Group Member
Thu 21 Mar 2019 07:14:47 PM UTC, comment #3: 

my opinion:

  • to 1: (fixing the problem in interp2): Is this a bug happening in interp2? Meaning: what is the exact call to interp2 that is produced by the call to imresize quoted in comment #0? Does this call to interp2 also provoce an error message when called in Matlab? If yes, I would consider this a bug in interp2 and try to fix it there, at the origin. In this case, this solution 1 might probably be my personal favorite.

  • to 2: I am not sure I fully understood this. But his doesn's sound very organized. In some cases (meaning some type of input images) the actuall interpolation will happen in interp2, and in other cases the actual interpolation will happen somewhere else.

  • to 3: The solution following this route might become more convoluted as shown in comment #2. Because imresize can currently deal with Nd images, and I'd like to preserve this capability. This means also sz(3) and sz(1043) needs to be checked. And an input image can be of size 1 also in several dimensions at the same time.
Hartmut <hardy>
Thu 21 Mar 2019 12:28:59 PM UTC, comment #2: 

Trying to fix this problem, I condsidered three different strategies:

1. Fix in inrerp2, (becuase the error is seen there) - check if size of Y is less than 2, and make a proper treatment

2. Check is size(I,1) == 1 or size (I,2) == 1, an use interp1 instead of interp2, and them duplicate the result, if the output is greater than one in the problematic axis

3. duplicate the data in the axis of size 1, and then call interp2:

  if (sz(1) == 1)
##  corner case of one row (bug #55202)
##  duplicate the row such that it will not fail in interp2
    sz(1) = 2;
    im2 = zeros (sz);
    im2(1,:,:) = im(1,:,:);
    im2(2,:,:) = im(1,:,:);
    im = im2;
  if (sz(2) == 1)
##  corner case of one column (bug #55202)
##  duplicate the column such that it will not fail in iterp2
    sz(2) = 2;
    im2 = zeros (sz);
    im2(:,1,:) = im(:,1,:);
    im2(:,2,:) = im(:,1,:);
    im = im2;

this seems to be the simplest way.

What do you think?

Avinoam Kalma <avinoam>
Group Member
Tue 11 Dec 2018 09:30:37 PM UTC, comment #1: 

Adding people to CC

Avinoam Kalma <avinoam>
Group Member
Tue 11 Dec 2018 09:34:34 AM UTC, original submission:  

Error occurs for image with 1 row:
im = zeros( 1, 20 );
rim = imresize( im, [ 1 30 ], "nearest" );

error: Y(2): out of bound 1
error: called from
    interp2 at line 238 column 10
    imremap>grayinterp at line 82 column 12
    imremap at line 67 column 19
    imresize at line 135 column 8

Please, fix.

Tis Veugen <tis>


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

Attach Files:

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

    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 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-08-28 avinoam StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2018-12-12 avinoam StatusNone Confirmed
        Operating SystemMicrosoft Windows Any
    2018-12-11 avinoam Carbon-Copy- Added hardy
        Carbon-Copy- Added carandraug
    2018-12-11 mtmiller CategoryOctave Function Octave Forge Package
        Summaryimresize fails for method nearest and image of 1 row [octave forge] (image) imresize fails for method nearest and image of 1 row
    2018-12-11 tis Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.12.
    Corresponding source code