本文整理汇总了Python中VideoCapture.Device.displayCapturePinProperties方法的典型用法代码示例。如果您正苦于以下问题:Python Device.displayCapturePinProperties方法的具体用法?Python Device.displayCapturePinProperties怎么用?Python Device.displayCapturePinProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VideoCapture.Device
的用法示例。
在下文中一共展示了Device.displayCapturePinProperties方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from VideoCapture import Device [as 别名]
# 或者: from VideoCapture.Device import displayCapturePinProperties [as 别名]
class myCam:
def __init__(self,show=0):
self.cam = Device(devnum=0, showVideoWindow=show)
self.cam.setResolution(width=720, height=480)
self.baseDir='C:\\Andrew\\data\\'
tmp=time.localtime()
self.dayStr='%02.0f%02.0f%02.0f' % (tmp[0]-2000,tmp[1],tmp[2])
self.dataDir=self.baseDir + self.dayStr
if not os.path.exists(self.dataDir):
os.mkdir(self.dataDir)
self.name='tmp'
def setProperties(self):
self.cam.displayCapturePinProperties()
def grab(self,fn=None,q=90):
if fn is None:
fn='%stest.jpg' % self.baseDir
self.cam.saveSnapshot(filename=fn, quality=q)
def series(self,n=1,s=None):
if not s is None:
self.name=s
for i in range(n):
self.grab('%s\\%s%03.0f.jpg' % (self.dataDir,self.name,i))
示例2: Device
# 需要导入模块: from VideoCapture import Device [as 别名]
# 或者: from VideoCapture.Device import displayCapturePinProperties [as 别名]
from pygame.locals import *
from PIL import ImageEnhance
#import MssUnitChr2 as ms
import MssUnit2 as ms # less talkative version of the MssUnit
#import UniversalLibrary as UL
import numpy as np
# camera parameters
res = (1344,1024)
#res = (640,480)
pixel_4x=[1.532,1.532] # one pixel in um at 4x, resolution 1344x1024
FRAMERATE = 25 # 25
pygame.init()
cam = Device()
cam.displayCapturePinProperties()
cam.setResolution(res[0],res[1])
screen = pygame.display.set_mode(res)
pygame.display.set_caption('CRACM Now')
pygame.font.init()
font = pygame.font.SysFont("Courier",11)
brightness = 1.0
contrast = 1.0
shots = 0
# pygame control initial settings
moveLeft = False
moveRight = False
moveUp = False
moveDown = False
示例3: Device
# 需要导入模块: from VideoCapture import Device [as 别名]
# 或者: from VideoCapture.Device import displayCapturePinProperties [as 别名]
from VideoCapture import Device
import time, string
## Specify the amount of seconds to wait between individual captures.
interval = 2
## If you get horizontal stripes or other errors in the captured picture
## (especially at high resolutions), try setting showVideoWindow=0.
cam = Device(devnum=0, showVideoWindow=1)
#cam = Device(devnum=1, showVideoWindow=1)
## Using the separate programs "setPropertiesDev0/1.pyw" before capturing
## works better for some devices.
## On the other hand, some devices don't remember their state, so the
## properties have to be set at every program start.
cam.displayCapturePinProperties()
#cam.displayCaptureFilterProperties()
print "press 'ctrl + c' to terminate"
i = 0
quant = interval * .1
starttime = time.time()
while 1:
lasttime = now = int((time.time() - starttime) / interval)
#print i
cam.saveSnapshot('C:\\Windows\\Temp\\' + string.zfill(str(i), 4) + '.jpg', timestamp=3, boldfont=1)
i += 1
while now == lasttime:
now = int((time.time() - starttime) / interval)
time.sleep(quant)
示例4: str
# 需要导入模块: from VideoCapture import Device [as 别名]
# 或者: from VideoCapture.Device import displayCapturePinProperties [as 别名]
last_capture_time = time.time()
snapshots_persisted = False
monitor = True
while monitor:
camshot = ImageEnhance.Brightness(cam.getImage()).enhance(brightness)
camshot = ImageEnhance.Contrast(camshot).enhance(contrast)
for event in pygame.event.get():
if event.type == pygame.QUIT: monitor = False
elif event.type == pygame.KEYUP:
if event.key == pygame.K_1: brightness -= .1
if event.key == pygame.K_2: brightness += .1
if event.key == pygame.K_3: contrast -= .1
if event.key == pygame.K_4: contrast += .1
if event.key == pygame.K_q: cam.displayCapturePinProperties()
if event.key == pygame.K_w: cam.displayCaptureFilterProperties()
if event.key == pygame.K_ESCAPE: pygame.event.post(pygame.event.Event(QUIT,))
if event.key == pygame.K_s:
output_filename = current_directory + ".mp4"
command_line = "ffmpeg.exe -r " + str(frames_per_second) + \
" -i " + os.path.join(current_directory, "%03d.jpg ") + \
output_filename
print("Exporting video...")
print("\t" + command_line)
subprocess.call(command_line)
print("Video exported to " + os.path.join(os.getcwd(), output_filename))
current_directory = str(time.time())
snapshots_persisted = True
shots = 0