Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3486

Camera board • How to keep two pi camera working continuously

$
0
0
I am working on one project where I have to detect playing cards backside and frontside of cards which will be used raspberry pi5 and 2 pi cameras ,one camera for backside and second one to detect frontside ,so I need to used the logic that my both cameras would be continuously working parellel,How can i do that,recent I m using the logic to capture frame given below,
picam2 = Picamera2(0)


# Create a preview configuration with a specific size
config_0 = picam2.create_preview_configuration(main={"size": (590, 864)})
picam2.configure(config_0)

# Set autofocus mode to manual and lens position to 0.0
picam2.set_controls({"AfMode": controls.AfModeEnum.Manual, "LensPosition": 14})

# Start the camera
picam2.start()

# Wait for a specified duration (in seconds)
time.sleep(1) # Adjust the sleep duration according to your needs


# Capture a still image if needed
#picam2.capture_file("output_image.jpg")
timestamp = time.strftime("%Y%m%d%H%M%S")
image_filename = f"image_{timestamp}.jpg"
picam2.capture_file(image_filename)

picam2.stop()
picam2.close()
#picam2.stop_preview()
time.sleep(1)
return image_filename

Statistics: Posted by spatil — Tue Feb 06, 2024 11:24 am — Replies 0 — Views 36



Viewing all articles
Browse latest Browse all 3486

Trending Articles