|
|
@ -78,12 +78,12 @@ class Picture:
|
|
|
|
|
|
|
|
|
|
|
|
class Interpolator:
|
|
|
|
class Interpolator:
|
|
|
|
def interpolate(self, picture, new_h, new_w):
|
|
|
|
def interpolate(self, picture, new_h, new_w):
|
|
|
|
quantum_x = new_w / picture.w
|
|
|
|
quantum_x = picture.w / new_w
|
|
|
|
quantum_y = new_h / picture.h
|
|
|
|
quantum_y = picture.h / new_h
|
|
|
|
result = [[None for _ in range(new_w)] for _ in range(new_h)]
|
|
|
|
result = [[None for _ in range(new_w)] for _ in range(new_h)]
|
|
|
|
for x in range(new_w):
|
|
|
|
for x in range(new_w):
|
|
|
|
for y in range(new_h):
|
|
|
|
for y in range(new_h):
|
|
|
|
result[y][x] = self.get_pixel(picture, x, y, result, quantum_x, quantum_y)
|
|
|
|
result[y][x] = self.get_pixel(picture, x*quantum_x, y*quantum_y, result, quantum_x, quantum_y)
|
|
|
|
return Picture(result)
|
|
|
|
return Picture(result)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|