Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
115 views
in Technique[技术] by (71.8m points)

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.

import cv2 
import cv2 as cv
import numpy as np
import io
from PIL import Image
import time
import picamera
import picamera.array
import RPi.GPIO as GPIO
from picamera.array import PiRGBArray
from datetime import datetime
import math
from multiprocessing import Process, Queue, Manager

camera = picamera.PiCamera()
camera.resolution = (1280, 720)
camera.framerate = 15
camera.iso = 300

def camera1(queue):
    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()
    process1 = Process(target = camera1, args(queue,)

    while True:
        if GPIO.event_detected(Sensor1):
            process1.start()
            process1.join()

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

question from:https://stackoverflow.com/questions/65929656/python-multiprocessing-with-raspberry-pi

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...