commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (MATH-1166) BicubicInterpolation may have a bug
Date Sun, 23 Nov 2014 19:20:12 GMT

     [ https://issues.apache.org/jira/browse/MATH-1166?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Gilles updated MATH-1166:
-------------------------
    Attachment: MATH-1166.patch

I finally tracked down the bug, thanks to web page that showed a code excerpt from the well-known
"reference-that-cannot-be-named".

There were actually two bugs:
* one was indeed a transposition of the coefficient matrix,
* the other was that the implementation on Wikipedia was assuming a _one_-pixel "delta" between
samples.

In the attached patch, I've created new classes:
* {{BicubicInterpolatingFunction}}
* {{BicubicInterpolator}}

The reason is that the fix entailed the failure of the tests in
{{BicubicInterpolatingFunctionTest}} related to the methods providing the partial derivatives
functionality. A solution could have been to remove those but it cannot be done because of
backward compatibility.

The {{TricubicSplineInterpolator}} must be deprecated since it is based on the buggy code,
and the implementation requires the partial derivatives...

A problem remained in that the {{BicubicInterpolator}} needs to estimate the derivatives in
order to use the {{BicubicInterpolatingFunction}}. This entails that, on the border of the
sampling range, the interpolation is wrong.  As a workaround, the method "isValidPoint" is
overridden, and for the "valid" points, the interpolation is within a reasonable tolerance.

This is a weak point of the {{BicubicInterpolator}}, but in some cases (as in the picture
produced by Ajo's code), there could be less artefacts.

Is it OK to commit this patch?
Or do we proceed otherwise?


> BicubicInterpolation may have a bug
> -----------------------------------
>
>                 Key: MATH-1166
>                 URL: https://issues.apache.org/jira/browse/MATH-1166
>             Project: Commons Math
>          Issue Type: Bug
>            Reporter: Ajo Fod
>         Attachments: Draw.java, MATH-1166.patch, myimage.jpg
>
>
> I plotted a random image with bicubic interpolation hoping to see something like this:
> http://en.wikipedia.org/wiki/Bicubic_interpolation
> ... but instead I got something weird.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message