elerac / EasyPySpin

cv2.VideoCapture like wrapper for FLIR Spinnaker SDK
MIT License
97 stars 19 forks source link

How to get hardware synchronized images from two cameras #3

Closed sumeromer closed 4 years ago

sumeromer commented 4 years ago

Thanks for the great tool! I have two BFS cameras and I use PySpin (based on "AcquisitionMultipleCamera.py"). How can I use your wrapper to get precisely synced images from two cameras? If I can figure it out, EasyPySpin seems really easy and I will switch using it in my projects.

elerac commented 4 years ago

Hi @sumeromer !

I just added an example program that uses two cameras. This program should behave similarly to "AcquisitionMultipleCamera.py". In my environment (two BFS-U3-23S3Ms), the delay between the two cameras was approximately 10-20 ms or less.

If you want a shorter delay, I think you need to synchronize it with a hardware trigger. Sorry, but EasyPySpin doesn't support triggers at the moment. Therefore, you need to use PySpin. However, operating the synchronization function from EasyPySpin is a future prospect.

elerac commented 4 years ago

I created a class for hardware synchronization. This class may be just what you want. Try it out!

sumeromer commented 4 years ago

Thank you very much for the new script and adding multiple camera class. I tried both multiple and synchronize examples, they keep waiting in an infinite loop. I will try to have a look at what the problem is.

By the way, I have already created a cable setting and tried getting synchronized capture as described in this document: https://www.flir.com/support-center/iis/machine-vision/application-note/configuring-synchronized-capture-with-multiple-cameras I am planning to import this setting to python. Otherwise, doing it from SpinView is not convenient.

elerac commented 4 years ago

Are the GPIO and a resistor connected correctly? Are the primary and secondary of the camera reversed? (In that case, reverse the camera index in lines 7-8 of the synchronize example.) I don't know the details of your situation, but I hope you will go well.