0

We are trying to port opencv application on an single board computer which runs on Yocto Linux and while doing that we have had many issues. Issues related to drivers, which are solved by changing the configuration file of the kernel and all. We were able to solve all those issues and finally, we are hitting the 'select timeout' error during below highlight line in the snapshot code.

#include <iostream>
#include <opencv2/opencv.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core.hpp>
#include <opencv2/core/core.hpp>

using namespace std;

int main(int, char**) {
  cv::VideoCapture camera(0);
   if (!camera.isOpened()) {
     return 1;
   }
   cv::Mat frame;
   while (camera.isOpened()) {
     ***camera >> frame;***
   }
  return 0;
}

This code does work on my local machine, but not on the SBC. Are there any leads for this issue to solve? I would be happy to share more details if required.

P.S. Camera is well detected and thus not throwing any error at !camera.isOpened() code. It gives the error 'select timeout' error at camera >> frame line.

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
Hemant Bhargava
  • 3,251
  • 4
  • 24
  • 45
  • related: https://forum.opencv.org/t/select-timeout-for-opencv-application-while-running-on-yocto-linux-environment/6303 – Christoph Rackwitz Nov 19 '21 at 09:48
  • @ChristophRackwitz, Ha ha. That is me only. I was the one who posted at opencv forum as well. :) – Hemant Bhargava Nov 19 '21 at 09:52
  • I dont know enough about YoctoLinux. Is there some kind of watchdog which assumes to get a signal once in a while? `camera >> frame` is blocking until a new frame is available. For a 25 fps camera this will be about 40 ms. Starting a camera can take much longer. – Micka Nov 19 '21 at 10:22
  • if you remove the opencv code and just put a sleep of 10 seconds there, will you also get a timeout error? – Micka Nov 19 '21 at 10:25
  • what happens when you open the camera with something like VLC/guvcview/ffmpeg/ffplay? -- call `getBackendName()` on the capture object. what does it say? https://docs.opencv.org/3.4/d8/dfe/classcv_1_1VideoCapture.html#a4576e03f447abfdbd602c0809824ec03 – Christoph Rackwitz Nov 19 '21 at 12:30
  • btw, googling `"select timeout" opencv` gives me a bunch of results that can lead to a solution. some involve `modprobe uvcvideo` – Christoph Rackwitz Nov 19 '21 at 12:33
  • @Micka, That's a very good suggestion. I would try that and get back to you. – Hemant Bhargava Nov 20 '21 at 03:22
  • @ChristophRackwitz, Thanks for your reply Christoph. I would read your pointed doc and come back to you. The problem with google on this topic is that it gives you too many answers/possibilities and none of them seems to be verified. – Hemant Bhargava Nov 20 '21 at 03:24

0 Answers0