Problems faced in implementing signal and slot mechanism for camera program
I have implement signal and slot mechanism for fetching the frame from camera and display it using opencv.
The signal to slot connection is as follows:
connect(cameraTimer, SIGNAL(timeout()), this, SLOT(showCameraFrame()));
The timeout have been set to 1 millisec as : cameraTimer->start(1)
showCameraFrame()--> capture the frame using VideoCapture class of opencv and display the latest frame on qlabel.
Following were the observation:
-> It takes a lot of time to process the other signal and also capturing of the frame.
For ex: My signals of the serial port takes about 90-100 millisec to send data and get the response.
In normal case it takes 0.2 nanosec.
->cap >> frame takes about 13 millisec. But normally take
Note: cap is object of class VideoCapture & frame of class Mat of opencv.
Solution: Decreasing the timeout time of the timer ie: timer->start(50) resolves the issue. The time to process the serial data and capturing of frame reduces the time to nanosec which is required.
Please let know the exact issue of problem also i have tried to capture the frame using threading but there also frame was taking about 13 millisec which is also not desirable
@Kira 1ms timeout would mean 1000 frames per second! What would be the reason to read frames at that speed? Do you have a high speed camera? Normal cameras have framerates between 24-60 frames per second...
@jsulm : Thanks a lot for the reply. Actually I have a camera which runs at 120fps.
And what could be the probable reason for 13 millisec in capturing the frame. Maybe because i am requesting the frame so fast and camera is not being able to buffer and send the images when requested ??
@Kira I don't know how you access the camera. Is there a possibility to get a notification from the camera if a new frame is available? This way you don't need to actively ask the camera.
@jsulm : I'll have to see to it . I was earlier using opencv. I have the camera sdk now so will try to get deeper to the features provide. Will let know in case if i get anything.
Once again thanks for your help :)