Suddenly unable to use OpenCV

asked 2017-04-30 06:34:58 -0600

Eldar gravatar image

updated 2017-04-30 10:41:32 -0600

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?

edit retag flag offensive close merge delete

Comments

check :

  1. antivirus
  2. https://privacy.microsoft.com/en-us/w...
  3. windows update
LBerger gravatar imageLBerger ( 2017-04-30 08:32:38 -0600 )edit

Thank you for getting back to me!

  1. I have avast antivirus (free). I have essentially disabled it (by disabling all shields) but I get the same result.
  2. I'm not sure what this one means. Googling reveals something happened around January, but I'm not sure how to tackle this to investigate the issue.
  3. Windows update - I've removed 2 security updates. As a result, I've downgraded to 15063.0 (which drops the 250 part). No difference. I cannot remove anymore to revert further.

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?

Eldar gravatar imageEldar ( 2017-04-30 10:39:40 -0600 )edit

check dll dependy using depends.exe or procexp64.exe

LBerger gravatar imageLBerger ( 2017-04-30 11:09:43 -0600 )edit

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.

Eldar gravatar imageEldar ( 2017-04-30 15:36:18 -0600 )edit

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...

LBerger gravatar imageLBerger ( 2017-04-30 15:48:56 -0600 )edit

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 :(

Eldar gravatar imageEldar ( 2017-05-01 05:28:45 -0600 )edit

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...

LBerger gravatar imageLBerger ( 2017-05-01 05:49:39 -0600 )edit

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.

Eldar gravatar imageEldar ( 2017-05-01 14:38:57 -0600 )edit

try CAP_VFW or CAP_MSMF.

You have to activate WITH_MSMF in cmake

LBerger gravatar imageLBerger ( 2017-05-01 14:42:59 -0600 )edit

Have you solved your problem?

LBerger gravatar imageLBerger ( 2017-05-03 08:34:57 -0600 )edit