360 Moving Regions of Interest

This example is included with SightLab. For the most up-to-date version, or if a feature described on this page is missing from your copy, download the latest version:
Overview
Regions of interest (ROIs) added in the SightLab GUI are spheres that stay in one place. Use this example when the thing you want to measure moves through a 360 video, such as a person, a vehicle or a ball, so that its ROI follows it. It also gives still objects ROIs that fit their outlines, such as a building, a tree or a path, using polygons, and outlines can change over time, for example as the camera moves past an object.
You trace each moving object once with the mouse in the 360 ROI Path Tracer, on the desktop, with no headset or eye tracker needed. During the experiment, SightLab's ROIs follow the traced paths in time with the video. Gaze, dwell time and fixations on them are recorded under each region's name, just like static ROIs, and the regions move in the Session Replay.
For setting up 360 media and adding regions that stay in place, see 360 Media.
The example uses the built-in warehouse video, with two box regions that each follow a forklift and its rider. Open it from the SightLab Dashboard under Tools/Features, where buttons run each part, or find it in ExampleScripts/360 Moving Regions of Interest.
| File | What it's for |
|---|---|
360_ROI_Path_Tracer.py |
Trace the regions on a 360 video (run this first) |
360_moving_RegionsOfInterest.py |
Run the experiment with the moving regions |
Replay.py |
Replay a session |
moving_rois/ |
The traced paths, one file per video (<video name>_regions.csv) |
moving_rois.py |
Shared code that places and moves the regions (no need to edit it) |
Workflow at a Glance
- Run the tracer (Run: 360 ROI Path Tracer in the Dashboard, or
360_ROI_Path_Tracer.py) and drag your 360 video onto the window. - Pick which trial should play the video.
- Add a region for each moving object and trace it while the video plays.
- Press P to preview the regions exactly as the experiment will show them.
- Run the experiment (360 moving RegionsOfInterest in the Dashboard, or
360_moving_RegionsOfInterest.py) and collect data as usual. - Review the session with Replay (
Replay.py).
The tracer saves your paths and adds the regions of interest to the SightLab configuration automatically. You don't need to add them in the SightLab GUI.
Instead of tracing by hand, you can also have an AI assistant create the regions. Give it a description of the objects, or a screenshot of the video with the areas of interest drawn on it. See Creating the Regions with an AI Assistant.
1. Open a Video in the Tracer
In the Dashboard, click Run: 360 ROI Path Tracer (or run 360_ROI_Path_Tracer.py). Drag a 360 video onto the window, or press O to browse.

When you open a video, the tracer sets it up for the experiment:
- Copies it into the project. A video from outside the project, such as SightLab's built-in media folder, is copied into
resources/media. The top bar shows the progress, and you can start tracing while it copies. - Detects the video format. The format comes from a SightLab configuration that already plays the video, or from the frame shape: a square frame is top/bottom stereo. Otherwise you're asked to choose Monoscopic, Stereoscopic T/B or Stereoscopic L/R. Press F to change it later.
- Asks which trial should play it. If no trial plays the video yet, choose a trial from the list. That trial's video and format are updated (and its end time, if the trial ends on Media End), and its old regions of interest are replaced by this video's regions. Choose Don't use it in the experiment yet to skip this, and press C when you're ready.
Which configuration is changed?
The tracer updates the configuration SightLab opens when it starts, usually sightlab_configs/recent_config.stlb. The top bar names it, for example Experiment: recent_config.stlb (opens on start) trial 1 plays this video. A backup copy (.bak) is saved the first time the tracer changes a configuration in each session.
2. Trace Each Moving Object

- Press N to add a region.
- Press F2 to give it a meaningful name, such as
Rider1. This name becomes the region of interest's name in SightLab, so it's what appears in your data files. - Find the object: hold the right mouse button and drag to look around. Ctrl + mouse wheel zooms the view.
- Press Space to play the video, then hold the left mouse button on the object and follow it.
- Scroll the mouse wheel to make the region grow or shrink as the object gets nearer or farther. Shift + wheel makes it taller or wider. The colored outline around the mouse shows the region's size and shape.
- Repeat for each object. Tab or the number keys switch regions.
Objects that stand still, or stop and start
A region appears at its first keyframe and stays at its last keyframe until the end of the video, so:
- An object that doesn't move: pause on the frame where it appears (press Home for the start of the video) and click it once. It's tracked for the rest of the video.
- A still scene: add a region for each area you want data for, such as each building, tree and path in a garden. Where areas touch, make their regions meet edge to edge without overlapping (see When regions overlap). Polygons fit irregular areas best.
- An object that stands still, then moves: click it while it's still, then play the video and start tracing as it starts to move. The region stays at your click until your trace begins, follows it, and stays where it stops. This works in either order, so you can also add the click after tracing the movement.
- When the object leaves the scene: press E to end the region there. If it comes back, click or trace it again.

