Synchronization of a projector and a camera
I am developing an application where images consecutively projected with a video projector are captured with a camera. Freeglut is used for displaying the images. I am not able to synchronize image refreshing and camera triggering properly. No matter what I tried, the cameras always trigger while the glut window is being refreshed, the refresh artifacts are visible in the shot image. I already tried the following:
- synchronous application: I use the keyboard loop to start the acquisition. Instead of calling glutPostRedisplay, the glutDisplayFunc is called manually before triggering the camera
- asynchronous application: I use glutPostRedisplay to redraw the contents of the glut window and trigger the camera in the glutIdleFunc
Since there is only 1 thread involved, the second method is not really asynchronous, but I guess you get what I mean.
For both methods I tried:
- The use of double buffering with glutSwapBuffers() at the end of my glutDisplayFunc
- The use of single buffering with glFinish() at the end of my glutDisplayFunc, which I thought should block until the screen refreshed
None of the above worked. Any comments or ideas how to solve this?