def zoom_multi(x, zoom_range=(0.9, 1.1), is_random=False, row_index=0, col_index=1, channel_index=2, fill_mode='nearest', cval=0.0):
 if (len(zoom_range) != 2):
  raise Exception('zoom_range should be a tuple or list of two floats. Received arg: ', zoom_range)
 if is_random:
  if ((zoom_range[0] == 1) and (zoom_range[1] == 1)):
   (zx, zy) = (1, 1)
   print ' random_zoom : not zoom in/out'
  else:
   (zx, zy) = np.random.uniform(zoom_range[0], zoom_range[1], 2)
 else:
  (zx, zy) = zoom_range
 zoom_matrix = np.array([[zx, 0, 0], [0, zy, 0], [0, 0, 1]])
 (h, w) = (x[0].shape[row_index], x[0].shape[col_index])
 transform_matrix = transform_matrix_offset_center(zoom_matrix, h, w)
 results = []
 for data in x:
  results.append(apply_transform(data, transform_matrix, channel_index, fill_mode, cval))
 return np.asarray(results)

def zoom_multi ( x , zoom_range = ( 0.9 , 1.1 ) , is_random = False , row_index = 0 , col_index = 1 , channel_index = 2 , fill_mode = 'nearest' , cval = 0.0 ) : if ( len ( zoom_range ) != 2 ) : raise Exception ( 'zoom_range should be a tuple or list of two floats. Received arg: ' , zoom_range ) if is_random : if ( ( zoom_range [ 0 ] == 1 ) and ( zoom_range [ 1 ] == 1 ) ) : ( zx , zy ) = ( 1 , 1 ) print ' random_zoom : not zoom in/out' else : ( zx , zy ) = np . random . uniform ( zoom_range [ 0 ] , zoom_range [ 1 ] , 2 ) else : ( zx , zy ) = zoom_range zoom_matrix = np . array ( [ [ zx , 0 , 0 ] , [ 0 , zy , 0 ] , [ 0 , 0 , 1 ] ] ) ( h , w ) = ( x [ 0 ] . shape [ row_index ] , x [ 0 ] . shape [ col_index ] ) transform_matrix = transform_matrix_offset_center ( zoom_matrix , h , w ) results = [ ] for data in x : results . append ( apply_transform ( data , transform_matrix , channel_index , fill_mode , cval ) ) return np . asarray ( results )
zoom in and out of images with the same arguments .