From bf4ab225f223a6b67c1b726bb99c3cc935a6790c Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Mon, 4 Apr 2022 00:17:07 +0200 Subject: [PATCH] Nearest neighbour interpolation --- nn.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 nn.py diff --git a/nn.py b/nn.py new file mode 100644 index 0000000..0d34624 --- /dev/null +++ b/nn.py @@ -0,0 +1,9 @@ +import lib + +class Nearest(lib.Interpolator): + def get_pixel(self, pic, x, y, r, qx, qy): + rx = round(x) + ry = round(y) + pix = pic.pixels[y][x] + return pix +