本文整理汇总了Python中managers.CaptureManager.setProp方法的典型用法代码示例。如果您正苦于以下问题:Python CaptureManager.setProp方法的具体用法?Python CaptureManager.setProp怎么用?Python CaptureManager.setProp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类managers.CaptureManager
的用法示例。
在下文中一共展示了CaptureManager.setProp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Gui
# 需要导入模块: from managers import CaptureManager [as 别名]
# 或者: from managers.CaptureManager import setProp [as 别名]
#.........这里部分代码省略.........
self.setAble('motorized', True)
except serial.SerialException as e:
logger.exception(str(e))
QtWidgets.QMessageBox.information( self, "Motors Issue",
"Unable to connect to motors. Please connect or reboot motors. If problem persists, reboot computer")
def setSource ( self, value ):
self.existingVid = False
if type(value) != int:
nums = re.compile(r'\d*')
mat = re.match(nums,value).group(0)
if re.match(nums, value).group(0) is not u'':
src = int(value)
else:
src = str(value)
self.existingVid = True
else: #read in from calibration
src = value
self.ui.sourceCombo.setCurrentText(str(src))
if self._cap:
if self._cap._capture.isOpened(): #ugly access to VideoCapture object from managers
self._cap._capture.release()
self._cap = CaptureManager( cv2.VideoCapture(src) )
self.showImage = True
self.actualRes = self._cap.getResolution()
if self.actualRes != self.calibrationRes and not self.existingVid:
self._cap.setProp( 'height', self.calibrationRes[1] )
self._cap.setProp( 'width', self.calibrationRes[0] )
self.showImage = True
self.actualRes = self._cap.getResolution()
logger.warning("Actual resolution from cam is %s" % str( self.actualRes ) )
self.setAble('source', False)
self.setAble('buttons', True)
self.ui.buttonRefresh.setEnabled(False)
def setLogging( self, value ):
addFile = True
formatter = logging.Formatter( '%(asctime)s\t%(levelname)s\t%(name)s\t\t%(message)s' )
file = logging.FileHandler( '%s.log' % self.shareFileName )
logger.warning('New file')
file.setLevel( LOGGING_LEVELS['debug'] )
file.setFormatter( formatter )
console = logging.StreamHandler()
console.setLevel( LOGGING_LEVELS['debug'] )
console.setFormatter( formatter )
for h in logger.handlers:
if type(h) == logging.StreamHandler:
logger.removeHandler( h )
elif type(h) == logging.FileHandler: #if file has started, leave it be!!!
addFile = False
if addFile:
logger.addHandler( file )
logger.addHandler( console )
示例2: Gui
# 需要导入模块: from managers import CaptureManager [as 别名]
# 或者: from managers.CaptureManager import setProp [as 别名]
#.........这里部分代码省略.........
self._cap = CaptureManager( cv2.VideoCapture(int(value)) )
#self.indWindow = cv2.namedWindow("Camera Display")
self.showImage = True
self.actualRes = self._cap.getResolution()
# Set to default resolution from camera (640x480)
#res = "%d x %d" % (int(self.actualRes[0]), int(self.actualRes[1]) )
#index = self.ui.comboBox.findText(res) #Sets picker to default resolution
#self.ui.comboBox.setCurrentIndex(index)
# Set to Hoky desired default res (1280x960)
res = "%d x %d" % (int(self.idealRes[0]), int(self.idealRes[1]) )
index = self.ui.comboBox.findText(res) #Sets picker to default resolution
self.ui.comboBox.setCurrentIndex(index)
self.resolutionSelect()
self.p = Point(200,300)
self.c = Point(self.actualRes[0] // 2, self.actualRes[1] // 2)
self.setAble('settings', True)
def resolutionSelect ( self ):
# Get desired resolution from the user:
self.idealRes = self.ui.comboBox.currentText().split('x')
self.idealRes = map(lambda x: int(x), self.idealRes)
logger.debug("User input res: %d %d" % (self.idealRes[0], self.idealRes[1]) )
# Attempt to change the resolution:
self._cap.setProp('width', self.idealRes[0])
self._cap.setProp('height', self.idealRes[1])
self.actualRes = self._cap.getResolution()
# Something went wrong with resolution assignment -- possible need for shut down if resolution can't even be queried
self.c = Point(self.actualRes[0] // 2, self.actualRes[1] // 2)
if not ( self.actualRes == self.idealRes ):
QtWidgets.QMessageBox.information( self, "Resolution",
"That resolution isn't supported by the camera. Instead, your actual resolution is: %d x %d" % (self.actualRes[0], self.actualRes[1] ) )
res = "%d x %d" % (int(self.actualRes[0]), int(self.actualRes[1]) )
index = self.ui.comboBox.findText(res)
self.ui.comboBox.setCurrentIndex(index)
def save( self ):
c = os.path.dirname(os.getcwd())
cc = os.path.dirname(c)
f = open( ("%s/config.txt" % cc) , "w")
f.write('%d|%d|%s|%s\n' % ( self.actualRes[0], self.actualRes[1], self.ui.widthLine.text(), self.ui.sourceCombo.currentText() ))
f.close()
def setMultFactor ( self, value ):
self.multFactor = value
self.ui.scaling.setText( 'Step scaling is %d' % value)
def setAble( self, group, ability ):
groups = { 'motors' : [self.ui.buttonLeft,
self.ui.buttonRight,
self.ui.buttonUp,
self.ui.buttonDown,