octave-bug-tracker
[Top][All Lists]

## [Octave-bug-tracker] [bug #55202] [octave forge] (image) imresize fails

 From: Avinoam Kalma Subject: [Octave-bug-tracker] [bug #55202] [octave forge] (image) imresize fails for method nearest and image of 1 row Date: Thu, 21 Mar 2019 08:28:59 -0400 (EDT) User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36

```Follow-up Comment #2, bug #55202 (project octave):

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;
endif
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;
endif

this seems to be the simplest way.

What do you think?

_______________________________________________________

<https://savannah.gnu.org/bugs/?55202>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

```