Fast-moving objects
Press the Down arrow to slow the video to 0.5x, 0.25x or 0.1x while you trace. The path is recorded in video time, so the region still moves at the right speed in the experiment. Press Up to return to normal speed.
Fixing a path
You don't need to trace the whole video in one pass:
- Retrace part of it: play from just before the mistake and trace again. Only the time you trace over is replaced.
- Erase: hold Shift and drag while the video plays to hide the region for that time, for example while the object is behind something. Press E to end the region at the current time.
- Frame by frame: pause, step with , and ., and click to place the region on each frame. The tracer fills in the frames between your clicks. While paused, scrolling resizes the region at that frame, and Q and W tilt it.
- Undo: press Z. Backspace deletes the keyframe at the current frame, and Delete removes the selected region.
- Start over: close the tracer and delete the video's region file in
moving_rois(<video name>_regions.csv).
Region shapes and tilt
Press B to switch the selected region to the next shape: sphere, box or triangle.
- A box covers a rectangle of the view instead of a circle, which fits doors, screens, signs and vehicles better.
- A triangle points up and fills the same width and height a box of that size would. It fits warning signs, roofs, tents and sails.
- A polygon follows an outline with as many corners as it needs, such as a building, a tree trunk or a winding path, and its corners can move from one keyframe to the next (see Shapes that change over time). You can't draw polygons in the tracer. They come from the region file, usually written by an AI assistant from a screenshot with the outlines drawn on it (see Creating the Regions with an AI Assistant), or written by hand (see The Region File).
Use Shift + wheel to make any shape taller or wider, for example a tall box for a standing person. A triangle is as tall as it is wide until you change it; make it a little flatter (an aspect of about 0.87) for one with equal sides.
Press Q or W to tilt the selected region left or right, 5° per press (1° with Shift), for objects that lean or run at an angle, such as a sloping path or a tilted sign. Tilting also turns a triangle to point another way. Like the size, the tilt can change over time: while paused, it changes the region at that frame; while tracing, it applies to what you trace next.

In the tracer, a polygon region moves, resizes, stretches and tilts like the other shapes, and you can combine it with other regions. B doesn't change a polygon. Here a polygon covers the logo painted on a football field:

A box, triangle or polygon is a thin panel that always faces the participant, so it covers exactly the area you see in the tracer. 360 video has no depth, so a deeper shape would only stick out toward the participant and look bigger than the object. Gaze counts only on the shape itself: a glance at the empty corners beside a triangle isn't on the region.
A region's shape can be up to 120° across (a Radius of 60°), and a polygon can reach further, up to about 80° from the region's center, enough for a whole ceiling or floor. Gaze counts all the way to its edges, however large it is, so a big object such as a building or a lawn doesn't need to be split into several regions. What a region can't do is wrap around the participant: something that spreads around them, such as a wall that runs around behind them, needs a region for each side (see Covering the whole scene).
The SightLab GUI, the experiment and the replay all use the same shape. SightLab creates every region of interest as a sphere, so 360_moving_RegionsOfInterest.py swaps in the box, triangle, polygon or combined shape for those regions, both in the SightLab GUI and at the start of each trial, and Replay.py draws them in their shapes. Other replay scripts, such as the Group Heatmap Replay, draw any region that isn't a sphere as a flat ellipse of the same size and tilt; for a combined region, that's the size of the whole shape. To draw them in their shapes, see Using Moving Regions in Your Own Script. Gaze data is recorded under the region's name either way.
Note
The replay draws each region with the shape it has in the region file now, so choose shapes before collecting data.
Combining regions
When no single shape fits an object, build it from several shapes and combine them into one region. A forklift rider, for example, can be a sphere for the head, boxes for the vest and legs, and a tilted box for the arm on the controls. SightLab then has one region of interest for the whole rider, so gaze on any part counts toward the same dwell time, fixations and visits, under one name.
- Pause on a frame where the whole object is in view.
- Add a region for each part (N), choose its shape (B), and click it onto the object. Size and tilt it with the wheel, Shift + wheel and Q/W.
- Select the main part with Tab or a number key. The combined region keeps this part's name and path.
- Ctrl + click each of the other parts to add it to the selection (Ctrl + click it again to take it out), or Ctrl + drag a box to add every region whose center is inside it. Selected regions show their outlines, and the top bar lists them.
- Press J.

The parts become one region, drawn in one color with one outline:

