How to save Image from a externally triggered camera

asked 2018-01-18 18:22:24 -0500

I am trying to save an image from a camera that has a trigger pin. We wish to use this to sync 2 or more cameras together being saved on 2 separate computers eventually scaling it up to 6+ camera & computer setups (to avoid USB bottlenecks).

We can use programs like QTCam to wait for the image to arrive and save it, but this program is large and is semi-buggy and we don't really have any way of remotely controlling the software and with multiple slave computers this isn't practical. What we are looking for is something like VideoCapture.retrieve() where the description is that is retrieves the next grabbed frame. Since the VideoCapture.grab() function essentially requests a frame taken.

When we call VideoCapture.retrieve() it does indeed get the frame from the last time VideoCapture.grab() was called, but if we call VideoCapture.retrieve() multiple times to see if it would pick up the triggered frames, it seems to instead call grab() again if it doesn't detect a frame in the buffer. (we tested this using a slow 1 second pulse on the camera trigger and instead of waiting, it updates as fast as it can)

If this isn't possible, does anyone have any suggestions?

edit retag flag offensive close merge delete

Comments

VideoCapture does not know about your trigger pin at all.

berak gravatar imageberak ( 2018-01-19 06:39:31 -0500 )edit

Thanks for the reply. I assumed that was the case, but I was wondering if there was a function to setup to test IF a frame was in the camera.

Last night I found a post back in 2010 of someone trying to do the same thing, but as of yet I haven't tested anything.
http://www.theimagingsourceforums.com...

I am looking into it, but if anyone knows of any options that for-sure works here, that would be great.

LHendricks gravatar imageLHendricks ( 2018-01-19 11:08:11 -0500 )edit

it's somewhat complicated, and also heavily depending on the actual backend you use ( i count like a good dozen, and they all behave slightly different, so not portable between machines, running different os'es !)

e.g. the v4l wrapper has an internal (also threaded) fifo queue of 5 (?) frames, that gets emptied with any call to read() or such.

so, most probably, there's always a valid frame, it might be outdated though ;(

again, opencv is a computer-vision library, not a "video" one. don't mistake it.

berak gravatar imageberak ( 2018-01-19 11:17:37 -0500 )edit