API Reference >> skvideo.motion.globalEdgeMotion
Fork me on GitHub

skvideo.motion.globalEdgeMotion

skvideo.motion.globalEdgeMotion(frame1, frame2, r=6, method='hamming')[source]

Global motion estimation using edge features

Given two frames, find a robust global translation vector found using edge information. Frames must be luminance, RGB, or edge masks.

Parameters:
frame1ndarray

first input frame. Edge mask if dtype=bool, else luminance or rgb image. shape (1, M, N, C), (1, M, N), (M, N, C) or (M, N)

frame2ndarray

second input frame. Edge mask if dtype=bool, else luminance or rgb image. shape (1, M, N, C), (1, M, N), (M, N, C) or (M, N)

rint

Search radius for measuring correspondences.

methodstring

“hamming” –> use Hamming distance when measuring edge correspondence distances. The distance used in the census transform. [1]

“hausdorff” –> use Hausdorff distance when measuring edge correspondence distances. [2]

Returns:
globalMotionVectorlist of int, length 2

The motion to minimize edge distances by moving frame2 with respect to frame1. Returns [0, 0] when either frame contains no edges (no edge correspondence to minimize), so a blank/edgeless frame yields “no detected motion” rather than a spurious or crashing result.

References