Hi,
I am having an issue that only occurs on Linux (arm) on my Raspberry Pi 3b. It works fine on windows.
I am trying to read a video file using this loop:
while (videoCapture.isOpened()) {
DebugWrite("Start Grabbing Frame from VIDEO stream.", "ImageGrabber::RunGrabber");
_shouldStop.mx.lock();
if (_shouldStop.stop) {
break;
}
_shouldStop.mx.unlock();
DebugWrite("Initiating MAT", "ImageGrabber::RunGrabber");
cv::Mat frame;
DebugWrite("Finished Initiating MAT, reading frame!", "ImageGrabber::RunGrabber");
if (videoCapture.read(frame)) {
DebugWrite("Frame written.", "ImageGrabber::RunGrabber");
if (cv::waitKey(30) >= 0 || frame.empty()) break;
DebugWrite("Copying frame to UMAT.", "ImageGrabber::RunGrabber");
_frameBuffer.mx.lock();
frame.copyTo(*_frameBuffer.writeFrame);
_frameBuffer.notempty = true;
DebugWrite("Frame copied to UMAT.", "ImageGrabber::RunGrabber");
_frameBuffer.mx.unlock();
DebugWrite("Videocapture (" + _imageSource.source + ").", "ImageGrabber::RunGrabber", frame);
}
else {
DebugWrite("Could not read video.", "ImageGrabber::RunGrabber");
break;
}
}
It read the first frame fine. But when I want to read the second frame from the video file it throws this error:
As can be seen from the debug messages, the error happens on the line:
if (videoCapture.read(frame))
Since it happens here, it feels like something that is out of my control.
This code runs fine on my windows machine. Another peculiar thing is the fact that it tries to open the "OpenCL runtime"? As far as I know, opencl is not supported on the raspberry pi. As can be seen, this runs in a seperate thread and the frame is accessed in another thread, but protected by mutexes. In the other thread a pointer swap is done to prevent the necessity to copy the frame.
I have no clue if I am doing something wrong or that something underwater (with opencv) is going wrong. If someone knows of a similar issue or can give me pointers (no pun intended ;) ) to a solution, I would be very glad.
Thanks in advance!