Suddenly unable to use OpenCV
Hello,
OpenCV has been working very well for the past few months until 3 days ago. Suddenly, I cannot receive any video feed from my camera's feed. Since re-compiling OpenCV my IDE flags My camera's work fine in other applications (Skype, default camera App).
So far I have: Attempted different camera's - same result Recompiled Opencv 3.2 in CMake, believing a file may have been corrupt Repaired Visual Studio
Environment specs:
- Opencv 3.2
- Windows 10 : Build 15063.̶2̶5̶0̶ - I've since reverted to 15063.0
- Visual Studio 2013
Below is a snippet of my code, all I receive is a grey screen.
cv::VideoCapture cap(0); //Behaves the same when 1 - external cam
if (!cap.isOpened()) // Always succeeds
{
std::cout << "Cannot open the video cam" << std::endl;
return -1;
}
cv::namedWindow("MyVideo", CV_WINDOW_AUTOSIZE);
while (1)
{
cv::Mat frame;
bool bSuccess = cap.read(frame); // read a new frame from video
if (bSuccess == false) //Always true
{
std::cout << "Cannot read a frame from video stream" << std::endl;
break;
}
cv::imshow("MyVideo", frame); //Just displays a light grey frame
cv::waitKey(20); -Wait a few - Common mistake for similar issues
}
return 0;
The returned frame DOES have data in the Mat object. It just always displays a light grey.
Could anyone offer any insight as to why i'm experiencing my issues?
check :
Thank you for getting back to me!
I've done some investigating since the post; and I'm concerned about Codecs. I did install MPHC since it last working build and now it's failing. I've since removed MPHC, but there's been no progress at all. How can I ensure I have what Codecs I may need?
check dll dependy using depends.exe or procexp64.exe
depends.exe only reveals errors with missing "API-MS-WIN-XXXX", "EXT-MS-WIN-XXXX" and"IESHIMS.DLL". From what I understand, this is normal.
when you rebuild opencv have you selected WITH_FFMPEG ? Can you find opencv_ffmpeg320 ?can you uninstalled MPHC or disable ? Can you try with a basic webcam logitech c170 ? Can you open a video using opencv ? it is just idea...
Thanks for getting back to me!
Yes, I have ffmpeg enabled. A _ffmpeg320.dll is generated. This DLL is also in my exectuables folder.
No webcams work with OpenCV. I've tried 3. They all work in other programs (Skype, default Camera App).
Yes,I can load videos and see their frames. It's just my cameras :(
I don't remember but in previous post somebody change name of exe file and suddenly it works (last week there is post on so) and http://answers.opencv.org/question/14...
Renaming the exe made no difference.
Interesting thing I found out though, attaching the "CAP_DSHOW" and "CAP_FFMPEG" parameters to the VideoCapture method causes different effects. "CAP_DSHOW" gives a totally grey image. CAP_FFMPEG gives a nonsensically colourful image. I've confirmed FFMPEG is correctly installed though.
try CAP_VFW or CAP_MSMF.
You have to activate WITH_MSMF in cmake
Have you solved your problem?