stimuli.visuals.Cross¶
- class stimuli.visuals.Cross(window_name='Visual', window_size=None)¶
Class to display a cross, e.g. a fixation cross.
- Parameters:
Attributes
Background color in BGR color space.
Image array.
Window's center position.
Window's name.
Window's size (width x height).
Methods
close
()Close the visual.
draw_background
(color)Draw a uniform single color background.
putCross
(length, thickness, color[, position])Draw a cross composed of 2 rectangles.
show
([wait])Show the visual with
cv2.imshow()
andcv2.waitKey()
.- close()¶
Close the visual.
- draw_background(color)¶
Draw a uniform single color background.
Replace all the pixels with this color, thus this method erases any prior work.
Notes
A color is provided as matplotlib string or as
(B, G, R)
tuple of int8 set between 0 and 255.
- putCross(length, thickness, color, position='centered')¶
Draw a cross composed of 2 rectangles.
The rectangles are defined by length and thickness. The rectangles are positioned to form a cross.
- Parameters:
Notes
A color is provided as matplotlib string or as
(B, G, R)
tuple of int8 set between 0 and 255. The position of the object can be either defined as the string ‘center’ or ‘centered’ to position the object in the center of the window; or as a 2-length tuple of positive integer. The position is defined in pixels in opencv coordinates, with (0, 0) being the top left corner of the window.
- show(wait=1)¶
Show the visual with
cv2.imshow()
andcv2.waitKey()
.- Parameters:
- wait
int
Wait timer passed to
cv2.waitKey()
[ms].
- wait
- property background¶
Background color in BGR color space.
- property img¶
Image array.
- property window_center¶
Window’s center position.
- property window_name¶
Window’s name.
- property window_size¶
Window’s size (width x height).