Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue video streaming with 4-camera adapter board v2 #468

Open
mkeyno opened this issue Dec 24, 2019 · 1 comment
Open

Issue video streaming with 4-camera adapter board v2 #468

mkeyno opened this issue Dec 24, 2019 · 1 comment

Comments

@mkeyno
Copy link

mkeyno commented Dec 24, 2019

Hi
I've been trying to use video streaming with 2 camera(A,C) in opencv project, but the camera stop working after a couple of second
following is my code and error
any help really appreciated
#code

 import RPi.GPIO as gp
# initialize the camera and grab a reference to the raw camera capture
gp.setwarnings(False)
gp.setmode(gp.BOARD)
gp.setup(7, gp.OUT)
gp.setup(11, gp.OUT)
gp.setup(12, gp.OUT)
gp.output(7, False)
gp.output(11, False);gp.output(12, True)
#########################################
#########################################




from picamera.array import PiRGBArray
from picamera import PiCamera
import cv2
import time

camera = PiCamera()
camera.resolution = (320, 240)
camera.framerate = 30
rawCapture = PiRGBArray(camera, size=(320, 240))
display_window = cv2.namedWindow("Faces")
time.sleep(1)
i=0
for frame in camera.capture_continuous(rawCapture, format="bgr", use_video_port=True):

    image = frame.array
    #DISPLAY TO WINDOW
    cv2.imshow("Faces", image)
    print("image num=",i);i+=1
    key = cv2.waitKey(1)
    rawCapture.truncate(0)
    time.sleep(1)
    if key == 27:
        camera.close()
        cv2.destroyAllWindows()
        break

#error

image num= 89
image num= 90
image num= 91
image num= 92
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/picamera/camera.py", line 1704, in capture_continuous
    'Timed out waiting for capture to end')
picamera.exc.PiCameraRuntimeError: Timed out waiting for capture to end

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/Public/camera test.py", line 29, in <module>
    for frame in camera.capture_continuous(rawCapture, format="bgr", use_video_port=True):
  File "/usr/lib/python3/dist-packages/picamera/camera.py", line 1710, in capture_continuous
    encoder.close()
  File "/usr/lib/python3/dist-packages/picamera/encoders.py", line 431, in close
    self.stop()
  File "/usr/lib/python3/dist-packages/picamera/encoders.py", line 419, in stop
    self._close_output()
  File "/usr/lib/python3/dist-packages/picamera/encoders.py", line 349, in _close_output
    mo.close_stream(output, opened)
  File "/usr/lib/python3/dist-packages/picamera/mmalobj.py", line 371, in close_stream
    stream.flush()
  File "/usr/lib/python3/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/python3/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 320x240 
@mkeyno
Copy link
Author

mkeyno commented Dec 30, 2019

@ArducamTeam can I have you're advice about this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant