本文整理汇总了Python中Camera.Camera类的典型用法代码示例。如果您正苦于以下问题:Python Camera类的具体用法?Python Camera怎么用?Python Camera使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Camera类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testmain
def testmain():
xxx = Camera()
xxx.start()
while True:
i = yyy.getImage()
print "YYY got image"
示例2: test_getPicture
def test_getPicture(self):
try:
Camera.getPicture(self.logger, 10000)
print "Not exception"
except Exception, e:
self.assertEqual(e.args[0], 2)
示例3: CameraJPEGServer
class CameraJPEGServer(HTTPServer):
cameraStore = None
camera = None
def __init__(self, *args, **kw):
HTTPServer.__init__(self, *args, **kw)
self.camera = Camera()
self.camera.start()
示例4: Scene
class Scene(BackgroundLayer, KeyListener):
def __init__(self, engine):
self.engine = engine
self.camera = Camera()
self.time = 0.0
self.player = self.engine.world.getPlayers()[0]
self.controls = Player.Controls()
def shown(self):
self.engine.input.addKeyListener(self)
def hidden(self):
self.engine.input.removeKeyListener(self)
def keyPressed(self, key, unicode):
c = self.controls.keyPressed(key)
if c:
return True
return False
def keyReleased(self, key):
c = self.controls.keyReleased(key)
if c:
return True
return False
def run(self, ticks):
self.time += ticks / 50.0
def render3D(self):
pass
def render(self, visibility, topMost):
font = self.engine.data.font
# render the scene
try:
glMatrixMode(GL_PROJECTION)
glPushMatrix()
glLoadIdentity()
gluPerspective(60, self.engine.view.aspectRatio, 0.1, 1000)
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
glPushMatrix()
self.camera.apply()
self.render3D()
finally:
glPopMatrix()
glMatrixMode(GL_PROJECTION)
glPopMatrix()
glMatrixMode(GL_MODELVIEW)
示例5: __init__
def __init__(self):
Globals.PLAYER_HEALTH = 100
Globals.PLAYER_SCORE = 0
Globals.REMAINING_TIME = 30000
self.tileEngine = TileEngine("test_def.txt", "test_map.txt", 1, 3)
self.camera = Camera(self.tileEngine, pygame.Rect(
0, 0, Globals.WIDTH, Globals.HEIGHT))
self.keyCode = None
self.testPoint = []
self.object_radius = \
self.camera.tileEngine.get_tile_rect().height * 1.5
self.direction = -1
self.has_collided = False
self.enemySprites = pygame.sprite.Group()
self.playerSprites = pygame.sprite.Group()
self.health = HealthBar()
self.score_timer = ScoreTimer()
for x in range(TileTest.NUM_ENEMY):
# fix the positions they are added in and everything else
# should work
self.enemySprites.add(Enemy(Globals.WIDTH, Globals.HEIGHT,
self.camera))
player_x = Globals.WIDTH / 2
player_y = int(Globals.HEIGHT -
self.camera.tileEngine.get_tile_rect().height * 3.5)
self.player = Player(
Globals.WIDTH,
Globals.HEIGHT,
player_x,
player_y,
self.score_timer
)
self.playerSprites.add(self.player)
示例6: __init__
def __init__(self, engine, prompt = "", selectedSong = None, selectedLibrary = None):
self.prompt = prompt
self.engine = engine
self.time = 0
self.accepted = False
self.selectedIndex = 0
self.camera = Camera()
self.cassetteHeight = .8
self.cassetteWidth = 4.0
self.libraryHeight = 1.2
self.libraryWidth = 4.0
self.itemAngles = None
self.itemLabels = None
self.selectedOffset = 0.0
self.cameraOffset = 0.0
self.selectedItem = None
self.song = None
self.songCountdown = 1024
self.songLoader = None
self.initialItem = selectedSong
self.library = selectedLibrary
self.searchText = ""
# Use the default library if this one doesn't exist
if not self.library or not os.path.isdir(self.engine.resource.fileName(self.library)):
self.library = Song.DEFAULT_LIBRARY
self.loadCollection()
self.engine.resource.load(self, "cassette", lambda: Mesh(self.engine.resource.fileName("cassette.dae")), synch = True)
self.engine.resource.load(self, "label", lambda: Mesh(self.engine.resource.fileName("label.dae")), synch = True)
self.engine.resource.load(self, "libraryMesh", lambda: Mesh(self.engine.resource.fileName("library.dae")), synch = True)
self.engine.resource.load(self, "libraryLabel", lambda: Mesh(self.engine.resource.fileName("library_label.dae")), synch = True)
self.engine.loadSvgDrawing(self, "background", "cassette.svg")
示例7: __initP__
def __initP__(self, **kwArgs):
super().__initP__(**kwArgs)
self._sceneGraph = SceneGraph()
self._camera = Camera(getDictValue(kwArgs, None, ['ws', 'winSize', 'windowSize'], True), t=Transform())
self._camera.focus()
示例8: __init__
def __init__(self, parent):
QGLWidget.__init__(self, parent)
self.setMouseTracking(True)
self.selectedProj = -1
self.canvasModel = CanvasModel.Dome(23.0,11.5,11.5,0.0,1.0)
self.showCanvas = True
self.projectors = Projectors4(
Projector(11.5),
Projector(11.5),
Projector(11.5),
Projector(11.5),
0.0, # Tower Height
25.0, # Pitch Angle
0.0) # Yaw Angle
self.edgeBlending = True
self.showProjectorImages = True
self.projImagesFullscreen = False
# self.setMinimumSize(500, 500)
self.camera = Camera()
self.camera.setSceneRadius( 30 )
self.camera.reset()
self.isPressed = False
self.oldx = self.oldy = 0
self.textureFiles = os.listdir(TEXTURE_PATH)
self.textures = dict()
self.shaders = dict()
self.selTexture = "spherical_small"
示例9: __init__
def __init__(self,source=0):
# Selected base color
# fourth one is not used
self.hsv = (0,0,0,0)
self.hsv2 = (0,0,0,0)
self.hsv3 = (0,0,0,0)
# Thresholds
self.ht = 0
self.st = 180
self.vt = 200
self.ht_ = 0
self.st_ = 180
self.vt_ = 200
# Co-ords for the color selection square
# self.start = (0,0)
# self.end = (0,0)
self.center = (0,0)
# Boolean to check weather
# the colors are locked or not
self.locked = False
# Get the camera object
self.cam = Camera(source)
示例10: __init__
def __init__(self):
self.lock_ = Lock() # create a lock for this thread
self.alive_ = True
# create and initialise server for this processor
self.server_ = VisionServer(
self, V_SETT.VISION_SRV_NET_OPEN,
V_SETT.VISION_SRV_PORT, V_SETT.MAX_PENDING_REQS)
# obtain frame capture device obj
self.cam_ = Camera(0)
self.fps_ = 0
# flags that will tell wheter data can be trusted (accurate)
self.trust_bal_ = self.trust_blu_ = self.trust_ylw_ = None
# these hold robots' and ball's coordinates and direction
self.bal_center_ = None
self.blu_robot_center_ = None
self.ylw_robot_center_ = None
self.blu_dir_ = self.ylw_dir_ = None
# these hold pitcj and goal coordinates
self.l_goal_t_ = self.l_goal_b_ = self.r_goal_t_ = self.r_goal_b_ = None
self.pitch_tl_ = self.pitch_bl_ = self.pitch_tr_ = self.pitch_br_ = None
# create colour objects and set their threshold values
self.red_color_ = ColorSpace(ColorSpace.HSV)
self.red_color_.set_trsh_bounds((0, 80, 80), (10, 255, 255)) # pitch 2
self.blu_color_ = ColorSpace(ColorSpace.HSV)
self.blu_color_.set_trsh_bounds((92, 132, 199), (180, 255, 255))
self.ylw_color_ = ColorSpace(ColorSpace.RGB)
self.ylw_color_.set_trsh_bounds((0, 0, 0), (255, 255, 255))
示例11: __init__
def __init__(self):
#glutInit(sys.argv)
self.width, self.height = 1280, 800
pygame.init()
self.screen = pygame.display.set_mode((self.width, self.height), OPENGL | DOUBLEBUF)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
gluPerspective(65.0, self.width/float(self.height), 0.01, 1000.0)
glMatrixMode(GL_MODELVIEW)
glEnable(GL_DEPTH_TEST)
self.camera = Camera((0.0, 100, 0), (0.0, 0, 0))
#Base
vertices = np.array([[100.0, -10.0, 100.0, Conf.GRAPHX.BASE_COLOR[0],Conf.GRAPHX.BASE_COLOR[1],Conf.GRAPHX.BASE_COLOR[2]], \
[-100.0, -10.0, 100.0, Conf.GRAPHX.BASE_COLOR[0],Conf.GRAPHX.BASE_COLOR[1],Conf.GRAPHX.BASE_COLOR[2]], \
[-100.0, -10.0, -100.0,Conf.GRAPHX.BASE_COLOR[0],Conf.GRAPHX.BASE_COLOR[1],Conf.GRAPHX.BASE_COLOR[2]], \
[100.0, -10.0, -100.0, Conf.GRAPHX.BASE_COLOR[0],Conf.GRAPHX.BASE_COLOR[1],Conf.GRAPHX.BASE_COLOR[2]]], \
dtype=np.float32)
self.vertexPositions = vbo.VBO(vertices)
#Create the index buffer object
indices = np.array([[0,1,2], [0, 3, 2]], dtype=np.int32)
self.indexPositions = vbo.VBO(indices, target=GL_ELEMENT_ARRAY_BUFFER)
self.uniform_values = {}
self.uniform_locations = {}
示例12: init
def init(self):
self.camera = Camera(euclid.Point3(0,15, 0))
self.mainplayer_status = StatusView()
self.otherplayer_status = StatusView(is_opponent=True)
self.mana_controller = ManaController(self.mainplayer_status.manapool, self.otherplayer_status.manapool, self)
self.x_controller = XSelector(self.mainplayer_status.manapool, self.otherplayer_status.manapool, self)
self.card_selector = CardSelector(self.mainplayer_status, self.otherplayer_status, self)
#self.game_status = GameStatus()
self.phase_status = PhaseStatus()
self.phase_bar = PhaseBar()
self.phase_controller = PhaseController(self.phase_status, self)
self.status_controller = StatusController(self.mainplayer_status, self.otherplayer_status, self.phase_status, self)
self.selection = SelectionList()
self.list_selector = SelectController(self.selection, self)
self.msg_dialog = MessageDialog()
self.msg_controller = MessageController(self.msg_dialog, self)
self.table = Table()
self.mainplay = PlayView(z=3)
self.otherplay = PlayView(z=-3, is_opponent_view=True)
self.play_controller = PlayController(self.mainplay, self.otherplay, self)
self.damage_assignment = DamageSelector(self.mainplay, self.otherplay, self)
self.distribution_assignment = DistributionSelector(self.mainplay, self.otherplay, self)
self.player_hand = HandView()
self.hand_controller = HandController(self.player_hand, self)
self.otherplayer_hand = HandView(is_opponent=True)
self.otherhand_controller = HandController(self.otherplayer_hand, self)
self.stack = StackView()
self.stack_controller = StackController(self.stack, self)
self.zone_animator = ZoneAnimator(self)
self._keep_priority = False
self.finish_turn = False
self.p1_stop_next = False
self.p2_stop_next = False
示例13: __init__
def __init__(self, engine, songName = None, libraryName = DEFAULT_LIBRARY):
self.engine = engine
self.time = 0.0
self.guitar = Guitar(self.engine, editorMode = True)
self.controls = Player.Controls()
self.camera = Camera()
self.pos = 0.0
self.snapPos = 0.0
self.scrollPos = 0.0
self.scrollSpeed = 0.0
self.newNotes = None
self.newNotePos = 0.0
self.song = None
self.engine.loadSvgDrawing(self, "background", "editor.svg")
self.modified = False
self.songName = songName
self.libraryName = libraryName
self.heldFrets = set()
mainMenu = [
(_("Save Song"), self.save),
(_("Set Song Name"), self.setSongName),
(_("Set Artist Name"), self.setArtistName),
(_("Set Beats per Minute"), self.setBpm),
(_("Estimate Beats per Minute"), self.estimateBpm),
(_("Set A/V delay"), self.setAVDelay),
(_("Set Cassette Color"), self.setCassetteColor),
(_("Set Cassette Label"), self.setCassetteLabel),
(_("Editing Help"), self.help),
(_("Quit to Main Menu"), self.quit),
]
self.menu = Menu(self.engine, mainMenu)
示例14: main
def main():
global x, y, run
x = y = 0
run = True
pi = pigpio.pi()
motorx = Motor(pi,1)
motory = Motor(pi,2)
sampling_period = 0.2
control = Controller(pi, motorx, motory, sampling_period)
camera = Camera(sampling_period)
camera.start()
#control.start()
control.generate_transform()
control.target((0,0))
time.sleep(1)
#t = threading.Thread(target=read_input)
#t.start()
#obj = Identification()
try:
while True:
##### Test without the camera #####
#x = float(input("x: "))
#y = float(input("y: "))
#obj.position = (x,y)
#control.update_positions(obj, camera.laser)
############################################
control.target(camera.object.position)
time.sleep(sampling_period)
except(KeyboardInterrupt):
pass
finally:
run = False
control.stop()
camera.stop()
pi.stop()
示例15: __init__
def __init__(self, screen):
# Explicitly ask for legacy OpenGL version to keep maximum compatibility across different operating systems
fmt = QtOpenGL.QGLFormat()
fmt.setVersion(2, 1)
fmt.setProfile(QtOpenGL.QGLFormat.CoreProfile)
fmt.setSampleBuffers(True)
super(GLRenderArea, self).__init__(fmt, parent=screen)
self.setAutoFillBackground(False)
self.setFocusPolicy(QtCore.Qt.ClickFocus)
self.xRot = 0.0
self.yRot = 0.0
self.zRot = 0.0
self.xTrans = 0.0
self.yTrans = 0.0
self.zTrans = 0.0
self.lastPos = QtCore.QPoint()
self.mouseMoved = False
self.mousePickRectStart = False
self.ctrlPressed = False
self.shiftPressed = False
self.mouseRect = []
self.autoCam = False
self.ortho = False
self.camName = ''
self.cameraPos = (0, 0, -1)
self.targetPos = (0, 0, 0)
self.testVertexBuffer = []
self.testColorBuffer = []
# self.vw = 0
# self.vh = 0
self.camera = Camera()
self.screen = screen
self.programCompiled = False
self.currentFrame = 0
self.frameData = None
self.groups = []
self.selectedMarkers = set([])
self.selectedGroups = set([])
self.maskDraw = set([])
self.maskTraj = set([])
self.maskTag = set([])
self.colorDict = {}
self.timer = QtCore.QTimer(self)
self.timer.setInterval(10)
self.timer.timeout.connect(self.updateTimer)
self.timer.start()