0

I need to extract (m x m) sub-images from a batch of (n x n) images, where:

images.shape = (batch, n, n, n_channels), sub-images.shape = (batch, m, m, n_channels),

and where each sub-image is in a different location for each image in the batch. Seems like the closest routine there is for this is: tf.image.crop_to_bounding_box(), but this uses the same cropping parameters for all images in the batch. Is there a simple way to do this? I can always resort to gather_nd() but that is very cumbersome.

John J
  • 47
  • 2
  • 6
  • 1
    You can do it quite simply outside of tensor flow in the shell with **GNU Parallel** and **ImageMagick** to get them all done in parallel - all you need is a list of the filenames and the matching coordinates in a text file. – Mark Setchell Sep 26 '18 at 07:14
  • Thanks, good to know. However, the problem here though is that the location of successive sub-images depend on Tensorflow variables. – John J Sep 27 '18 at 20:54

0 Answers0