Take the 2-minute tour ×
Video Production Stack Exchange is a question and answer site for engineers, producers, editors, and enthusiasts spanning the fields of video, and media creation. It's 100% free, no registration required.

I am trying to capture stereo video with 2 Microsoft LifeCam Studio USB webcams. Thus far, the best approach I've managed to come up with is my own tool written using OpenCV to capture video streams from the cameras in Ubuntu 14.04. I am using very simple VideoCapture code (source here) and am trying to at least view two videos that are synchronized against each other.

I used Android stopwatch apps (UltraChron Stopwatch Lite and Stopwatch Timer) on my Samsung Galaxy S3 mini to realize that my viewed images are out of sync (show different time on stopwatch).

The frames are synced maybe in 50% of the time. The frame time differences I get are from 0 to about 300ms with an average about 120ms. It seems that the amount of timeout used has very little effect on sync (same for 1000ms or 2000ms). I run in FullHD but lowering resolution to 640x480 had no effect.

I am trying to record stereo video with a low cost setup. An ideal result would be a 100% synchronized stereo video stream that has about 10 FPS. Are there any alternative approaches that would result in better synchronization?

EDIT: In my search for low-cost hardware I fount that it is probably possible to do some commodity hardware hacking (link here) and inject a single clock signal into multiple camera modules simultaneously to get the desired sync. The guy who did that seems to have developed his GENLOCKed camera board (called NerdCam1) and even a synced stereo camera board that he now sells for about €200.

However, I have almost zero ability of hardware hacking. Also I am not sure if such clock injection is possible for resolutions above NTSC/PAL standard (as it seems to be an "analog" solution?). Also, I would prefer a variable baseline option where both cameras would not be soldered on a single board.

Also found this related post: Cheap solution for shooting with multiple (>2) cameras in sync (genlock or LANC?)

share|improve this question
    
I tried to minimize the waitKey timeout (using 1ms for the loop to work) and check every 100th loop iteration to save the still pair. I still get sometimes about as many as 12ms delay from the first camera to the second... I guess I need a better stopwatch since these are often not readable in the frames while redrawing numbers (or my shutter times are too long). –  Kozuch Aug 4 at 13:18
    
There was a bit of discussion about this question between the mods and we agreed to keep it closed though essentially the question isn´t really off-topic but your focus is very heavily on computer vision. Asking about how to do snyc'ed stereo video is totally on-topic here, you just have to make the question a bit more general. If you edit the question to reflect that I gladly re-open it. Otherwise if you definitely need a programmatic approach with webcams the question might be better suited for SO. –  Professor Sparkles Aug 6 at 12:54
    
I reworded the question to omit the CV topic. I would be happy for this to re-open. Please feel free to edit the question to get a desired video-topic. –  Kozuch Aug 6 at 14:06
    
I removed some of the code heavy parts, added a bottom line to the question, opened the question up for different camera solutions than webcams and re-opened. The fact that you were focusing on webcams, coding in OpenCV and live viewing of your cameras made it quite unusable for anything else video production related but computer vision (which is not on-topic here but on SO) Does that still reflect your question? –  Professor Sparkles Aug 6 at 15:46
    
Thanks for an edit. Yes I only need to record synced stereo video, that is the main goal. –  Kozuch Aug 6 at 15:48

1 Answer 1

You probably will not achieve a 100% perfect result with your setup. That you got them synced to a 1FPS accuracy is pretty amazing actually.

Professional stereo setups use frame locking in hardware to ensure the cameras record in perfect sync. This is not possible with ordinary webcams. If you fix the recorded video in post you can get to less than 1/RecordingFPS'th of a second accuracy which can be enough depending on your framerate. The higher your framerate the smaller the offset will be.

If the webcams offer some sort of low level api you might be able to improve the results even further but I doubt thats available, thats usually something you only get in (rather expensive) industrial cameras.

Edit: Regarding your edit, Genlocking is the way to go with pretty much any video application if you need 100% sync (or as close as possible to that, you will always have some nano/microsecond delay between frames).

Being it syncing videos displayed on a display wall (all these individual displays need to show the correct portion of the frame at the same time). Or recording with multiple cameras the same frame at the same time. Resolution isn't a factor here.

Though price definitely is. Do you have a budget for this project or is this for hobby purposes? There are definitely (non-cinema) cameras that would support this though they are not exactly cheap as a webcam. The cheapest solution I can think of is using the GoPro Stereo Rig. http://gopro.com/camera-accessories/dual-hero-system This would put you at a budget of 1000$ in total (minus a few cents). Not exactly cheap but definitely affordable.

And the GoPro is also a very flexible solution. You can shoot from 3840x2160@15FPS to 848x480@240FPS. It also supports raw HDMI output which can be helpful if color precision is desirable or live monitoring of your shoot.

A downside is that the GoPro has a fish-eye lens. You can reduce the distortion by setting the camera viewing mode to narrow and using this nifty software hack but you wont get fully rid of it unless you replace the lens.

Edit 2: If you go the "build your own electronics route" you should have a look at the ArduCam project. It's essentially a shield for the popular Arduino boards. It allows you to connect several cmos modules like the OV5642 which is a 5MP sensor that is also used in the Raspberry Pi camera module.

According to this thread on the RaspberryPi forum these modules support genlocking. While its not possible with the pins broken out on the PiCam module (though there are some ideas about how to do genlocking with it on the last page) you can order these modules cheap (25$) from ebay and use them with the ArduCam board. Even if you don't connect the modules to the same oscillator to do genlocking you should get some pretty good results as you work pretty close metal here also the Arduino plattform is very easy to use.

With such a setup you could potentially make a 1080p stereo 3D rig for around 125$. 50$ for the cmosm modules, ~16$ for 2 Arduino Uno clones and 60$ for 2 ArduCam shields.

share|improve this answer
    
I made an edit to my question adding some hardware hacking possibilities in case you are interested in replying. –  Kozuch Aug 6 at 16:39
    
@Kozuch: edited my answer –  Professor Sparkles Aug 6 at 20:05
    
Thanks for elaboration :). I have some budget (say $ thousands) but I am trying to develop cheap solutions for possible community project. The GoPro Stereo is very interesting because of a very commodity hardware. I guess the housing is not necessary - you only need to connect 2 HERO3+ BE with a (proprietary?) sync cable? Though something cheaper would still be nice. I probably need to get into HW hacking/development because the NerdCam1 is what I actually need (though it has not open PCB schematics probably)... But NerdCam1 seems to have very lousy resolution, I need a sharp 1 Mpix at least. –  Kozuch Aug 6 at 20:41
    
If you want to go the self made electronics route (actually not as hard as one might think) I added some usefull info. –  Professor Sparkles Aug 6 at 21:09
1  
If you have a fast moving vehicle I would really recommend a GoPro at high-frame rates. Regarding " will save video or stills in perfect sync when fed with same external clock signal and ext. triggered via GPIO" yes afaik, regarding the GPS/IMU thing, not an issue with Arduino, actually pretty easy. The shields wills save the video to the SD card, where you can also save your sensor data). Though regarding all these electronic questions I recommend go to electronics.stackexchange.com. Its exactly for these kind of questions. –  Professor Sparkles Aug 8 at 12:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.