0

I have an array. e.g.:

import numpy as np

arr = []

arr.append(
([0.195, 0.229], [0.673, 0.754])
)

arr.append(
([1.0, 1.903], [0.161, 0.303])
)

arr.append(
([0.052, 0.321], [1.0, 1.929])
)

Each tuple in arr represents the min_X, max_X, min_Y, max_Y of a rectangle in an image (example resolution: 1280x1080):

return np.array([min_X, max_X]), np.array([min_Y, max_Y])

How can I check to see if any of the ROI's overlap?

pookie
  • 3,796
  • 6
  • 49
  • 105
  • How about constructing polygons with those coordinates and using [geopandas](https://geopandas.org/en/stable/index.html) to check for overlap? See [here](https://gis.stackexchange.com/q/294206) on how to construct a polygon and [here](https://geopandas.org/en/stable/docs/user_guide/set_operations.html) for a guide on how to intersect polygons. Should be relatively efficient too. – npetrov937 Dec 05 '22 at 16:09
  • What have you tried so far? Did you look at other questions (e.g. https://stackoverflow.com/a/57247833/7212665?) – Demi-Lune Dec 05 '22 at 16:12
  • Does this answer your question? [Determine if two rectangles overlap each other?](https://stackoverflow.com/questions/306316/determine-if-two-rectangles-overlap-each-other) – beaker Dec 05 '22 at 16:14

0 Answers0