Usage description:
We use two cameras with synchronized exposure as stereo camera, as shown in the figure below.
We need:
- Acquiring frames simultaneously, with strict time synchronization.
- Acquiring frames as quick as possible, with minimum delay.
Problems
We have tried 2 different method, but both encoutered problems…
-
Method 1: Acquire left and right camera using different threads.
-
There’s 2-4ms delay between left and right frames acquired, which will affect the total acquiring delay.
-
After each frame been acquired, there’re 4700+ thread switching.
-
More threads are created by IFrameConsumer::AcquireFrame().
- For 2-thread acquiring, 13 threads are created.
nvidia@localhost:~$ ps -e -T |grep mtcam0 7867 7921 ? 00:04:43 mtcam0 7867 8100 ? 00:00:00 mtcam0 7867 8164 ? 00:00:00 mtcam0 7867 8200 ? 00:00:05 mtcam0 7867 8228 ? 00:00:00 mtcam0 7867 8470 ? 00:01:46 mtcam0 7867 8471 ? 00:01:42 mtcam0 7867 8472 ? 00:01:41 mtcam0 7867 8473 ? 00:01:41 mtcam0 7867 8474 ? 00:01:42 mtcam0 7867 8480 ? 00:00:00 mtcam0 nvidia@localhost:~$ ps -e -T |grep mtcam1 7867 8318 ? 00:00:48 mtcam1 7867 8334 ? 00:00:03 mtcam1 7867 8362 ? 00:00:00 mtcam1 7867 8521 ? 00:00:00 mtcam1
- For single thread acquiring, only 7 threads are created.
ps -e -T |grep mtcam 7788 7830 ? 00:11:48 mtcam 7788 7972 ? 00:00:00 mtcam 7788 7987 ? 00:00:00 mtcam 7788 8008 ? 00:00:27 mtcam 7788 8060 ? 00:00:02 mtcam 7788 8066 ? 00:00:01 mtcam 7788 9103 ? 00:00:06 mtcam 7788 9105 ? 00:00:00 mtcam
- For 2-thread acquiring, 13 threads are created.
-
-
Method 2: Acquire 2 cameras in single thread.
We can’t find suitable API to ensure synchronization of acquired images.
For example, if left camera has 1 frame and right camera has 2 frames(When left camera dropped 1 frame).