<jupyter_start><jupyter_text>https://colab.research.google.com/drive/1-zs3rm9ickBXd0oj6yiy5U8PpW_ywHF_<jupyter_code>!pip install selectivesearch
import matplotlib.pyplot as plt
%matplotlib inline
import selectivesearch
import cv2
!wget https://www.dropbox.com/s/l98leemr7r5stnm/Hemanvi.jpeg
img = cv2.imread('/content/Hemanvi.jpeg')
img_lbl, regions = selectivesearch.selective_search(img, scale=100, min_size=2000)
print(len(regions))
candidates = set()
for r in regions:
     if r['rect'] in candidates:
         continue
 # excluding regions smaller than 2000 pixels
     if r['size'] < 2000:
         continue
     x, y, w, h = r['rect']
     candidates.add(r['rect'])
import matplotlib.patches as mpatches
fig, ax = plt.subplots(ncols=1, nrows=1, figsize=(6, 6))
ax.imshow(img)
for x, y, w, h in candidates:
    rect = mpatches.Rectangle(
        (x, y), w, h, fill=False, edgecolor='red', linewidth=1)
    ax.add_patch(rect)
plt.axis('off')
plt.show()<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup