video699.event.screen

This module defines events describing the detection of the appearance and the disappearance of projection screens showing document pages, and the detection of changes in the screen coordinates and content. Related classes are also defined.

Module Contents

video699.event.screen.LOGGER
class video699.event.screen.ScreenEventABC

Bases: video699.event.frame.FrameEventABC

An event related to a projection screen shown in a video frame.

Notes

Other screen events MUST NOT take place in the same frame as a ScreenAppearedEvent event.

frame

FrameABC – A frame in which the event takes place.

screen

ScreenABC – A projection screen shown in a video frame.

screen_id

str – A screen identifier.

frame
screen
screen_id
__repr__(self)
class video699.event.screen.ScreenAppearedEvent(screen, screen_id, page)

Bases: video699.event.screen.ScreenEventABC

The appearance of a projection screen containing a document page.

Parameters:
  • screen (ScreenABC) – A detected projection screen containing a document page.
  • screen_id (string) – A screen identifier unique among the ScreenAppearedEvent events produced by an event detector.
  • page (PageABC) – The document page.
frame

FrameABC – A frame in which the event takes place.

screen

ScreenABC – A detected projection screen containing a document page.

screen_id

str – A screen identifier unique among the ScreenAppearedEvent events produced by an event detector.

page

PageABC – The document page.

screen
screen_id
write_xml(self, xf)
class video699.event.screen.ScreenChangedContentEvent(screen, screen_id, page)

Bases: video699.event.screen.ScreenEventABC

A change of the document page shown in a projection screen.

Parameters:
  • screen (ScreenABC) – A projection screen, which now shows a different document page.
  • screen_id (string) – A screen identifier that MUST have appeared in an earlier ScreenAppearedEvent event produced by an event detector.
  • page (PageABC) – The different document page.
frame

FrameABC – A frame in which the event takes place.

screen

ScreenABC – A projection screen, which now shows a different document page.

screen_id

string – A screen identifier that MUST have appeared in an earlier ScreenAppearedEvent event produced by an event detector,

page

PageABC – The different document page.

screen
screen_id
write_xml(self, xf)
class video699.event.screen.ScreenMovedEvent(screen, screen_id)

Bases: video699.event.screen.ScreenEventABC

A change in the coordinates of a projection screen.

Parameters:
  • screen (ScreenABC) – A projection screen, which now appears at different coordinates.
  • screen_id (string) – A screen identifier that MUST have appeared in an earlier ScreenAppearedEvent event produced by an event detector.
frame

FrameABC – A frame in which the event takes place.

screen

ScreenABC – A projection screen, which now appears at different coordinates.

screen_id

string – A screen identifier that MUST have appeared in an earlier ScreenAppearedEvent event produced by an event detector.

screen
screen_id
write_xml(self, xf)
class video699.event.screen.ScreenDisappearedEvent(frame, screen, screen_id)

Bases: video699.event.screen.ScreenEventABC

The disappearance of a projection screen.

Notes

Other screen events MUST NOT take place in the same frame as a ScreenDisappearedEvent event. For every ScreenAppearedEvent event, a ScreenDisappearedEvent event with the same screen identifier MAY be produced by an event detector.

Parameters:
  • frame (FrameABC) – A frame in which the event takes place.
  • screen (ScreenABC) – A disappeared projection screen.
  • screen_id (str) – A screen identifier unique among the ScreenDisappearedEvent events produced by an event detector. The identifier MUST have appeared in an earlier ScreenAppearedEvent produced by an event detector.
frame

FrameABC – A frame in which the event takes place.

screen

ScreenABC – A disappeared projection screen.

screen_id

string – A screen identifier unique among the ScreenDisappearedEvent events produced by an event detector. The identifier MUST have appeared in an earlier ScreenAppearedEvent produced by an event detector.

frame
screen
screen_id
write_xml(self, xf)
class video699.event.screen.ScreenEventDetectorScreen(frame, coordinates)