The combined region:
- Keeps the main part's name and path. The other parts keep their place, size and tilt relative to it, as they were at that frame. Their own paths are dropped, and the tracer removes the regions of interest it had added for them.
- Moves and resizes as a whole. Trace it like any other region (the mouse holds the middle of the shape), scroll to resize it, use Shift + wheel to stretch it, and Q/W to tilt it. The size in the top bar is half the width of the whole shape.
- Counts gaze on any of its parts. A glance at a gap between parts isn't on the region.
The parts don't have to touch. For example, while a player crouches in front of the logo, the logo shows on both sides of him and can be one region with a polygon for each side:

You can combine before or after tracing. For an object you've already traced, pause, add the other parts at one frame and combine them with the traced part; they follow its path. Every selected region must be in the scene at the current frame; if one isn't, the top bar says which.
To change a part, select the combined region and press Shift + J to split it. Each part becomes a region of its own that follows the combined region's path. The first keeps the region's name and the others are named after it (Rider1_2, Rider1_3 and so on). The parts stay selected, so after adjusting them, press J to combine them again. B doesn't change a combined region's shape, so split it first. Z undoes a combine or a split.
Shapes that change over time
Usually a region keeps its shape, and only its position, size, stretch and tilt change from keyframe to keyframe. When the outline of an object itself changes, the region file can give each keyframe its own shape. For example:
- The camera moves. Objects near a moving camera change shape as it passes them: a path seen from one end becomes a path seen from above, and a tree's crown spreads out as the camera walks under it.
- The object changes shape, such as a door that opens, or a person walking, whose arms and legs move relative to the body.
Between two keyframes whose shapes match (the same parts in the same order, and polygons with the same number of corners), the outline changes smoothly: each corner moves, and the parts of a combined shape move, resize and turn relative to each other. Otherwise the shape changes at the second keyframe.
Like polygons, outlines that change come from the region file. They're usually written by an AI assistant, which can follow an object's outline through the video (see Creating the Regions with an AI Assistant), or written by hand (see The Region File). The experiment, the SightLab GUI and Replay.py change the shape with the video, and gaze counts on the outline as it is at that moment.
In the tracer, such a region is drawn with its outline at the current time, and the top bar shows changes over time after its shape. Here a quarterback's outline as he waits for the snap and as he drops back to pass:

You can trace, resize, tilt, erase and end it as usual; each keyframe keeps the outline it had. B and J don't apply to it, since its outline would stop changing. Shift + J splits a combined one, and each part keeps its own changes.
When the camera passes under or through an object
An object the camera passes under, over or through surrounds the participant, and a region can't wrap around them. End the region where that happens (press E, or set Visible to 0), or split the object into regions for the part ahead and the part behind.
When regions overlap
Where two regions overlap, gaze there is recorded on only one of them, and it isn't decided by which object is in front:
- A sphere almost always takes the gaze from a box, triangle, polygon or combined region.
- Of two spheres, the larger one usually takes it, so a small sphere inside a large one gets little or no gaze.
- Of two other shapes, the one whose center is nearer the gaze direction takes it.
So don't put one region inside another. Where areas touch, such as neighboring parts of a still scene, make their regions meet edge to edge. Where one object passes in front of another, trim the region behind, or hide it while they overlap (Shift + drag). The preview shows which region takes the gaze anywhere in the view.
Covering the whole scene
To put every gaze sample in a region, the regions can cover the whole 360 scene with no gaps, with regions such as a ceiling, a floor or the sky reaching straight up or down. Such a layout is usually drawn on a whole frame of the video and turned into polygons by an AI assistant (see Creating the Regions with an AI Assistant).
- Neighboring regions share their edges exactly, corner for corner, so that no gaze falls between them.
- Anything that wraps around the participant is split. A region can't spread around the participant, so a wall that runs around behind them needs a region for each side, such as
Back wall (left)andBack wall (right), and so do areas with one name on opposite sides of a room, such as two windows. Add their dwell times together in your analysis when you need the whole object. - Areas the layout leaves out get a region too, such as the sky, or become part of a neighbor, so that nothing is left over.
Building many large regions takes a moment, so with a layout like this each trial starts a second or two later.
The tracer window
- Regions: each region is drawn in the shape the experiment uses. The selected region has an outline, its name and its path, and regions also selected with Ctrl have an outline.
- Top bar:
- the video, its format, the time and the playback speed
- the selected region and its size at the current time, and any regions also selected for combining
- what's under the mouse
- where the regions were saved
- which configuration and trial play the video
- Timeline: along the bottom, one colored row per region shows when that region is in the scene. Click or drag the timeline to seek.
- Text size: the text grows with the window. Press [ and ] to change it, and F1 to show the controls.
3. Check the Regions
Press P to preview. The regions are drawn exactly where and how large the experiment will draw them. The mouse acts like the participant's gaze: the top bar shows which region it's on, using the same test SightLab uses for gaze. Play the video, and move the mouse over each object to check that its region covers it. Press P again to keep editing.

