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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #61754] Bicubic interpolation in interp2() inc


From: Christof Kaufmann
Subject: [Octave-bug-tracker] [bug #61754] Bicubic interpolation in interp2() incompatible with Matlab
Date: Mon, 7 Feb 2022 02:50:37 -0500 (EST)

Follow-up Comment #14, bug #61754 (project octave):

Thanks for the corrections.

The for loop has got only 4 iterations with big operations.  I tried to
vectorize it, but it was not easy to do.  I would have the shifts in the third
axis, but when selecting rows (or columns) of Z the shape is not preserved. 
Reshaping would require transposing in one of the cases, if I did not overlook
something.  My conclusion was, that this is unlikely to be faster, but
complicates the code quite a lot.

Another optimization possibility could be the padding.  Padding is not always
necessary.  It is only required if there are points near the boundary.  So
this is not so much about performance, but more of the memory footprint, since
it might avoid one copy of `Z`.  Thinking further, the full copy could always
be avoided, when dealing with the near-boundary-points separately.  Then only
the three first or last rows or columns had to be copied and one row or column
padded, which would be cheaper.  The special case of copying the last row or
column could also be caught, instead of using the algorithm with double
padding there.  However, these are a lot of special cases for the code and the
improvement might be rather low.

Regarding your suggestion with conv2() or filter2():  No, only if the
interpolation is a pure translation (and optional crop), it is a real
convolution.  In this case `h` would contain the same value, since it is the
distance to the point before.  Usually it is not a convolution, or, it may be
considered as a convolution with a different kernel everywhere.  So it is just
similar to a convolution and conv2() or filter2() cannot be applied.

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]