easy_vision.python.core.optical_flow¶
easy_vision.python.core.optical_flow.optical_flow¶
-
class
easy_vision.python.core.optical_flow.optical_flow.OpencvFlowExtractor(scale=5, warp=5, iteration=50, use_gpu=False)[source]¶ Bases:
object-
__init__(scale=5, warp=5, iteration=50, use_gpu=False)[source]¶ x.__init__(…) initializes x; see help(type(x)) for signature
-
calc(images1, images2)[source]¶ calc optical flow :param images1 numpy array or a list of numpy array, each np array represents a frame: :param images2 the same as image1, which are frames one timestep behind:
Returns: - a list of numpy array length of list is N, shape of np.array h x w x 2,
- N is the number of frame in images1,channel order is ux, uy
-
-
class
easy_vision.python.core.optical_flow.optical_flow.TVNetExtractor(scale=1, warp=1, iteration=50, spatial_shape=(224, 224), batch_size=16)[source]¶ Bases:
object-
__init__(scale=1, warp=1, iteration=50, spatial_shape=(224, 224), batch_size=16)[source]¶ Parameters: - TVNet scale (scale) –
- TVNet warp (warp) –
- TVNet iteration (iteration) –
- tuple for input height and width (spatial_shape) –
-
calc(images1, images2)[source]¶ calc optical flow :param images1 numpy array or a list of numpy array, each np array represents a frame: :param images2 the same as image1, which are frames one timestep behind:
Returns: - a list of numpy array length of list is N, shape of np.array h x w x 2,
- N is the number of frame in images1,channel order is ux, uy
-
-
easy_vision.python.core.optical_flow.optical_flow.encode_flowmap(flow, bound=20)[source]¶ encode optical flow to a image file by truncating values using bound and map [-bound, bound] float value to [0, 255] uint8 value :param flow a numpy array with shape [h, w, 2]: :param bound threshold used to truncate flow mat:
- Return
- a numpy array with shape [h, w, 3], the last channel is filled with zero