Leave a margin
Eye-tracking data is typically accurate to within about 1°. Making each region about 1° larger than its object all round catches looks at the object's edges. Don't let the margin reach a neighboring object.
Everything is saved as you work:
- The paths go to
moving_rois/<video name>_regions.csv. - The regions of interest: each trial that plays the video gets one for every traced region, with the same name. Renaming or deleting a region in the tracer updates them. Regions of interest you added by hand in the SightLab GUI are left alone, except in the trial you choose to play the video (when you open it, or with C): all of that trial's old regions of interest are replaced.
Press Escape to close the tracer when you're done.
4. Run the Experiment
In the Dashboard, click 360 moving RegionsOfInterest (or run 360_moving_RegionsOfInterest.py), and run the session as usual. In the SightLab GUI, the trial you chose plays the video and lists a region of interest for each traced region, under the names you gave them.

To preview the regions in the SightLab GUI, press Space to play the trial's video. The regions follow their paths, sized, tilted and hidden as the participant will see them. Press Space again to pause; the regions stay where they are at that point in the video. Before you first play the video, each region shows where its path starts, with box, triangle, polygon and combined regions already in their shapes.
During each trial, every region of interest whose name matches a traced region follows that region's path, timed to the video. While a region is hidden (before its first keyframe, after you end it with E, or where you erased it), it can't be gazed at.
Each trial uses the region file for the video it plays, so different trials can play different videos, each with its own regions. Open each video in the tracer and choose a different trial for it.
To hide the regions from the participant while still recording gaze on them, set SHOW_REGIONS = False at the top of 360_moving_RegionsOfInterest.py. Every region of interest then has an opacity of 0 during the session, including any without a traced path, while the SightLab GUI's preview and the replay still show them, since the opacities saved in the GUI don't change. To hide only some regions, drag each one's opacity slider (the second slider next to its name) all the way to the left in the GUI; that hides it in the GUI's preview too.
Note
A moving region's position, size and shape come from the tracer, so the size slider (the first one) and the GUI's fine-tune keys (i, j, k, l, u, o) have no effect on it in the experiment. To change them, edit the region in the tracer.
Check the trial's end condition
If the trial ends on a Timer that is shorter than the video, the regions stop when the trial ends. Use Media End as the end condition in the SightLab GUI to play the whole video.
5. Review the Data
Gaze data for the moving regions is recorded in the same files as for other regions of interest, under the names you gave them. For example, the experiment summary from one warehouse session:
| ROI/Object | Dwell Visits | Fixation Count | Total Dwell Time (secs) | Time to First Fixation (secs) |
|---|---|---|---|---|
| Rider1 | 1 | 11 | 4.42 | 3.536 |
| Rider2 | 3 | 18 | 7.007 | 7.672 |
The trial timeline (trial_timeline_dwell) lists when each dwell on each rider started and ended.
Click Replay in the Dashboard (or run Replay.py) to watch the session. The regions move as they did during the trial. Toggle them with ROIs and their names with Tags under Console.

