0

Using the PiCamera Advanced Recipies in the link I am trying to capture the image to a numpy array. My code basic lines of code are.

final_image = np.empty((height , width , 3), dtype=np.uint8)
bright_imag_calc = cv2.cvtColor(final_image, cv2.COLOR_BGR2RGB)
bright_imag_calc1 = Image.fromarray(bright_imag_calc)

But I am getting the following error:

/home/pi/tflite1/tflite1-env/lib/python3.7/site-packages/picamera/encoders.py:544: PiCameraResolutionRounded: frame size rounded up from 300x300 to 320x304
  width, height, fwidth, fheight)))
Traceback (most recent call last):
  File "del_now.py", line 199, in <module>
    camera.capture(final_image, "bgr")
  File "/home/pi/tflite1/tflite1-env/lib/python3.7/site-packages/picamera/camera.py", line 1421, in capture
    if not encoder.wait(self.CAPTURE_TIMEOUT):
  File "/home/pi/tflite1/tflite1-env/lib/python3.7/site-packages/picamera/encoders.py", line 398, in wait
    raise self.exception
  File "/home/pi/tflite1/tflite1-env/lib/python3.7/site-packages/picamera/encoders.py", line 267, in _callback
    stop = self._callback_write(buf)
  File "/home/pi/tflite1/tflite1-env/lib/python3.7/site-packages/picamera/encoders.py", line 1019, in _callback_write
    super(PiOneImageEncoder, self)._callback_write(buf, key)
  File "/home/pi/tflite1/tflite1-env/lib/python3.7/site-packages/picamera/encoders.py", line 1160, in _callback_write
    super(PiRawImageMixin, self)._callback_write(buf, key)
  File "/home/pi/tflite1/tflite1-env/lib/python3.7/site-packages/picamera/encoders.py", line 580, in _callback_write
    return super(PiRawMixin, self)._callback_write(buf, key)
  File "/home/pi/tflite1/tflite1-env/lib/python3.7/site-packages/picamera/encoders.py", line 309, in _callback_write
    "output %r" % (buf.length, output))
picamera.exc.PiCameraIOError: Failed to write 291840 bytes from buffer to output <picamera.streams.BufferIO object at 0x62f70c60>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.