View Single Post
  #1   Spotlight this post!  
Unread 09-02-2016, 19:48
jreneew2's Avatar
jreneew2 jreneew2 is offline
Alumni of Team 2053 Tigertronics
AKA: Drew Williams
FRC #2053 (TigerTronics)
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Vestal, NY
Posts: 195
jreneew2 has a spectacular aura aboutjreneew2 has a spectacular aura aboutjreneew2 has a spectacular aura about
OpenCV C++ Bad file descriptor. USB Lifecam

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

Last edited by jreneew2 : 09-02-2016 at 19:53. Reason: added info