Close

Around 20 fps

A project log for PolaPi-Zero

Yet another Polaroid-like camera. Now with flavor! RapsberryPi Zero, Python, Memory-LCD, less wiring. It's all about monochrome.

muthMuth 02/13/2017 at 17:010 Comments

I figure out how to reach a better frame-rate on the LCD screen. On possibility I didn't tested is to grab the video frames frome the picamera library. I had doubt the RPi zero can transform fast enough the image but it's doing well at 20 fps. There some drops, but very acceptable, and the CPU is at about 40% and 0.7 Load av'.

The code start video recoding :

    liveview = LiveView()
    camera.start_recording(liveview, format='yuv', resize=SCREEN_SIZE)
and the class LiveView must implements write(self, string) :
class LiveView(object):
    def __init__(self):
        pass

    def write(self, s):
        global lcd
        image = Image.frombuffer('L', (416, 240), s, "raw", 'L', 0, 1)
        image = image.crop((8, 0, SCREEN_WIDTH+8, SCREEN_HEIGHT))
        image = ImageOps.invert(image)
        image = image.convert('1')
        lcd.write(image.tobytes())

    def flush(self):
        print('Stop LiveView') 

The thing about the 416 pixel width instead of the 400 of our screen (and the needed crop) is due to the fact that the camera return a modulo 32 pixels dimension video frames.

Sees v0.6 on github.

Discussions