modules/motion.py
def flow2rgb(flow):
    '''
        Convert flow to an RGB image to visualize.
        
    '''
    H, W, _ = flow.shape

    hsv = np.zeros((H, W, 3), dtype=np.uint8)
    hsv[..., 1] = 255
    
    mag, ang = cv2.cartToPolar(flow[..., 0], flow[..., 1])
    hsv[..., 0] = ang*180/np.pi/2
    hsv[..., 2] = cv2.normalize(mag, None, 0, 255, cv2.NORM_MINMAX)
    
    return cv2.cvtColor(hsv, cv2.COLOR_HSV2RGB)

        Convert flow to an RGB image to visualize.
        
    
Convert flow to an RGB image to visualize.
Convert flow to an RGB image to visualize .
def flow2rgb(flow):
    H, W, _ = flow.shape
    hsv = np.zeros((H, W, 3), dtype=np.uint8)
    hsv[..., 1] = 255
    mag, ang = cv2.cartToPolar(flow[..., 0], flow[..., 1])
    hsv[..., 0] = ang*180/np.pi/2
    hsv[..., 2] = cv2.normalize(mag, None, 0, 255, cv2.NORM_MINMAX)
    return cv2.cvtColor(hsv, cv2.COLOR_HSV2RGB)
def flow2rgb ( flow ) : H , W , _ = flow . shape hsv = np . zeros ( ( H , W , 3 ) , dtype = np . uint8 ) hsv [ ... , 1 ] = 255 mag , ang = cv2 . cartToPolar ( flow [ ... , 0 ] , flow [ ... , 1 ] ) hsv [ ... , 0 ] = ang * 180 / np . pi / 2 hsv [ ... , 2 ] = cv2 . normalize ( mag , None , 0 , 255 , cv2 . NORM_MINMAX ) return cv2 . cvtColor ( hsv , cv2 . COLOR_HSV2RGB )
Convert flow to an RGB image to visualize.
Convert flow to an RGB image to visualize .
'''
        Convert flow to an RGB image to visualize.
        
    '''
flow