Shortcuts

mmcv.video.quantize_flow

mmcv.video.quantize_flow(flow: numpy.ndarray, max_val: float = 0.02, norm: bool = True)tuple[source]

Quantize flow to [0, 255].

After this step, the size of flow will be much smaller, and can be dumped as jpeg images.

Parameters
  • flow (ndarray) – (h, w, 2) array of optical flow.

  • max_val (float) – Maximum value of flow, values beyond [-max_val, max_val] will be truncated.

  • norm (bool) – Whether to divide flow values by image width/height.

Returns

Quantized dx and dy.

Return type

tuple[ndarray]