Video text overlay demo


This tutorial demonstrates how to use the LOAD(OVERLAY_TEXT,"#,#:text_displayed_on_screen") command to display text, both on videos and the Live Feed screen, during your experiments. This can be useful to see the moment when a stimulus occurs that would not be seen on the video (e.g., vibration, sound, light) or to note the experiment's interval (e.g., probe).

Top

Overlay text example script


ACTION MAIN 
 
LOAD(OVERLAY_TEXT,"1,2:Light") 
SET(GPO6,1) 
SET(GPO7,1) 
SET(GPO8,1) 
WAIT(3) 
 
LOAD(OVERLAY_TEXT,"1,2:Dark ") 
SET(GPO6,0) 
SET(GPO7,0) 
SET(GPO8,0) 
WAIT(3) 
 
LOAD(OVERLAY_TEXT,"1,2:Light") 
SET(GPO6,1) 
SET(GPO7,1) 
SET(GPO8,1) 
WAIT(3) 
 
LOAD(OVERLAY_TEXT,"1,25:Vibration") 
MOTORCOMMAND("U0 D2000 M1 M-1 M1 M-1 M1 M-1 M1 M-1 M1 M-1 M1 M-1 M1 M-1 M1 M-1") 
WAIT(1) 
 
LOAD(OVERLAY_CLEAR,"") 
 
LOAD(OVERLAY_TEXT,"1,2:Light")
LOAD(OVERLAY_TEXT,"16,2:Blue") 
SET(GPO6,0) 
SET(GPO7,0) 
SET(GPO8,1) 
WAIT(3) 
 
COMPLETE

LOAD(OVERLAY_TEXT,"#,#:text_displayed_on_screen"): Displays a text string at specified row and column where, of the two comma-separated values, the first refers to row and the second to column. Both rows and columns are numbered starting from 1.

LOAD(OVERLAY_CLEAR,""): Clears all previously loaded text.

  • 640x480 images comprise 15 rows x 40 columns
  • 720x540 images comprise 16 rows x 45 columns
  • 1440x1080 images comprise 33 rows x 90 columns

Overwriting previously displayed text

To overwrite a previously displayed text string, run the command again using the same row and column numbers. If there are fewer characters in the new string, use additional spaces to overwrite the end of the previous string. For example, the text "Light" was loaded in the example script above. To replace this with the text "Dark", place one additional space at the end: LOAD(OVERLAY_TEXT,"1,2:Dark ").


Displaying multiple pieces of information simultaneously

Loading multiple overlay commands together allows text to be placed in multiple positions on screen simultaneously. More than one text string can appear on each row or column. In the example script, the text strings "Light" and "Vibration" are displayed on the same row when both stimuli occur together (i.e., row 1, columns 2 and 25). The text "Light" and "Blue" are then displayed together in the same column (i.e., rows 1 and 16, column 2).

Top

Script download

To download the text_overlay demo script as a .zs file (file type Zantiks software reads), choose the Save File As option in the right-click dialogue box. Clicking on the script name hyperlink will open a read-only version of the script.

Script download: text_overlay_demo.zs