0

I'm trying to develop some code to crop multiple areas within an image. The only info I have is the x/y pixel coordinates of the top left corner of each crop, and the pixel length of each side (this number is uniform as the crops are all perfect squares.

For example, within one image I may have multiple features needing cropping. Here, the first two figures are the x/y coords of the top left corner, and the third is the length of each of the four sides (r) x, y, r

Currently trying to achieve this in skimage, but not getting very far. Sorry if this is unclear, please feel free to ask more Qs.

Ta, Rhod

1 Answers1

1

Just use Numpy slicing. So if you have:

X = 10
Y = 20
R = 15

your extracted ROI is:

ROI = im[Y:Y+R, X:X+R]
Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
  • Yes of course, obvious when you see it written down. Been working on it all day and I think the simple things are begining to evade me, a break is needed haha! Thank you for your rapid response help. – CephaloRhod Mar 17 '20 at 13:57
  • I believe you said we should take a coffee break – Mark Setchell Mar 17 '20 at 14:07