-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenCV debug mode VideoCapture with file is broken #2613
Comments
In RelWithDebInfo mode,
But still this should not cause the video to fail to load completely. Adding |
Im having the same issue. |
No I haven't, I went back to using my self-compiled version of OpenCV. |
@ras0219-msft, is there anything we can do? I don't seem to be the only one with this issue, pointing to a problem in the vcpkg OpenCV package. And the camera input not working is quite a big issue. |
Ok, so I am actually unable to reproduce this issue (it works in debug for me). Let me share my setup: // main.cpp
#define NOMINMAX
#define WIN32_LEAN_AND_MEAN
#include <cstdio>
#include <opencv2/opencv.hpp>
int main(int argc, char** argv)
{
if (argc < 2)
return -1;
std::string inputvideo(argv[1]);
cv::VideoCapture cap;
if (inputvideo.empty()) {
cap.open(0); // no file given, open the default camera
}
else {
cap.open(inputvideo);
}
if (!cap.isOpened()) {
std::cout << "Couldn't open the given file or camera 0." << std::endl;
return EXIT_FAILURE;
}
getchar();
return 0;
} # CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
project(main CXX)
add_executable(main main.cpp)
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
target_link_libraries(main PRIVATE ${OpenCV_LIBS}) I installed I then installed I suspect you might have some other OpenCV DLLs available elsewhere in your path, which are getting loaded and cause issues only in debug mode, but that's just a guess. [1] http://www.technical-recipes.com/2011/displaying-avi-video-using-opencv/ |
@ras0219-msft: Riiight. So the key is:
I was able to reproduce what you did in a simple toy project (msbuild, not cmake), and it seems to work in Release and Debug mode. I haven't tested it in my production setup and with CMake yet, I will do so shortly.
I can't find an Issue for this yet - shall I open one? |
I can confirm that it now works in all three modes - Thank you very much again for helping to investigate. Finally back to using vcpkg :-) |
I've installed OpenCV 3.4.0 from vcpkg with
opencv[ffmpeg]
(without ffmpeg, it doesn't work either).In Release and RelWithDebInfo mode, both camera and reading from files (e.g. an .avi file) is fine.
In Debug mode however, reading from the camera works, but not reading from the avi file.
cap.isOpened()
fails in this scenario.The problem also does not occur if I build OpenCV by myself (outside of vcpkg) and also not with the binary package from opencv.org.
It also occured on OpenCV 3.3.x in vcpkg.
The text was updated successfully, but these errors were encountered: