Bug #3201 fix
This commit is contained in:
parent
2911b12145
commit
7e7fb0b75d
@ -3164,18 +3164,18 @@ void CvCaptureCAM_DShow::close()
|
|||||||
// Initialize camera input
|
// Initialize camera input
|
||||||
bool CvCaptureCAM_DShow::open( int _index )
|
bool CvCaptureCAM_DShow::open( int _index )
|
||||||
{
|
{
|
||||||
int try_index = _index;
|
|
||||||
int devices = 0;
|
int devices = 0;
|
||||||
|
|
||||||
close();
|
close();
|
||||||
devices = VI.listDevices(true);
|
devices = VI.listDevices(true);
|
||||||
if (devices == 0)
|
if (devices == 0)
|
||||||
return false;
|
return false;
|
||||||
try_index = try_index < 0 ? 0 : (try_index > devices-1 ? devices-1 : try_index);
|
if (_index < 0 || index > devices-1)
|
||||||
VI.setupDevice(try_index);
|
|
||||||
if( !VI.isDeviceSetup(try_index) )
|
|
||||||
return false;
|
return false;
|
||||||
index = try_index;
|
VI.setupDevice(_index);
|
||||||
|
if( !VI.isDeviceSetup(_index) )
|
||||||
|
return false;
|
||||||
|
index = _index;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user