Home Determine the camera trigger delay of see3cam
Reply: 0

Determine the camera trigger delay of see3cam

Andreas
1#
Andreas Published in 2017-12-07 09:47:14Z

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:

import time
while True:
    print(time.time())
    time.sleep(0.001)

Then I run my actual script that takes the picture of the output of the first script.

import cv2
import time
vc = cv2.VideoCapture(1)
vc.set(cv2.CAP_PROP_FRAME_WIDTH,4208)
vc.set(cv2.CAP_PROP_FRAME_HEIGHT,3120)
vc.set(cv2.CAP_PROP_EXPOSURE,-2)

if vc.isOpened(): # try to get the first frame
    t1=time.time()
    while int(time.time()) == int(t1):
        a=0
    rval, frame = vc.read()
    print(t1)
    cv2.imwrite("photo.png", frame)
else:
    rval = False

vc.release()

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!

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.305841 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO