Hello all, I am having an issue with the USB Lifecam and getting an image to an an openCV mat. My code works fine with an axis camera, but because ours broke a couple days ago I am trying to get the USB camera to work with the code. It opens the stream fine, but ends up with a width and height of zero. The error log is:
Code:
IM AM IN PROCESS IMAGE!
VIDIOC_QBUF: Bad file descriptor
Unable to stop the stream.: Bad file descriptor
munmap: Invalid argument
munmap: Invalid argument
munmap: Invalid argument
munmap: Invalid argument
Here is our code:
Code:
// opens up the camera stream and tries to load it
videoCapture = cv::VideoCapture();
// replaces the ##.## with your team number
videoCapture.open(0);
// Example
// cap.open("http://10.30.19.11/mjpg/video.mjpg");
// wait until it is opened
while(!videoCapture.isOpened()){
printf("videoCapture could not open!\n");
}
// time to actually process the acquired images
processImage();
processImage:
Code:
videoCapture.read(matOriginal);
if(matOriginal.empty()) {
break;
}
Im not really sure why but it seems like the image is empty. I tried putting the image grabbing in a loop, because I hear it could take a while to grab an image. However, no dice.
I'm really hoping someone else has had a similar issue because our team cannot afford another axis camera.
Thanks,
Drew