本文整理汇总了Python中managers.WindowManager.show方法的典型用法代码示例。如果您正苦于以下问题:Python WindowManager.show方法的具体用法?Python WindowManager.show怎么用?Python WindowManager.show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类managers.WindowManager
的用法示例。
在下文中一共展示了WindowManager.show方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Tracker
# 需要导入模块: from managers import WindowManager [as 别名]
# 或者: from managers.WindowManager import show [as 别名]
class Tracker ( object ):
def __init__( self, method, src ):
### Sensitivity of tracker params
self._sampleFreq = 0.1 #in sec
### Set Camera params
#self.resolution = (640, 480 )
self.resolution = (1280, 960)
source = {
0:0,
1:1,
2:'led_move1.avi',
3:'screencast.avi',
4:'screencast 1.avi',
5: 'shortNoBox.avi',
6: 'longNoBox.avi',
7: 'H299.avi',
8: 'testRec.avi',
9: 'longDemo.avi',
10: 'worm2014_05_05-12-44-53.avi'
}
self.color = True
self.captureSource = source[int(src)]
### Timing initialization
self._startTime = time.time()
self._lastCheck = self._startTime - self._sampleFreq
### Display params
self.mirroredPreview = False
### Initialize Objects
##### Windows
self._rawWindow = WindowManager( 'RawFeed', self.onKeypress )
### Capture -- resolution set here
self._cap = CaptureManager(
cv2.VideoCapture(self.captureSource),
self._rawWindow,
self.mirroredPreview, self.resolution)
actualCols, actualRows = self._cap.getResolution()
## from here on out use this resolution
### Arguments for finder
self.finderArgs = {
'method' : method,
'gsize' : 45,
'gsig' : 9,
'window' : 3,
'boundBoxRow' : 150,
'boundBoxCol' : 150,
'limRow' : 100,
'limCol' : 100,
'MAXONEFRAME': 500,
'REFPING' : 600000,
'MAXREF': 1000,
'capCols':actualCols,
'capRows': actualRows,
'color' : self.color
}
self._wormFinder = WormFinder( **self.finderArgs )
##### Debugging
self._overlayWindow = WindowManager( 'Overlay', self.onKeypress )
self.motorsOn = False
def run( self ):
# Show windows
self._rawWindow.createWindow()
self._overlayWindow.createWindow()
while self._rawWindow.isWindowCreated:
self._cap.enterFrame()
frame = self._cap.frame
# Probably not useful, removes errors when playing from video
# if not self._captureManager.gotFrame:
# self.shutDown()
# break
# Display raw frame to rawWindow
t1 = time.time()
# Get frame
frame = self._cap.frame
# Show frame to raw feed
self._rawWindow.show(frame)
# If tracking is enabled or motors are on, start tracking
#.........这里部分代码省略.........
示例2: Tracker
# 需要导入模块: from managers import WindowManager [as 别名]
# 或者: from managers.WindowManager import show [as 别名]
class Tracker(object):
def __init__(self, method, src):
self.color = True
self.motorsOn = False
### Sensitivity of tracker params
self._sampleFreq = 0.1 # in sec
### Set Camera params
# self.resolution = (640, 480 )
self.resolution = (1280, 960)
source = {
0: 0,
1: 1,
2: "led_move1.avi",
3: "screencast.avi",
4: "screencast 1.avi",
5: "shortNoBox.avi",
6: "longNoBox.avi",
7: "H299.avi",
8: "testRec.avi",
9: "longDemo.avi",
}
self.captureSource = source[int(src)]
### Timing initialization
self._startTime = time.time()
self._lastCheck = self._startTime - self._sampleFreq
### Display params
self.mirroredPreview = False
### Initialize Objects
##### Windows
self._rawWindow = WindowManager("RawFeed", self.onKeypress)
### Capture -- resolution set here
self._cap = CaptureManager(
cv2.VideoCapture(self.captureSource), self._rawWindow, self.mirroredPreview, self.resolution
)
actualCols, actualRows = self._cap.getResolution()
self.centerPt = utils.Point(actualCols / 2, actualRows / 2)
## from here on out use this resolution
boundCols = 600
boundRows = 600
### Arguments for finder
# --> Pairs are always COLS, ROWS !!!!!!!
self.finderArgs = {
"method": method,
"gsize": 45,
"gsig": 9,
"window": 3,
"MAXONEFRAME": 500,
"REFPING": 600000,
"MAXREF": 1000,
"captureSize": utils.Rect(actualCols, actualRows, self.centerPt),
"cropRegion": utils.Rect(100, 100, self.centerPt),
"decisionBoundary": utils.Rect(boundCols, boundRows, self.centerPt),
"color": self.color,
"motorsOn": self.motorsOn,
}
self._wormFinder = WormFinder(**self.finderArgs)
##### Debugging
# self._gaussianWindow = WindowManager('Gaussian', self.onKeypress)
self._overlayWindow = WindowManager("Overlay", self.onKeypress)
def run(self):
# Show windows
self._rawWindow.createWindow()
self._overlayWindow.createWindow()
i = 0
while self._rawWindow.isWindowCreated:
self._cap.enterFrame()
frame = self._cap.frame
# Probably not useful, removes errors when playing from video
# if not self._captureManager.gotFrame:
# self.shutDown()
# break
# Display raw frame to rawWindow
t1 = time.time()
# Get frame
frame = self._cap.frame
# Show frame to raw feed
self._rawWindow.show(frame)
# If tracking is enabled or motors are on, start tracking
if time.time() - self._lastCheck >= self._sampleFreq:
if self.finderArgs["method"] in ["lazyc", "lazyd", "lazy"]:
self.gaussian = self._wormFinder.processFrame(frame)
#.........这里部分代码省略.........