Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

openCV 3.1.0 videocapture can't open a video

Hello, I've installed opencv 3.1.0, building on my own with visual studio 2010 and everything is working but videocapture, compiling but not running; I've tried all I could find on the net (updated K-light codecs and put the opencv_ffmpeg310_64.dll in the compiler directory C:\opencv\build\x64\vc10\bin)

The simple test code I'm using:

#include <iostream> #include <fstream> #include <opencv2 videoio.hpp=""> #include <opencv2 highgui.hpp=""> #include <opencv2 imgproc.hpp=""> using namespace cv; using namespace std;

int main(int argc, char** argv) {

Mat imagex;
imagex = imread("C:/opencv/data/test.png", IMREAD_COLOR); // Read the file     


if( imagex.empty() ) // Check for invalid input     
{         
    cout << "Could not open or find the image" << std::endl ;         
    return -3;

}
else 
cout << "image opened" << std::endl ;


 ifstream myfile;
 myfile.open ("C:/opencv/data/pictCh0_0.yuv", ios::binary|ios::ate); //open the yuv422 file


 if (!myfile.is_open()) { 
    fprintf(stderr, "error: unable to open file"); 
    return 1; 
 }
 else 
 cout << "file opened" << std::endl ;



 // Open a video file:
 cv::VideoCapture cap("C:/opencv/data/test.avi");
 if(!cap.isOpened()) {
     std::cout << "Unable to open the camera\n";
     std::exit(-1);
 }

...... etc......

it reads the image and the binary file but not the video and I've tried any kind of video, also the same test.pgn image read by imread. I tried to debug but no errors, simply it does not load anything. The most annoying thing is that with the pre-built libraries 3.1.0 it runs even though in the compiler directory only but I can't use them because they don't support CUDA... Any clue? Thanks in advance.

openCV 3.1.0 videocapture can't open a video

Hello, I've installed opencv 3.1.0, building on my own with visual studio 2010 and everything is working but videocapture, compiling but not running; I've tried all I could find on the net (updated K-light K-lite codecs and put the opencv_ffmpeg310_64.dll in the compiler directory C:\opencv\build\x64\vc10\bin)

The simple test code I'm using:

#include <iostream> #include <fstream> #include <opencv2 videoio.hpp=""> #include <opencv2 highgui.hpp=""> #include <opencv2 imgproc.hpp=""> using namespace cv; using namespace std;

int main(int argc, char** argv) {

Mat imagex;
imagex = imread("C:/opencv/data/test.png", IMREAD_COLOR); // Read the file     


if( imagex.empty() ) // Check for invalid input     
{         
    cout << "Could not open or find the image" << std::endl ;         
    return -3;

}
else 
cout << "image opened" << std::endl ;


 ifstream myfile;
 myfile.open ("C:/opencv/data/pictCh0_0.yuv", ios::binary|ios::ate); //open the yuv422 file


 if (!myfile.is_open()) { 
    fprintf(stderr, "error: unable to open file"); 
    return 1; 
 }
 else 
 cout << "file opened" << std::endl ;



 // Open a video file:
 cv::VideoCapture cap("C:/opencv/data/test.avi");
 if(!cap.isOpened()) {
     std::cout << "Unable to open the camera\n";
     std::exit(-1);
 }

...... etc......

it reads the image and the binary file but not the video and I've tried any kind of video, also the same test.pgn image read by imread. I tried to debug but no errors, simply it does not load anything. The most annoying thing is that with the pre-built libraries 3.1.0 it runs even though in the compiler directory only but I can't use them because they don't support CUDA... Any clue? Thanks in advance.