Example #1
0
 def colour_space_edge(self):
     '''Determine spatial gradient in colour space'''
     # TODO this should be done frame by frame to conserve memory
     fV = np.float32(self.V)
     dV_dy = pylab.vector_lengths(np.diff(fV, axis=1), axis=3)
     dV_dx = pylab.vector_lengths(np.diff(fV, axis=2), axis=3)
     # make the shapes compatible by discarding right and bottom edges
     dV_dy = dV_dy[:,:,:-1]
     dV_dx = dV_dx[:,:-1,:]
     return asvideo(np.hypot(dV_dx, dV_dy))
Example #2
0
 def colour_space_edge(self):
     '''Determine spatial gradient in colour space'''
     # TODO this should be done frame by frame to conserve memory
     fV = np.float32(self.V)
     dV_dy = pylab.vector_lengths(np.diff(fV, axis=1), axis=3)
     dV_dx = pylab.vector_lengths(np.diff(fV, axis=2), axis=3)
     # make the shapes compatible by discarding right and bottom edges
     dV_dy = dV_dy[:, :, :-1]
     dV_dx = dV_dx[:, :-1, :]
     return asvideo(np.hypot(dV_dx, dV_dy))
Example #3
0
 def colour_space_dt(self):
     '''Determines the change for each pixel as the euclidean distance in 
     colourspace.'''
     # TODO should this be done pixel by pixel to conserve memory
     dV = np.diff(np.float32(self.V), axis=0)
     dV_dt = pylab.vector_lengths(dV, axis=3)
     return asvideo(np.squeeze(dV_dt))
Example #4
0
 def colour_space_dt(self):
     '''Determines the change for each pixel as the euclidean distance in 
     colourspace.'''
     # TODO should this be done pixel by pixel to conserve memory
     dV = np.diff(np.float32(self.V), axis=0)
     dV_dt = pylab.vector_lengths(dV, axis=3)
     return asvideo(np.squeeze(dV_dt))
Example #5
0
def ReduceToVecLengths(mcl):
    """
    Calculate absoulute value of vectors stored in a list of wrapped
    grib messages

    Danger Will Robinson: This function has side effects on the first
    element of the list!

    However, if it is used as 'Reduce' function in the iterator, noone
    will ever see the original element, so we don't care about side
    effects.
    """
    ret=mcl[0]
    ret.putdata(vector_lengths(numpy.array(deepcopydatatolist(mcl)),axis=0))
    return [ret]