Reputation: 342
I want to open video file dt_passat.mpg
with OpenCV. I use the following code:
#include <stdio.h>
#include <opencv2/opencv.hpp>
using namespace cv;
int main( int argc, char** argv )
{
VideoCapture capture("dt_passat.mpg");
if (!capture.isOpened()) {
std::cerr << "ERR: capture is not opened" << std::endl;
getchar();
return -1;
}
}
However, it fails, and I don't know why. How can I get the point of the problem with initialization of VideoCapture (not found file/corrupted file/unknown codec/etc.)?
Upvotes: 2
Views: 283
Reputation: 96109
The opencv image/video/camera IO and gui are really only meant to get sample data in and out to test algorithms to make a real application you need a more capable general library for system stuff.
However the actual image processing algorithms are pretty good quality.
Upvotes: 1
Reputation: 5085
Unfortunately, OpenCV does not always have the best documentation.
You can try looking at the internal error code using cvGetErrorStatus()
and then turn that into a readable string with cvErrorStr()
. See http://opencv.willowgarage.com/documentation/c/core_utility_and_system_functions_and_macros.html#cvGetErrStatus
Upvotes: 3