psychopy.visual.windowwarp
- warping to spherical, cylindrical, or other projections¶
Copyright (C) 2014 Allen Institute for Brain Science
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License Version 3 as published by the Free Software Foundation on 29 June 2007. This program is distributed WITHOUT WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR ANY OTHER WARRANTY, EXPRESSED OR IMPLIED. See the GNU General Public License Version 3 for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/
Warper
¶
- class psychopy.visual.windowwarp.Warper(win, warp=None, warpfile=None, warpGridsize=300, eyepoint=(0.5, 0.5), flipHorizontal=False, flipVertical=False)[source]¶
Class to perform warps.
Supports spherical, cylindrical, warpfile, or None (disabled) warps
Warping is a final operation which can be optionally performed on each frame just before transmission to the display. It is useful for perspective correction when the eye to monitor distance is small (say, under 50 cm), or when projecting to domes or other non-planar surfaces.
These attributes define the projection and can be altered dynamically using the changeProjection() method.
- Parameters:
win : Handle to the window.
- warp‘spherical’, ‘cylindrical, ‘warpfile’ or None
This table gives the main properties of each projection
Warp
eyepoint modifies warp
verticals parallel
horizontals parallel
perspective correct
spherical
y
n
n
y
cylindrical
y
y
n
n
warpfile
n
?
?
?
None
n
y
y
n
- warpfileNone or filename containing Blender and Paul Bourke
compatible warp definition. (see http://paulbourke.net/dome/warpingfisheye/)
- warpGridsize300
Defines the resolution of the warp in both X and Y when not using a warpfile. Typical values would be 64-300 trading off tolerance for jaggies for speed.
- eyepoint[0.5, 0.5] center of the screen
Position of the eye in X and Y as a fraction of the normalized screen width and height. [0,0] is the bottom left of the screen. [1,1] is the top right of the screen.
- flipHorizontal: True or False
Flip the entire output horizontally. Useful for back projection scenarious.
- flipVertical: True or False
Flip the entire output vertically. useful if projector is flipped upside down.
- Notes:
- The eye distance from the screen is initialized from the
monitor definition.
- The eye distance can be altered dynamically by changing
‘warper.dist_cm’ and then calling changeProjection().
Example usage to create a spherical projection:
from psychopy.visual.windowwarp import Warper win = Window(monitor='testMonitor', screen=1, fullscr=True, useFBO = True) warper = Warper(win, warp='spherical', warpfile = "", warpGridsize = 128, eyepoint = [0.5, 0.5], flipHorizontal = False, flipVertical = False)
- changeProjection(warp, warpfile=None, eyepoint=(0.5, 0.5), flipHorizontal=False, flipVertical=False)[source]¶
Allows changing the warp method on the fly. Uses the same parameter definitions as constructor.