Itseez/opencv — pull request #3152 by PhilLab (2014-08-23 16:35:24+00:00)
Title: VideoCapture did not detect an unopened camera

Resolving [issue 3880](http://code.opencv.org/issues/3880):

"I believe that during the creation of the new videoio module, VideoCapture was broken by using cv::Ptr : When using Direct Show (and most probably any other camera module), isOpened() always reports "true" even if no camera has been opened"

I don't know how VideoCapture_IntelPerC behaves but I assume/hope my code does not break it.

The change in cap_dshow.cpp is actually not necessary to fix the bug itself but I think checking for non-negativity would be a good idea. (In this line the actual run-time exception leading to the discovery of the bug was thrown.)