picamera2 icon indicating copy to clipboard operation
picamera2 copied to clipboard

[HOW-TO] Multiple cameras using CM4 & Picamera2

Open neil-benn opened this issue 2 years ago • 3 comments

Hello,

I'm running a CM4 with libcamera; the libcamera apps can capture from both cameras using the command line apps. I'm now trying to capture from both cameras using picamera2 but I can't see how to specify which camera to connect to. Is this available in picamera2?

I could look at using v4l2 or picking through the code from the RPi libcamera-apps to adapt into a python library but that would take much longer to handle and be duplicating efforts made here.

Thanks.

Regards,

Neil

neil-benn avatar Aug 11 '22 16:08 neil-benn

Hi, the Picamera2 constructor takes a camera_num argument, defaulting to zero, which should in theory specify which camera to use.

The catch is that I haven't ever got round to trying this on a CM4. With luck and a following wind, it might work like libcamera-apps do, i.e. you can start separate Python interpreters and attach each to a different camera (there is no real handling of dual cameras within libcamera itself). Though the usual rule applies that all software is broken until you've tested it. I'd be interested to hear what happens...

davidplowman avatar Aug 12 '22 08:08 davidplowman

Hello,

Great news - I'm on the case and I'll see what happens!

Cheers,

Neil

--

Neil Benn MSc Ziath Ltd Phone: +44 (0) 1223 855021 http://www.ziath.comhttp://www.ziath.com/

Please consider the environment before printing this email.

Follow us on Facebookhttp://www.facebook.com/ziathltd, Twitterhttp://www.twitter.com/ziath_ltd or LinkedInhttp://www.linkedin.com/company/ziath-ltd

IMPORTANT NOTICE: This message, including any documents, is intended only for the use of the individual or entity to which it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify Ziath Ltd immediately by email at @.@.>. Thank you.


From: davidplowman @.> Sent: 12 August 2022 09:55 To: raspberrypi/picamera2 @.> Cc: Neil Benn @.>; Author @.> Subject: Re: [raspberrypi/picamera2] [HOW-TO] Multiple cameras using CM4 & Picamera2 (Issue #258)

Hi, the Picamera2 constructor takes a camera_num argument, defaulting to zero, which should in theory specify which camera to use.

The catch is that I haven't ever got round to trying this on a CM4. With luck and a following wind, it might work like libcamera-apps do, i.e. you can start separate Python interpreters and attach each to a different camera (there is no real handling of dual cameras within libcamera itself). Though the usual rule applies that all software is broken until you've tested it. I'd be interested to hear what happens...

— Reply to this email directly, view it on GitHubhttps://github.com/raspberrypi/picamera2/issues/258#issuecomment-1212885005, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADY2NXXPNAR5VLUZBT7W5IDVYYGQDANCNFSM56IXWAHQ. You are receiving this because you authored the thread.Message ID: @.***>

neil-benn avatar Aug 12 '22 09:08 neil-benn

Hello,

I tested this today and accessing one camera in one process worked just fine using picamera2 on cam 0 and cam 1. I used a still config, started the camera and took 20 or 30 images without a problem.

Thanks

Cheers,

Neil

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Neil Benn @.> Sent: Friday, August 12, 2022 10:23:12 AM To: raspberrypi/picamera2 @.>; raspberrypi/picamera2 @.> Cc: Author @.> Subject: Re: [raspberrypi/picamera2] [HOW-TO] Multiple cameras using CM4 & Picamera2 (Issue #258)

Hello,

Great news - I'm on the case and I'll see what happens!

Cheers,

Neil

--

Neil Benn MSc Ziath Ltd Phone: +44 (0) 1223 855021 http://www.ziath.comhttp://www.ziath.com/

Please consider the environment before printing this email.

Follow us on Facebookhttp://www.facebook.com/ziathltd, Twitterhttp://www.twitter.com/ziath_ltd or LinkedInhttp://www.linkedin.com/company/ziath-ltd

IMPORTANT NOTICE: This message, including any documents, is intended only for the use of the individual or entity to which it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify Ziath Ltd immediately by email at @.@.>. Thank you.


From: davidplowman @.> Sent: 12 August 2022 09:55 To: raspberrypi/picamera2 @.> Cc: Neil Benn @.>; Author @.> Subject: Re: [raspberrypi/picamera2] [HOW-TO] Multiple cameras using CM4 & Picamera2 (Issue #258)

Hi, the Picamera2 constructor takes a camera_num argument, defaulting to zero, which should in theory specify which camera to use.

The catch is that I haven't ever got round to trying this on a CM4. With luck and a following wind, it might work like libcamera-apps do, i.e. you can start separate Python interpreters and attach each to a different camera (there is no real handling of dual cameras within libcamera itself). Though the usual rule applies that all software is broken until you've tested it. I'd be interested to hear what happens...

— Reply to this email directly, view it on GitHubhttps://github.com/raspberrypi/picamera2/issues/258#issuecomment-1212885005, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADY2NXXPNAR5VLUZBT7W5IDVYYGQDANCNFSM56IXWAHQ. You are receiving this because you authored the thread.Message ID: @.***>

neil-benn avatar Aug 12 '22 22:08 neil-benn

this should probably be closed. camera interface works just fine on CM4 with multiple processes even

CorvetteCole avatar Aug 31 '22 14:08 CorvetteCole

Thanks!

davidplowman avatar Aug 31 '22 15:08 davidplowman