How do I crop multiple ROIs from array?

asked 2019-01-30 07:37:26 -0500

Firelife gravatar image

updated 2019-01-30 07:43:38 -0500

How would you crop multiple ROIs from a np.array? With the coords arranged this way.

rect = np.array([[14,137,80,166],[14,174,80,204],[14,214,80,244],[14,252,80,282]])

Each element is set up this way. [x1,y1,x2,y2]. Due to start and end points of rectangle

I know the crop function is setup-

crop = img[y1:y2,x1:x2]

Trying to do this for 2 images so I can compare intensities of the ROIs.

edit retag flag offensive close merge delete