See Session Replay for the other visualizations.
Creating the Regions with an AI Assistant
An AI coding assistant can create the regions for you, for objects that move and for objects that stay still. Describe the objects, or give it a screenshot of the video with the areas of interest drawn on it. The sample regions for the warehouse video were made this way.
The assistant must be able to work in your project folder, run code on your computer and look at images, because it finds the objects by analyzing the video's frames and checks its results by drawing the regions over them. Claude Code, GPT 6 Astra Codex Desktop and other coding agents can do this. A chat window that only takes text can't.
- Start the assistant in the example's folder (
ExampleScripts/360 Moving Regions of Interest, or your copy of it). - Optional: draw the areas. Open the video in the tracer, look at the part of the scene you want covered and take a screenshot of the window, for example with Windows + Shift + S. Outline and number each area of interest on it in any image editor, and save it outside the project folder. Show as much of the scene around the areas as you can: the assistant finds where the view is in the video by matching it. To cover the whole scene, draw the areas on a whole frame of the video instead.
- Copy the prompt below, replace the parts in angle brackets, delete the options you don't want, and send it.
- When it's done, open the video in the tracer. The tracer adds a region of interest for each region to the trial that plays the video, or asks which trial should play it.
- Press P, play the video and check that each region covers its object. Fix anything by hand as usual: retrace part of it, resize it, or press E or Z.
This folder holds SightLab's "360 Moving Regions of Interest" example. Create regions of
interest for the 360 video <resources/media/your_video.mp4> that cover these objects:
1. <Name1>: <what the region should cover, for example "the forklift on the left together
with its driver">. <Where and when it appears, for example "in view from the start, ahead
and to the left; passes close to the camera at about 7 s", or "doesn't move">.
2. <Name2>: <...>
<Optional: The objects are outlined and numbered in C:\...\aois.png, a screenshot of the
video in the 360 ROI Path Tracer. Follow those outlines.>
<Optional: Where an object carries on outside the screenshot, extend its region over the rest
of the same object.>
<Optional: The regions should cover the whole 360 scene with no gaps, following the areas drawn
on a whole frame of the video in C:\...\layout.png. Ask me about any area it leaves unlabeled.>
<Only make regions for these objects. | You can suggest other objects worth a region: ask me
before adding them.>
Requirements:
- Read moving_rois.py first. Its docstrings define the region file, its angles and sizes, and
the shapes. Write moving_rois/<video name>_regions.csv with its Region, make_key and
save_regions functions, one region per object, named exactly as above. If the region file
already has regions, ask before replacing them.
- Cover the whole object as the participant sees it, without its shadow or reflection, plus
about 1 degree around it for eye-tracker error where that doesn't reach another object.
Use whichever shape fits best: a sphere (a circle or an ellipse), a box, a triangle, a
polygon with as many corners as the outline needs, or several of these combined into one
shape (see parts() and combine() in moving_rois.py). A region's parts don't have to touch,
for an object that shows in two places. Radius is at most 60 degrees; a polygon's corners
can reach past 1 for an outline that's bigger than that, up to about 80 degrees from the
region's center.
- Where an object's outline changes, such as anything near the camera while the camera
moves, or a person walking, give its Shape at each keyframe where it changes (see Region
in moving_rois.py). Keep the same parts, and the same number of corners in the same order
around the outline, so it changes smoothly between keyframes.
- When the camera passes under, over or through an object, end its region there (Visible 0):
a region can't surround the viewer.
- Where regions overlap, the object in front doesn't decide which region gets the gaze: a
sphere almost always wins over the other shapes, the larger of two spheres usually wins,
and of two other shapes the one whose center is nearer the gaze direction wins. So don't
put one region inside another, make the regions of objects that touch meet edge to edge,
and where one object is in front of another, trim the region behind.
- If the regions should cover the whole scene, give neighboring regions exactly the same
corners along the edges they share, so that every direction is in exactly one region.
A region can't wrap around the viewer: split anything that spreads around them, such as a
wall that runs around behind them, into a region for each side, and tell me which you split.
Check by casting rays in every direction, not just around each region.
- First find out what moves, including the camera, by comparing frames from across the
video. An object that doesn't move needs one keyframe, when it first appears. While an
object moves, add a keyframe about every 0.1 s. Set Visible to 0 while it's out of the
scene. While it's hidden behind something that has no region, keep its region on it.
- The video is <Monoscopic | Stereoscopic T/B>. For a stereo video, use the left eye (the top
half). In the region file, azimuth 0 is the left edge of the frame and increases to the
right (azimuth = 360 x column / width), so the middle of the frame is 180, and elevation
runs from 90 at the top of the eye's image to -90 at the bottom. Check this against a frame
before relying on it.
- If there's a screenshot, find exactly where its view is in the video, for example by
matching it against perspective views rendered from a frame. Don't assume its pixels map
straight onto the frame. A polygon's corners lie on the plane that touches the 360 sphere at
the region's center, so an edge that's straight in the screenshot stays straight in the
region.
- Use Vizard's Python (C:\Program Files\WorldViz\Vizard8\bin\python.exe), run with -B so that
importing moving_rois.py doesn't write a __pycache__ folder into the project. Install
OpenCV for it if it's missing. Keep your own scripts and images out of the project folder,
and don't change any file except the region file.
- Check your work by looking at it: draw the regions over frames of the video at many times,
and over the screenshot if there is one, including between keyframes and whenever objects
move fast, pass close to the camera or pass in front of each other. Then check where gaze
lands, the way the experiment tests it: in a script run with Vizard
(C:\Program Files\WorldViz\Vizard8\bin\winviz.exe, with sys.dont_write_bytecode = True),
build the regions with add_shape() and place() from moving_rois.py as MovingRegions does
(with morph and shape_parts for a shape that changes), cast rays with viz.intersect() from
the center of the 360 sphere (see sphere_frame()) across each region and around it, at
many times, and confirm that the directions on each object hit its region and no other.
Fix anything that's wrong, then list the regions you made and tell me where you saved a few
of those images.
Tips: if the camera doesn't move, comparing each frame with an empty background (put together
from times when each object is somewhere else) finds moving objects well. Trace objects that
never move on one sharp frame. If the camera moves, following image features inside each
outline from frame to frame tracks how its shape changes. Keep each region from jumping
between frames.
For the warehouse video, the objects were described like this:
1. Rider1: the forklift that starts ahead and to the left, together with its driver. It drives
toward the camera, passes close by it at about 7-8 s, then drives away behind the camera,
to the right.
2. Rider2: the forklift that starts far away, ahead and to the right, together with its driver.
It waits there until about 9 s, then turns and passes in front of the camera from right
to left.
For the parts of a football field that don't move, the areas were outlined and numbered on a screenshot from the tracer:

