Unicorn HAT HD - raspicam.py not working


#1

It looks like the example script raspicam.py is supposed to display what the camera detects on the Unicorn HAT HD. The only thing is that I can’t get it working. I ran a test on the camera and it seems to be working fine. When I run raspicam.py (just like any other example script), it pauses at:

Unicorn HAT HD: Raspberry Pi Camera Display

Show a 16x16 feed from your Raspberry Pi camera!


/usr/lib/python2.7/dist-packages/picamera/encoders.py:521: PiCameraAlphaStripping: using alpha-stripping to convert to non-alpha format; you may find the equivalent alpha format faster
  "using alpha-stripping to convert to non-alpha "
/usr/lib/python2.7/dist-packages/picamera/encoders.py:544: PiCameraResolutionRounded: frame size rounded up from 16x16 to 32x16
  width, height, fwidth, fheight)))

while displaying nothing on the Unicorn HAT HD, and then when I keyboard interrupt, It finishes off with:

Traceback (most recent call last):
  File "raspicam.py", line 20, in <module>
    camera.capture(stream, format='rgb', resize=(16, 16))
  File "/usr/lib/python2.7/dist-packages/picamera/camera.py", line 1425, in capture
    encoder.close()
  File "/usr/lib/python2.7/dist-packages/picamera/encoders.py", line 431, in close
    self.stop()
  File "/usr/lib/python2.7/dist-packages/picamera/encoders.py", line 419, in stop
    self._close_output()
  File "/usr/lib/python2.7/dist-packages/picamera/encoders.py", line 349, in _close_output
    mo.close_stream(output, opened)
  File "/usr/lib/python2.7/dist-packages/picamera/mmalobj.py", line 371, in close_stream
    stream.flush()
  File "/usr/lib/python2.7/dist-packages/picamera/array.py", line 238, in flush
    self.array = bytes_to_rgb(self.getvalue(), self.size or self.camera.resolution)
  File "/usr/lib/python2.7/dist-packages/picamera/array.py", line 127, in bytes_to_rgb
    'Incorrect buffer length for resolution %dx%d' % (width, height))
picamera.exc.PiCameraValueError: Incorrect buffer length for resolution 16x16

Any thoughts on what I might be able to do to get this working? I’m thinking that the answer may be in here, but I’m trying to figure out how to incorporate it. Thanks!