I wrote an algorithm to do bicubic interpolation of an image. I used the method desribed in the wikipedia page. On simple images, the result looks good, but on more complex ones, I got strange artifacts in non-smooth zones.
What could be a probable source of those artifacts, and what can I try to get rid of them ?
My code is on github, but I checked it several times, so I don't think the problem comes from it but rather from the simple implementation suggested in wikipedia
I'm using this particular equation (3rd-order Hermite polynomial interpolation) to do the interpolation (in one dimension):
$$x(n+t)=\frac{1}{2} \begin{bmatrix} 1 & t & t^2 & t^3 \\ \end{bmatrix} \begin{bmatrix} 0 & 2 & 0 & 0 \\ -1 & 0 & 1 & 0 \\ 2 & -5 & 4 & -1 \\ -1 & 3 & -3 & 1 \\ \end{bmatrix} \begin{bmatrix} x[n-1] \\ x[n] \\ x[n+1] \\ x[n+2] \\ \end{bmatrix}$$
where $x[n-1]$, ... $x[n+2]$, .. are the values of the surrounding pixels (in one dimension), and $t$ is the fractional coordinate (where $0 \le t < 1$) of the interpolated pixel between the adjacent pixels $x[n]$, $x[n+1]$. $n$ is an integer and $x(n)=x[n]$ for any integer $n$.
The expected output:
My result, look closely at the bird head,a lot of white pixels have appeared.
---EDIT--- To show that my code does produce coherent results, here is the example of my scaling up on simple image with 16 red pixels.
And here is the ouput of the library (which also use 3rd-order Hermite polynomial interpolation):
And here is my results:
In this case the difference are IMO totally acceptable, but it shows that my interpolation does something legit.