Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image interpolation (bicubic or bilinear). What if there are no neighbor pixels?

Since there's no native implementation of interpolation in JavaScript (beside nearest-neighbor), I'm trying to make my own method. But considering that bicubic (or bilinear) interpolation requires neighbor pixels (16 or 4), what should I do with edge pixels that doesn't have needed amount of neighbors? Should I just ignore them? But the interpolation formula requires all pixels.

like image 502
serg66 Avatar asked Dec 04 '22 02:12

serg66


2 Answers

repeat the nearest pixel.

DON'T use white or black, as that will introduce a lighter or darker shade, respectively, right on the edge.

like image 157
andrew cooke Avatar answered Dec 05 '22 15:12

andrew cooke


It is extrapolation if there are no neighbours in one side. If you want an extrapolation: http://en.wikipedia.org/wiki/Extrapolation

It is done by Lagrange's interpolation: http://en.wikipedia.org/wiki/Lagrange_interpolation

like image 45
huseyin tugrul buyukisik Avatar answered Dec 05 '22 14:12

huseyin tugrul buyukisik