elerac / EasyPySpin

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

MultiVideoCapture with USB Hub #16

Closed brian1000 closed 11 months ago

brian1000 commented 11 months ago

Hello! I really appreciate the work you've done to simplify the PySpin wrapper.

I have a setup with two FLIR BFS cameras that are connected to a USB hub (they're also both secondary cams with a TTL pulse generator attached). The SynchronizedVideoCapture (SVC) ) class worked wonderfully for them, but I have a slight issue with the MultipleVideoCapture (MVC) class.

I noticed that when I try to initialize the cams using MVC, they won't open. This is because I connected my cams to an external USB hub I bought on amazon. If I plug the cameras directly to my laptop, the MVC class correctly initializes the cameras.

The reason why I want to use MVC is to have a quick cam feed before running the real experiment ~ this way I can make sure the cams are in focus. If you have any ideas for how to make MVC work with a USB hub, I think others will appreciate it too!

I'm using Windows 10, python=3.9 This is what I tried running: (only works when USB's plug directly into my laptop)

import EasyPySpin
import cv2

cap = EasyPySpin.MultipleVideoCapture(0, 1)
cap.isOpened()

This is the other way I tried: (which works with USB hub)

import EasyPySpin
import cv2

serial_number_1 = "23473323" # pupil
serial_number_2 = "21126272" # face

cap = EasyPySpin.SynchronizedVideoCapture(None, serial_number_1, serial_number_2)
cap.isOpened()

Using serial numbers for MVC didn't work.

brian1000 commented 11 months ago

Nvm, it was a connection issue with the USB hub. It works now.