|
|
|
@ -27,7 +27,7 @@ def weighted_average(p1, w1, p2, w2):
|
|
|
|
|
return coef * too_big
|
|
|
|
|
|
|
|
|
|
class Picture:
|
|
|
|
|
def __init__(self, data);
|
|
|
|
|
def __init__(self, data):
|
|
|
|
|
self.pixels = data
|
|
|
|
|
self.w = len(data[0])
|
|
|
|
|
self.h = len(data)
|
|
|
|
@ -43,18 +43,18 @@ class Picture:
|
|
|
|
|
for x in range(wt):
|
|
|
|
|
line = []
|
|
|
|
|
for y in range(ht):
|
|
|
|
|
line.append(Pixel(*(access[x, y][:3]))
|
|
|
|
|
line.append(Pixel(*(access[x, y][:3])))
|
|
|
|
|
data.append(line)
|
|
|
|
|
|
|
|
|
|
result = cls(data)
|
|
|
|
|
assert result.w = wt
|
|
|
|
|
assert result.h = ht
|
|
|
|
|
assert result.w == wt
|
|
|
|
|
assert result.h == ht
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def show(self): ...
|
|
|
|
|
|
|
|
|
|
class Interpolator
|
|
|
|
|
class Interpolator:
|
|
|
|
|
def interpolate(self, picture, new_h, new_w):
|
|
|
|
|
quantum_x = new_w / picture.w
|
|
|
|
|
quantum_y = new_h / picture.h
|
|
|
|
|