video699.screen.annotated

This module implements a screen detector that uses XML human annotations, and related classes.

Module Contents

video699.screen.annotated.LOGGER
video699.screen.annotated.RESOURCES_PATHNAME
video699.screen.annotated.DATASET_PATHNAME
video699.screen.annotated.CAMERA_ANNOTATIONS
video699.screen.annotated.SCREEN_ANNOTATIONS
video699.screen.annotated._init_dataset()

Reads human annotations from an XML dataset, converts them into objects and sorts them.

video699.screen.annotated._assert_key_exists(institution_id, room_id, camera_id)

Asserts that annotations exist for a given camcoder in a given room at a given institution.

video699.screen.annotated.institution_id

str – A institution identifier. The identifier is unique in the dataset.

video699.screen.annotated.room_id

str – A room identifier. The identifier is unique in the institution.

video699.screen.annotated.camera_id

str – A camcoder identifier. The identifier is unique in the room.

Raises:AssertionError – If no annotations exist for the given camcoder in the given room at the given institution.
class video699.screen.annotated._CameraAnnotations(camera_id, name, width, height)

Bases: object

Human annotations associated with a single camcoder.

Parameters:
  • camera_id (str) – An identifier of a camcoder in a room. The identifier is unique in the room.
  • name (str) – A name of the camcoder.
  • width (int) – The width of the captured video in pixels.
  • height (int) – The height of the captured video in pixels.
camera_id

str – An identifier of a camcoder in a room. The identifier is unique in the room.

name

str – A name of the camcoder.

width

int – The width of the captured video in pixels.

height

int – The height of the captured video in pixels.

class video699.screen.annotated._ScreenAnnotations(screen_id, name, positions, installed_from=None, installed_until=None)

Bases: object

Human annotations associated with a single projection screen.

Parameters:
  • screen_id (str) – An identifier of a projection screen in a room. The identifier is unique in the room.
  • name (str) – A description of the projection screen.
  • positions (dict of (str, sequence of _ScreenPosition)) – A map between camcoder identifiers, and human-annotated positions of the projection screen in a room at various dates, and times. The positions are sorted by dates, and times in ascending order.
  • installed_from (datetime or None, optional) – The date, and time that marks the screen’s installation. If None, or unspecified, then the screen is assumed to be installed at the earliest date and time for which the position of the projection screen is known.
  • installed_until (datetime or None, optional) – The date, and time that marks the screen’s removal. If None, or unspecified, then the screen is assumed to be present at any point since the date, and time specified by the (possibly inferred) installed_from attribute.
screen_id

str – An identifier of a projection screen in a room. The identifier is unique in the room.

name

str – A description of the projection screen.

positions

dict of (str, sequence of _ScreenPosition) – A map between camcoder identifiers, and human-annotated positions of the projection screen in a room at various dates, and times. The positions are sorted by dates, and times in ascending order.

installed_from

datetime or None – The date, and time that marks the screen’s installation. None if and only if no human-annotated positions exist.

installed_until

datetime or None – The date, and time that marks the screen’s removal. If None, then the screen is assumed to be present at any point since the date, and time specified by the (possibly inferred) installed_from attribute.

class video699.screen.annotated._ScreenPosition(coordinates, datetime)

Bases: object

A human-annotated position of a projection screen in a room at a given date, and time.

Parameters:
  • coordinates (ConvexQuadrangleABC) – A map between frame and screen coordinates.
  • datetime (aware datetime) – The human annotation certifies that at this date, and time, the lit projection screen was located at the given coordinates.
coordinates

ConvexQuadrangleABC – A map between frame and screen coordinates.

datetime

aware datetime – The human annotation certifies that at this date, and time, the lit projection screen was located at the given coordinates.

__eq__(self, other)
__lt__(self, other)
class video699.screen.annotated.AnnotatedScreenVideo(institution_id, room_id, camera_id, datetime, fps=1)

Bases: video699.interface.VideoABC

A video containing a single frame at a given date, and time.

Notes

It is possible to repeatedly iterate over all video frames. The width, and the height of the video are extracted from XML human annotations. This is a stub class intended for testing.

Parameters:
  • institution_id (str) – An identifier of the institution where the video was captured.
  • room_id (str) – An identifier of the room where the video was captured.
  • camera_id (str) – An identifier of the camcoder that was used to capture the video.
  • datetime (aware datetime) – The date, and time at which the video was captured.
  • fps (int, optional) – The framerate of the video in frames per second.
fps

int – The framerate of the video in frames per second.

width

int – The width of the video.

height

int – The height of the video.

duration

timedelta – The elapsed time since the beginning of the video.

datetime

aware datetime – The date, and time at which the video was captured.

uri

string – An IRI, as defined in RFC3987, that uniquely indentifies the video over the entire lifetime of a program.

_num_videos = 0
fps
width
height
datetime
uri
__iter__(self)
class video699.screen.annotated.AnnotatedScreen(screen_id, name, datetime, frame, coordinates)

Bases: video699.interface.ScreenABC

A projection screen extracted from XML human annotations.

Parameters:
  • screen_id (str) – An identifier of a projection screen in a room. The identifier is unique in the room.
  • name (str) – A description of the projection screen.
  • datetime (aware datetime) – The human annotation certifies that at this date, and time, this projection screen was located at the given coordinates.
  • frame (FrameABC) – A video frame containing the projection screen.
  • coordinates (ConvexQuadrangleABC) – A map between frame and screen coordinates.
screen_id

str – An identifier of a projection screen in a room. The identifier is unique in the room.

name

str – A description of the projection screen.

datetime

aware datetime – The human annotation certifies that at this date, and time, this projection screen was located at the given coordinates.

frame

FrameABC – A video frame containing the projection screen.

coordinates

ConvexQuadrangleABC – A map between frame and screen coordinates.

image

array_like – The image data of the frame as an OpenCV CV_8UC3 RGBA matrix, where the alpha channel (A) is currently unused and all pixels are fully opaque, i.e. they have the maximum alpha of 255.

width

int – The width of the image data.

height

int – The height of the image data.

frame
coordinates
class video699.screen.annotated.AnnotatedScreenDetector(institution_id, room_id, camera_id)

Bases: video699.interface.ScreenDetectorABC

A screen detector that maps a video frame to screens using XML human annotations.

Parameters:
  • institution_id (str) – An identifier of the institution where the video was captured.
  • room_id (str) – An identifier of the room where the video was captured.
  • camera_id (str) – An identifier of the camcoder that was used to capture the video.
institution_id

str – An identifier of the institution where the video was captured.

room_id

str – An identifier of the room where the video was captured.

camera_id

str – An identifier of the camcoder that was used to capture the video.

detect(self, frame)

Converts a frame to screens using the closest available human annotations.

Parameters:frame (FrameABC) – A frame of a video.
Returns:screens – An iterable of detected lit projection screens.
Return type:iterable of AnnotatedScreen