View Single Post
  #9   Spotlight this post!  
Unread 11-02-2016, 18:13
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
Re: OpenCV C++ Bad file descriptor. USB Lifecam

I tested out the example code and it still says bad file descriptor still. I have the most simple code and still the same error.

Here it is:

Code:
#include <stdio.h>
#include <opencv2/opencv.hpp>
#include <iostream>

void testVision() {
    cv::VideoCapture vcap(0);
    cv::Mat image;

    //open the video stream and make sure it's opened
    std::cout << "in testVision" << std::endl;
    std::cout << "about to go into loop" << std::endl;
    while(1) {
    	std::cout << "in loop" << std::endl;
    	vcap >> image;
        //std::cout << "No frame" << std::endl;
        std::cout << "Width: " << image.cols << std::endl;
        std::cout << "Height: " << image.rows << std::endl;

        //if(cv::waitKey(1) >= 0) break;
    }
}
I'm honestly completely confused because multiple teams have had this working with no issue.