Dense Optical Flow Annotations¶
Annotator to extract dense Optical Flow using Gunnar Farneback’s algorithm.
-
class
dvt.annotate.opticalflow.OpticalFlowAnnotator(**kwargs)[source]¶ Bases:
dvt.abstract.FrameAnnotatorAnnotator to extract dense Optical Flow using the opencv Gunnar Farneback’s algorithm.
The annotator will return an image or flow field describing the motion in two subsequent frames.
-
freq¶ How often to perform the embedding. For example, setting the frequency to 2 will computer every other frame in the batch.
Type: int
-
raw¶ Return optical flow as color image by default, raw returns the raw output as produced by the opencv algorithm.
Type: bool
-
frames¶ An optional list of frames to process. This should be a list of integers or a 1D numpy array of integers. If set to something other than None, the freq input is ignored.
Type: array of ints
-
output_dir¶ optional location to store the computed images. Only used if raw is set to False.
Type: string
-
size¶ What should the size of the output images be? Set to None, the default, to preserve the size as given in the input file. Given as the desired height; the width will be scaled to keep the aspect ratio.
Type: int
-
name¶ A description of the aggregator. Used as a key in the output data.
Type: str
-
annotate(batch)[source]¶ Annotate the batch of frames with the optical flow annotator.
Parameters: batch (FrameBatch) – A batch of images to annotate. Returns: A list of dictionaries containing the video name, frame, and the optical flow representation. The latter has the same spatial dimensions as the input.
-
name= 'opticalflow'
-