예제 #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))
예제 #2
0
파일: video.py 프로젝트: marc-moreaux/perso
 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))
예제 #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))
예제 #4
0
파일: video.py 프로젝트: marc-moreaux/perso
 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))
예제 #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]