def foveate_channel(img, rings, output, start_idx):
 ring_w = numpy.sum(rings)
 inner_img = img[:, ring_w:(img.shape[1] - ring_w), ring_w:(img.shape[2] - ring_w)]
 inner_img = inner_img.reshape(len(output), (-1))
 end_idx = (start_idx + inner_img.shape[1])
 output[:, start_idx:end_idx] = inner_img
 idx = 0
 start_idx = end_idx
 for rd in rings:
  start_idx = downsample_ring(img, idx, rd, output, start_idx)
  idx += rd
 return start_idx

def foveate_channel ( img , rings , output , start_idx ) : ring_w = numpy . sum ( rings ) inner_img = img [ : , ring_w : ( img . shape [ 1 ] - ring_w ) , ring_w : ( img . shape [ 2 ] - ring_w ) ] inner_img = inner_img . reshape ( len ( output ) , ( - 1 ) ) end_idx = ( start_idx + inner_img . shape [ 1 ] ) output [ : , start_idx : end_idx ] = inner_img idx = 0 start_idx = end_idx for rd in rings : start_idx = downsample_ring ( img , idx , rd , output , start_idx ) idx += rd return start_idx
for a given channel .