Access violation when opening OpenCV VideoCapture (release only)
I have an application written in visual studio, utilizing OpenCV 2.4.10. The program executes flawlessly in debug mode, but in release mode it crashes on the first command following a VideoCapture::open() call, regardless of whether the call was completed in the constructor or with the method call. I recognize that this is a pretty common occurrence, and that a dll linkage may be the issue, but have been unable to fully identify the problem. Any assistance is greatly appreciated.
Here is the error message:
Unhandled exception at 0x03DE7D43 (opencv_ffmpeg2410.dll) in OpenCVLaserDot.exe: 0xC0000005: Access violation reading location 0x00000000.
Here is the segment of code surrounding the VideoCapture instantiation:
const string DEFAULT_INPUT_FILE = "C:/Users/Tyler/Documents/Visual Studio 2013/Projects/OpenCVLaserDot/Release/a.avi";
VideoCapture cap;
if (inputFile == "1" || inputFile == ""){
cap.open(DEFAULT_INPUT_FILE);
} else {
cap.open(inputFile);
}
if (!cap.isOpened()){
printf("Failed to open video\n");
return -1;
}
Isn't it because you have not linked the relesed dlls (opencv_ffmpeg2410.dll release and opencv_ffmpeg2410d.dll debug)?
I know it is probably not the case but
OpenCV 2.4.10
imho, drop it, its deprecated and there is a newer stable version2.4.11
. This ensures that you do not get stuck at old problems.