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

Asynchronous grabbing from a 2-camera array #766

Open
fhaibach opened this issue Jul 19, 2024 · 5 comments
Open

Asynchronous grabbing from a 2-camera array #766

fhaibach opened this issue Jul 19, 2024 · 5 comments

Comments

@fhaibach
Copy link

Describe what you want to implement and what the issue & the steps to reproduce it are:

grabmultiplecameras.py is an example of synchronous grabbing of frames. I need to do asynchronous grabbing from two cameras. For example, lets label the cameras as "1" and "2", then the sequence might be
1 1 1 1 2 1 1 1 2 1 1 1 1 1
The pattern that interleaves 2 is irregular.
While I could get both images synchronously and just ignore unused images from 2, I was hoping for something cleaner and with less overhead.

Is your camera operational in Basler pylon viewer on your platform

Yes

Hardware setup & camera model(s) used

RPi 4, Raspbian/Debian OS
USB4 - direct connection via 30 cm cables

Runtime information:

>>> import sys, pypylon.pylon, platform
>>> print(f'python: {sys.version}')
python: 3.11.2 (main, May  2 2024, 11:59:08) [GCC 12.2.0]
>>> print(f'platform: {sys.platform}/{platform.machine()}/{platform.release()}')
platform: linux/aarch64/6.6.31+rpt-rpi-v8
>>> print(f'pypylon: {pypylon.pylon.__version__} / {".".join([str(i) for i in pypylon.pylon.GetPylonVersion()])}')
pypylon: 4.0.0 / 8.0.0.10
@thiesmoeller
Copy link
Collaborator

Are the cameras HW triggered ?

@fhaibach
Copy link
Author

fhaibach commented Jul 22, 2024 via email

@SMA2016a
Copy link
Collaborator

are you using same camera model? and the resulting frame rate of both camera is same?

may be the camera 2 running slower or it is losing images.

@HighImp
Copy link
Contributor

HighImp commented Aug 3, 2024

Hi, you want the irregular pattern, but you dont know how to trigger the second camera irregular, did i get that correct? Can you tell the fps and when do you know if the second camera should take an Image? Is the irregular pattern known from the beginning or do you react to something during the process?

@HighImp
Copy link
Contributor

HighImp commented Aug 3, 2024

Also, you don't necessarily have to use the InstantCameraArray.

You can also create two instances of InstantCameras and call camera.RetrieveResult for each camera individually.
If you use the Grab method: LatestImageOnly, pylon will automatically discard any uncaptured images.

The cameras will continue to grab images in freerun. So if you want to avoid traffic to your host, a software trigger solution might be the best, but then you need to know the pattern in advance.

One additional thing, because you say "grabmultiplecameras.py is an example of synchronous grabbing":
The fact that both cameras start recording at the same time does not mean that they are necessarily synchronised.
Over time, they will definitely be out of sync.
To achieve a stable synchronised exposure, you need to use a trigger.
I understand that you want asynchronous images, but I want to be sure that you don't expect the exposure of the two cameras to occur simultaneously when an image is taken from both cameras.

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

4 participants