2021-01-28

python multiprocessing with raspberry pi

I am trying to capture a raspberry pi camera image with a multiprocessing module The motion is stopped at the part being captured No error code and just the following code doesn't work. If you know the cause, I would appreciate it.

camera = picamera.PiCamera()

def camera1():
    print("1")
    rawCapture = picamera.array.PiRGBArray(camera)
    print("2")
    rawCapture = PiRGBArray(camera, size=(1920, 1080))
    print("3")
    camera.capture(rawCapture, format="bgr")
    print("4")
    image = rawCapture.array
    print("5")
    return image

if __name__ == "__main__":
    GPIO.add_event_detect(Sensor1, GPIO.RISING, bouncetime=800)
    GPIO.add_event_detect(Sensor2, GPIO.FALLING, bouncetime=1000)
    queue = Manager().Queue()

    while True:
        if GPIO.event_detected(Sensor1):
            process1 = Process(target = camera1, args(queue,)
            process.start()
            process.join()

It prints until print("3") and does not proceed to the next operation.



from Recent Questions - Stack Overflow https://ift.tt/36j4cUJ
https://ift.tt/eA8V8J

No comments:

Post a Comment