VideoCapture did not detect an unopened camera

This commit is contained in:
PhilLab 2014-08-26 09:42:46 +02:00
parent 4b84d5d2c1
commit a0e4600364
2 changed files with 5 additions and 5 deletions

View File

@ -621,15 +621,15 @@ Ptr<IVideoCapture> VideoCapture::createCameraCapture(int index)
{
#ifdef HAVE_DSHOW
case CV_CAP_DSHOW:
capture = Ptr<IVideoCapture>(new cv::VideoCapture_DShow(index));
if (capture)
capture = makePtr<VideoCapture_DShow>(index);
if (capture && capture.dynamicCast<VideoCapture_DShow>()->isOpened())
return capture;
break; // CV_CAP_DSHOW
#endif
#ifdef HAVE_INTELPERC
case CV_CAP_INTELPERC:
capture = Ptr<IVideoCapture>(new cv::VideoCapture_IntelPerC());
if (capture)
capture = makePtr<VideoCapture_IntelPerC>();
if (capture && capture.dynamicCast<VideoCapture_IntelPerC>()->isOpened())
return capture;
break; // CV_CAP_INTEL_PERC
#endif

View File

@ -1590,7 +1590,7 @@ bool videoInput::isFrameNew(int id){
bool videoInput::isDeviceSetup(int id){
if(id<devicesFound && VDList[id]->readyToCapture)return true;
if(id>=0 && id<devicesFound && VDList[id]->readyToCapture)return true;
else return false;
}