Has anybody managed to capture video from a usb webcam on a BBB with any recent Linux distribution using OpenCV cv::VideoCapture functions?
I’m using a Logitech C615 which works perfectly with OpenCV on x86 PCs and on a Raspberry Pi 2 (a little slow but it works) running the latest Raspbian Jessie image.
But I haven’t yet managed to get anything but completely black images running the same program on my BBB. I’ve tried it with a recent Arch Linux image. I’ve tried Ubuntu 14.04, Debian 7.9 and 8.3 (with a few different kernels) from BeagleBoard. Nothing! No problems doing anything else in OpenCV – it can load and display individual images and videos from files, just not from the camera. And in all of these installations I can capture video from the camera with other programs (using v4l2) – just not with OpenCV.
I’ve seen Derek Molloy’s videos demonstrating use of OpenCV on a BBB – but he was running it under Angstrom, and as far as I can see the last Angstrom distro was at least 3 years ago.
Any suggestions for something more recent?
By the way, here’s a sample of a program that’s fails to capture any video on the BBB (it displays the frame size and then just gives a series of “select timeout” messages):
#include
#include <opencv2/highgui/highgui.hpp>int main(int argc, char *argv) {
cv::VideoCapture cap;cap.open(0);
if(!cap.isOpened()) {
std::cout << “Did not connect to camera.” << std::endl;;
return -1;
}double dWidth = cap.get(CV_CAP_PROP_FRAME_WIDTH);
double dHeight = cap.get(CV_CAP_PROP_FRAME_HEIGHT);std::cout << "Frame size: " << dWidth << " x " << dHeight << std::endl;
cv::namedWindow(“MyVideo”,CV_WINDOW_AUTOSIZE);while(1) {
cv::Mat frame;
bool bSuccess = cap.read(frame);
if(!bSuccess) {
std::cout << “failed to read frame” << std::endl;
break;
}
cv::imshow(“MyVideo”, frame);
if(cv::waitKey(30) >= 0) break;
}return 0;
}
Can’t get much simpler than that.