and described like this:
1. Goal post, 2. Banner, 3. Stadium, 4. Trees. None of them move.
The objects are outlined and numbered in field_aois.png, a screenshot of the video in the
360 ROI Path Tracer. Follow those outlines. Only make regions for these objects.
The assistant made a polygon for each area, following the outlines. Here are the regions in the tracer's preview, from the same view, with the mouse on the banner:

Getting good results
- Describe each object so it can't be mistaken for another: what it looks like, where it starts (ahead, left, right or behind), and roughly when it moves or comes close.
- Say what the region should include, such as "the forklift and its driver" or "only the person's head".
- For a still scene, draw the areas. An outline is clearer than a description, and it sets exactly where one area ends and the next begins.
- Draw the areas on the video you're making regions for. Areas drawn on another video don't carry over, even another video of the same place taken from nearby: near objects look different from another spot, and the lighting usually differs.
- Say how far the assistant may go beyond what you gave it: whether to extend regions past the screenshot, and whether to add regions for other objects.
- Expect it to take a while. The assistant tries an approach, looks at the results and refines them, especially where objects pass close to the camera or behind each other.
- A camera that doesn't move is easiest. With a moving camera, such as one carried or mounted on a vehicle, objects change shape as the camera passes them, so ask for outlines that change over time (see Shapes that change over time). Expect it to take longer, and expect regions to end where the camera passes under or through an object.
- Always check the result in the tracer before collecting data. The regions are saved in the same file the tracer uses, so you can fix them by hand.
Controls
| Action | Control |
|---|---|
| Open a video | Drag it onto the window, or O |
| Trace the selected region | Hold the left mouse button while the video plays |
| Set a keyframe at this frame | Click while paused |
| Erase (hide the region while held) | Shift + left drag |
| Region size | Mouse wheel |
| Taller / wider | Shift + mouse wheel |
| Look around | Right mouse button + drag |
| Zoom the view | Ctrl + mouse wheel, or - and = |
| Seek | Click or drag the timeline |
| Play / pause | Space |
| Back / forward 1 s (Shift: 5 s) | Left / Right |
| Previous / next frame | , / . |
| Playback speed | Up / Down |
| Go to start | Home |
| New region | N |
| Select region | Tab, 1–9 |
| Look at the selected region | G |
| Shape: sphere, box or triangle | B |
| Select another region (or take it out) | Ctrl + click |
| Select the regions in a box | Ctrl + left drag |
| Combine the selected regions into one | J |
| Split a combined region | Shift + J |
| Tilt left / right (Shift: 1°) | Q / W |
| Rename region | F2 |
| End the region here | E, or Shift + click while paused |
| Delete the keyframe at this frame | Backspace |
| Delete the selected region | Delete |
| Undo | Z |
| Preview as the experiment shows it | P |
| Show / hide paths | V |
| Use this video in the experiment (choose a trial) | C |
| Change the video format | F |
| Smaller / larger text | [ / ] |
| Show / hide the controls | F1 |
| Close the tracer | Escape |
Tracer Settings
These are at the top of 360_ROI_Path_Tracer.py:
| Setting | Default | What it does |
|---|---|---|
MEDIA_FILE |
None |
A video to open on start, for example 'resources/media/01_Warehouse.avi' |
MEDIA_FOLDER |
resources/media |
Where videos from outside the project are copied |
CONFIG_FOLDER |
sightlab_configs |
Where the SightLab configurations are |
SAMPLE_INTERVAL |
0.1 |
Seconds of video between traced keyframes |
EDIT_ALPHA / PREVIEW_ALPHA |
0.3 / 0.5 |
Region opacity while editing and in preview |
START_FOV |
80 |
Starting field of view, in degrees |
WINDOW_SIZE |
0.75 |
Window size as a fraction of the screen (None for Vizard's default) |
TEXT_SCALE |
1.0 |
Text size (it also grows with the window) |
The Region File
Each video's paths are saved in moving_rois/<video name>_regions.csv, one row per keyframe. You can open it in Excel, but close it before tracing again, or the tracer can't save.
| Column | Meaning |
|---|---|
Region |
Region name (matches the region of interest name in SightLab) |
Time |
Seconds into the video |
Azimuth |
Degrees around from the left edge of the video frame, increasing to the right (azimuth = 360 × column ÷ width), so the middle of the frame is 180 |
Elevation |
Degrees above or below the horizon (positive is up) |
Radius |
Size of the region, in degrees of visual angle from its center to its edge (half its width) |
Aspect |
Height divided by width (1 is a circle, a square, or a triangle as tall as it is wide) |
Roll |
Tilt in degrees as the participant sees it, positive is clockwise (files without this column have no tilt) |
Visible |
1 shows the region; 0 hides it until the next keyframe |
Shape |
sphere, box or triangle, a polygon, or the parts of a combined region: the region's shape from this keyframe on. Blank keeps the shape of the row before (files without this column use spheres) |
A combined region's Shape lists its parts joined by +, each as shape x y size aspect roll, for example box 0.0000 -0.3000 0.5000 1.500 0.0 + sphere 0.0000 0.7000 0.2500 1.000 0.0. x and y place the part's center (right and up) and size sets its size, all in units of the region's Radius; aspect and roll are the part's own. The region's Radius is half the width of the whole shape when it was combined, and its Aspect and Roll (1 and 0 when combined) stretch and tilt the whole shape.
A polygon is written like a part, followed by its corners in square brackets: poly x y size aspect roll [x1 y1 x2 y2 x3 y3 ...]. List at least three corners, in order around the outline, with edges that don't cross. Each corner is right and up from the polygon's center, in units of its size, as a box's corners would be at -1 and 1. For example, the first Shape below is one polygon in an L shape, and the second is a triangular polygon combined with a sphere:
poly 0.0000 0.0000 1.0000 1.000 0.0 [-1.0000 -1.0000 1.0000 -1.0000 1.0000 -0.2000 -0.2000 -0.2000 -0.2000 1.0000 -1.0000 1.0000]
poly 0.0000 -0.3000 0.7000 1.000 0.0 [-1.0000 -1.0000 1.0000 -1.0000 0.0000 1.0000] + sphere 0.0000 0.7000 0.3000 1.000 0.0
All positions are on the flat plane that touches the 360 sphere at the region's center, where one unit is the tangent of the region's Radius. That's the plane of a perspective view looking straight at the region, such as the tracer's view, so an edge that's straight in a screenshot of the tracer is straight in the region too. Radius is at most 60°; a polygon's corners can reach past 1 for an outline that's bigger than that, up to about 80° from the region's center.
The tracer writes a region's Shape on every row, but you only need to give it on the first row and wherever it changes (see Shapes that change over time). For example, this sign is square until 2 s, then narrows on its right side by 3 s, as it would when the camera moves past it, and stays that way:
Region,Time,Azimuth,Elevation,Radius,Aspect,Roll,Visible,Shape
Sign,0.000,95.00,2.00,6.00,1.000,0.0,1,poly 0 0 1 1 0 [-1 -1 1 -1 1 1 -1 1]
Sign,2.000,95.00,2.00,6.00,1.000,0.0,1,
Sign,3.000,92.00,2.00,6.50,1.000,0.0,1,poly 0 0 1 1 0 [-1 -1 1 -0.6 1 0.6 -1 1]
Between 2 and 3 s, the right-hand corners move smoothly from one shape to the other, since both shapes are one polygon with four corners. Shapes that don't match (other parts, or another number of corners) change at the keyframe instead.
A region appears at its first keyframe and stays at its last keyframe until the end of the video, unless a keyframe with Visible set to 0 hides it. Between keyframes, the region moves smoothly along the sphere and its size changes gradually. During the experiment, the region moves between any two visible keyframes, however far apart they are. When you trace a stretch that starts more than half a second after the keyframe before it, the tracer adds a keyframe that holds the region at that earlier keyframe until the stretch starts. A region file written by hand or by an AI assistant doesn't get that extra keyframe: to keep a region still and then move it, repeat the still position in a keyframe just before the object starts to move. A region that never moves needs only one keyframe, at the time it first appears (0 for the whole video). Because positions and sizes are angles, a region covers the same part of the video wherever the participant's head is.
A Shape that can't be read, for example a polygon with fewer than three corners or a missing bracket, is treated as blank, so the region keeps the shape before it, and the console names the region and the first time it happens. A region with no Shape that can be read is a sphere.
Using Moving Regions in Your Own Script
To add moving regions to another 360 experiment, copy moving_rois.py and the moving_rois folder into your project. Then start and stop the regions with each trial:
import sightlab_utils.sightlab as sl
from sightlab_utils.settings import *
import moving_rois
sightlab = sl.SightLab()
regions = moving_rois.MovingRegions(sightlab, show=True)
def sightLabExperiment():
yield viztask.waitEvent(EXPERIMENT_START)
for trial in range(sightlab.getTrialCount()):
yield viztask.waitEvent(TRIAL_START)
regions.start()
yield viztask.waitEvent(TRIAL_END)
regions.stop()
sightlab.getMediaObject().pause()
viztask.schedule(sightlab.runExperiment)
viztask.schedule(sightLabExperiment)
Each trial loads the region file for the video it plays, so trials with different videos each get their own regions. MovingRegions also previews the regions in the SightLab GUI (see Run the Experiment), with no extra code.
If any regions aren't spheres (boxes, triangles, polygons or combined regions), or their shapes change over time, add this to your replay script so the replay draws them in their shapes. It finds each trial's region file from the video the trial played, so the replay script doesn't have to be in the project folder:
import moving_rois
replay = Replay.SightLabReplay()
moving_rois.show_shapes_in_replay(replay)
Objects with Complex Shapes
A region covers a circle, an ellipse, a square, a rectangle, a triangle or a polygon of the view, or a combination of them. Most objects fit closely enough:
- Stretch the shape: Shift + wheel makes a sphere into an ellipse, a box into a rectangle, or a triangle taller or flatter, such as a tall box for a standing person or a wide one for a car.
- Tilt the shape: Q and W turn it to match an object that leans or runs at an angle, such as a sloping path, or to point a triangle another way.
- Change the size and tilt over time: scroll or tilt while tracing, or pause and adjust at any frame, as the object turns or changes size.
- Combine shapes: build the object from several shapes and press J to make them one region, such as a sphere for a rider's head and boxes for the body (see Combining regions).
- Use a polygon: for an outline that no simple shape fits, such as a building, a tree or a winding path. Polygons come from the region file, usually written by an AI assistant (see Creating the Regions with an AI Assistant).
- Change the outline over time: for an object whose outline changes, such as something the camera moves past or a person walking, the region file can give each keyframe its own shape (see Shapes that change over time).
- Keep the parts as separate regions: if you want data for each part, trace a region for each, for example
Rider1_bodyandRider1_head, and add their dwell times together in your analysis when you need the whole object. Visits don't add up the same way: a look that moves from one part to the other counts as a visit to each.
In 3D model scenes, a region of interest can be any shape, since you can tag any object or draw a region in Inspector.
Troubleshooting
- A region doesn't move during the experiment. Check the console for
[moving_rois]messages. Region "X" has no region of interest with that name means the trial playing that video has no region of interest called X. Open the video in the tracer and press C, or add one with that name in the SightLab GUI. - The regions don't line up with the video. Check the video format in the tracer's top bar, and press F to change it. A top/bottom stereo video opened as Monoscopic shows the two eye images stacked, and regions traced that way won't match the experiment.
- The playback speed doesn't change. Videos wider than 4K use a different player that only plays at normal speed. Trace frame by frame instead.
- "NOT SAVED" in the top bar. The region file is open in another program, such as Excel. Close it and make another edit to save.
- Stereo video in the tracer. The tracer shows the left eye's image on the desktop. Regions apply to both eyes in the headset.
- A region has the wrong shape, or is a sphere. A
Shapein the region file couldn't be read, so the region kept the shape before it, or is a sphere if it had none. The console names the region and the time. Check the format in The Region File. - A region's shape doesn't change in the experiment, although its file gives it a new
Shapeat later keyframes. Earlier versions of this example use one shape for the whole video. Download the latest version and replacemoving_rois.pyand360_ROI_Path_Tracer.pyin your project. - A large region shows only partly in the SightLab GUI or the replay, although gaze is recorded all over it. Earlier versions of this example only drew a region there within about 30° of its center. Download the latest version and replace
moving_rois.pyin your project. - A trial with very large regions, such as a ceiling or a floor, takes a long time to start, or Vizard stops responding. Earlier versions of this example built very detailed shapes for regions that reach far from their center. Download the latest version and replace
moving_rois.pyin your project. - Gaze isn't recorded near the edges of a large box, triangle or combined region. Earlier versions of this example only counted gaze within about 28° of a region's center. Download the latest version and replace
moving_rois.pyand360_ROI_Path_Tracer.pyin your project. Your region files work unchanged.
Earlier versions of this example
Earlier versions recorded keyframes by pressing keys 1–9 in a replay of an eye-tracking session (360_moving_RegionsOfInterest_Tagging.py and moving_regions.csv), with a separate multiple_moving_regions folder for more than one region. The Path Tracer replaces all of these. Trace the regions again in the tracer.