Bases: video699.interface.ScreenABC

A projection screen shown in a frame of a ScreenEventDetectorVideo video.

Notes

This is a stub class intended for testing.

Parameters:
  • frame (FrameABC) – A video frame containing the projection screen.
  • coordinates (ConvexQuadrangleABC) – A map between frame and screen 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 projection screen as an OpenCV CV_8UC3 RGBA matrix, where the alpha channel (A) denotes the weight of a pixel. Fully transparent pixels, i.e. pixels with zero alpha, SHOULD be completely disregarded in subsequent computation.

width

int – The width of the image data.

height

int – The height of the image data.

frame
coordinates
class video699.event.screen.ScreenEventDetectorVideo(fps, width, height, datetime, quadrangles, pages)

Bases: video699.interface.VideoABC

A video whose frames show a projection screen that changes coordinates and content.

Notes

It is possible to repeatedly iterate over all video frames. This is a stub class intended for testing.

Parameters:
  • fps (scalar) – 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.
  • quadrangles (sequence of ConvexQuadrangleABC) – The projection screen coordinates in the consecutive frames of the video.
  • pages (sequence of PageABC) – The document pages shown in the projection screen in the consecutive frames of the video.
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.

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.

screens

dict of (FrameABC, ScreenABC) – A map between video frames, and the projection screens shown in the frames.

pages

dict of (ScreenABC, PageABC) – A map between projection screens, and the document pages shown in the screens.

_num_videos = 0
fps
width
height
datetime
uri
__iter__(self)
class video699.event.screen.ScreenEventDetectorScreenDetector

Bases: video699.interface.ScreenDetectorABC

A detector of screens in the frames of a ScreenEventDetectorVideo video.

Notes

This is a stub class intended for testing.

detect(self, frame)
class video699.event.screen.ScreenEventDetectorPageDetector

Bases: video699.interface.PageDetectorABC

A detector of pages in the screens shown in ScreenEventDetectorVideo video frames.

Notes

This is a stub class intended for testing.

detect(self, frame, appeared_screens, existing_screens, disappeared_screens)
class video699.event.screen.ScreenEventDetectorABC

Bases: video699.interface.EventDetectorABC

An abstract detector that detects screen events in a video.

video

VideoABC – The video in which the events are detected.

__iter__(self)

Produces an iterator of all screen events detected in a video.

Returns:frames – An iterable of screen events.
Return type:iterator of ScreenEventABC
class video699.event.screen.ScreenEventDetector(video, quadrangle_tracker, screen_detector, page_detector)

Bases: video699.event.screen.ScreenEventDetectorABC

A detector that detects screen events in a video.

In each frame of a video, screens are detected using a provided screen detector. The detected screens are tracked over time using a provided convex quadrangle tracker. New screens that match a document page as determined by a provided page tracker, or screens that have already been known to the quadrangle tracker but that previously did not match a document page are reported in a ScreenAppearedEvent event. A change of coordinates of a known screen is reported in a ScreenMovedEvent event and a change of the matching page of a known screen is reported in a ScreenChangedContentEvent event. Known screens that no longer match a page are reported in a ScreenDisappearedEvent event.

Notes

It is not possible to repeatedly iterate over all events detected in the video. Iterating over frames in the video prevents iterating over all events detected in the video. For screens that do not disappear by the last frame of the video, a ScreenDisappearedEvent event will not be produced.

Parameters:
  • video (VideoABC) – The video in which the events are detected.
  • quadrangle_tracker (ConvexQuadrangleTrackerABC) – The provided convex quadrangle tracker. If non-empty, the tracker will be cleared.
  • screen_detector (ScreenDetectorABC) – The provided screen detector that will be used to detect lit projection screens in video frames.
  • page_detector (PageDetectorABC) – The provided page detector that will be used to determine whether a screen shows a document page.
video

VideoABC – The video in which the events are detected.

video
__iter__(self)