I have an application where I need to take a picture at a very specific moment when another program gives the command. As the camera needs to be very light, I bought the see3cam_CU135 from e-con systems. I was planning on running the camera with python and having python wait for the command from the other program. The delay between triggering and the actual exposure is essential to know and so far, I haven't been very successful in finding out what it is. Here's my setup to figure out the delay:
I run a separate script that acts as stopwatch, printing the clock of my system to my screen:
Then I run my actual script that takes the picture of the output of the first script.
vc = cv2.VideoCapture(1)
if vc.isOpened(): # try to get the first frame
while int(time.time()) == int(t1):
rval, frame = vc.read()
rval = False
If I start the script at a time of, let's say 1512638235.3549826, the program should stay in the while loop until the next full second starts, 1512638236, and then trigger the picture, right? So the time on the picture minus the full second after t1 should give me the delay.
So far so good, but here's what's weird: yesterday I ran it, and t1 was 1512579170.079795. So the script should wait almost a second, then trigger the picture. However, the picture of the stopwatch showed 1512579170.588795 (half a second before the trigger command would have been sent). Is it possible that vc.read does not actually trigger a frame, but just reads whatever frame is currently in the buffer of the camera and, therefore, returned an older frame? If so, how can I trigger a frame manually exactly when I want it?
A second question I have here is the white balance issue with OpenCV. Apparently it is not possible (yet?) to manually control white balance. I don't really care, as long as it is reproducible. How can I guarantee that auto white balance is off? I need all my pictures to be taken with exactly the same settings, as I need to be able to compare the absolute intensity in different light conditions. I can't have some auto exposure or auto white balance change the settings all the time.
Oh, one more comment: I'm not married to python or to openCV, I'm open to do it completely differently. However, the other program that will ultimately send a command to my script to take a picture has to run under windows.
I'd be really thankful for some suggestions!