Camera to computer high latency

85 views Asked by At

I am connecting a Fujifilm x-t3 to my computer (usb-c to usb-c) and getting the video stream using OpenCV and C++ in Visual Studio. The issue is I am getting a latency of 116 milliseconds from the real world to the computer screen. This is too high for my real time project.

As you can see in the picture below, the x-t3 digital screen shows the exact same millisecond than the counter of a smartphone (398ms), but at this moment my computer screen is still showing the millisecond 282ms. 398-282 = 116 milliseconds of latency.

116 milliseconds from Fujifilm x-t3 to my computer screen

I tried with several cameras and 116 milliseconds is the best I got.

I tried using a Macbook Pro 2019 (2.2GHz 6-Core Intel Core i7) and also a HP Elitebook Core i5, and I am getting more or less the same results.

How could I reduce latency? Why is the screen of the Fujifilm x-t3 been able to show the image with 0 milliseconds of latency but there is too latency to my computer screen?

This is my basic code:

#include <opencv2/opencv.hpp>
#include <iostream>

using namespace std;
using namespace cv;

void main() {

    // set input video
    VideoCapture cap(2);

    Mat frame;

    for (;;) {

        // get frame from the video
        cap >> frame;

        // stop the program if no more images
        if (frame.rows == 0 || frame.cols == 0)
            break;

        // show image
        imshow("Fujifilm x-t3 stream", frame);

        //quit on ESC button
        if (waitKey(1) == 27)break;
    }

    return 0;

}

0

There are 0 answers