本文整理汇总了Python中VideoCapture.Device.getDisplayName方法的典型用法代码示例。如果您正苦于以下问题:Python Device.getDisplayName方法的具体用法?Python Device.getDisplayName怎么用?Python Device.getDisplayName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VideoCapture.Device
的用法示例。
在下文中一共展示了Device.getDisplayName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: options
# 需要导入模块: from VideoCapture import Device [as 别名]
# 或者: from VideoCapture.Device import getDisplayName [as 别名]
def options(self, device_name=None, device_number=None):
# I doubt people will have more than 5 webcams plugged in
print 'Webcam\toptions() called'
opts = []
for i in range(2):
try:
print 'Webcam\toptions - attempting to connect to %s' % i
d = Device(devnum=i)
if device_name is not None and device_name == d.getDisplayName():
del self.device
self.device = d
elif device_number is not None and device_number == i:
del self.device
self.device = d
opts.append((i, d.getDisplayName()))
del d
except:
pass
print 'Webcam\toptions() returning %s' % opts
return opts
示例2: options
# 需要导入模块: from VideoCapture import Device [as 别名]
# 或者: from VideoCapture.Device import getDisplayName [as 别名]
def options(self, device_name=None, device_number=None):
# I doubt people will have more than 5 webcams plugged in
self.logger.debug('options() called with device_name %s and device_number %s' % (device_name, device_number))
opts = []
for i in range(2):
try:
self.logger.debug('options - attempting to connect to %s' % i)
d = Device(devnum=i)
if device_name is not None and device_name == d.getDisplayName():
del self.device
self.device = d
elif device_number is not None and device_number == i:
del self.device
self.device = d
opts.append((i, d.getDisplayName()))
del d
except:
self.logger.exception("Exception while setting webcam options")
pass
self.logger.debug('options() returning %s' % opts)
if self.connected():
self.logger.debug('options - managed to connect to a device!')
return opts
示例3: enumerateDevices
# 需要导入模块: from VideoCapture import Device [as 别名]
# 或者: from VideoCapture.Device import getDisplayName [as 别名]
def enumerateDevices():
"""Lists all available video devices.
Returns a tuple of 2-tuples, which contain the integral index
and the display name (if available) of the video device.
"""
devices = ()
i = 0
cont = True
while cont:
try:
d = Device(i)
devices += ((i, d.getDisplayName()),)
i += 1
except:
cont = False
return devices