Segment Computation

This module defines a Job for extracting the stable segments of the video from the histogram correlations. A stable segment is a period of time during which the variation of the slide appearance is not “too high”, according to some internal metrics.

Once the stable segments have been detected, it is possible to apply a contrast enhancement on those parts using a simple histogram streching (see :py:class:`` for more details).

SegmentComputationJob(*args, **kwargs) Detection of “stable” segments of the video.
class livius.video.processing.jobs.segment_computation.SegmentComputationJob(*args, **kwargs)

Detection of “stable” segments of the video.

The purpose of this Job is to provide a way to detect time frames during which a simple processing may be performed in order to enhance the slides.

Runtime parameters

Workflow inputs

The inputs of the parents are

  • A function:

    frame_index -> correlation
    

    (see histogram_correlations.HistogramCorrelationJob for an example)

  • The number of files

Workflow outputs

  • The output of this Job is a list of segments, each specified by [t_start, t_end].
__init__(*args, **kwargs)
Parameters:
  • segment_computation_tolerance (float) – indicates how much deviation from correlation 1.0 is tolerated for being in a stable segment
  • segment_computation_min_length_in_seconds (int) – indicates the minimum length of a stable segment in seconds.

Note

In case the segment lenght is shorter than segment_computation_min_length_in_seconds the frames on the segment will be flagged as unstable.

run(*args, **kwargs)

Segment the video using the histogram correlations.

If there is a spike with a correlation of less than (1 - tolerance), then we assume that we need to adapt the histogram bounds and thus start a new segment.

If there is a region with many small spikes we assume that we cannot apply any contrast enhancement / color correction (or apply a conservative default one).