Linear
parent
b4274ec6e3
commit
79f0281dc1
@ -0,0 +1,23 @@
|
||||
import lib
|
||||
import math
|
||||
|
||||
class BiLinear(lib.Interpolator):
|
||||
def get_pixel(self, pic, x, y, r, qx, qy):
|
||||
leftx = math.floor(x)
|
||||
rightx = math.ceil(x)
|
||||
topy = math.floor(y)
|
||||
bottomy = math.ceil(y)
|
||||
|
||||
left = pic.at(leftx, topy)
|
||||
right = pic.at(leftx, topy)
|
||||
dist = x % 1
|
||||
top = (left * (1 - dist) + right * dist)
|
||||
|
||||
left = pic.at(leftx, bottomy)
|
||||
right = pic.at(leftx, bottomy)
|
||||
bottom = (left * (1 - dist) + right * dist)
|
||||
|
||||
dist = y % 1
|
||||
pix = (top * (1 - dist) + bottom * dist)
|
||||
|
||||
return pix
|
Binary file not shown.
After Width: | Height: | Size: 83 KiB |
Loading…
Reference in New Issue