mirror of
https://github.com/dnet/pySSTV.git
synced 2025-12-06 07:12:00 +01:00
cache pixel tuple length
This commit is contained in:
parent
f0a2076a68
commit
899ffe8e9b
|
|
@ -16,9 +16,10 @@ class GrayscaleSSTV(SSTV):
|
||||||
def encode_line(self, line):
|
def encode_line(self, line):
|
||||||
msec_pixel = self.SCAN / self.WIDTH
|
msec_pixel = self.SCAN / self.WIDTH
|
||||||
image = self.image.load()
|
image = self.image.load()
|
||||||
|
pixlen = len(image[0, line])
|
||||||
for col in xrange(self.WIDTH):
|
for col in xrange(self.WIDTH):
|
||||||
pixel = image[col, line]
|
pixel = image[col, line]
|
||||||
freq_pixel = byte_to_freq(sum(pixel) / len(pixel))
|
freq_pixel = byte_to_freq(sum(pixel) / pixlen)
|
||||||
yield freq_pixel, msec_pixel
|
yield freq_pixel, msec_pixel
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue