Skip to content

Instantly share code, notes, and snippets.

@Mehdi-Amine
Created November 5, 2021 15:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mehdi-Amine/de4e184e2189fecd370aae953bcf4cb7 to your computer and use it in GitHub Desktop.
Save Mehdi-Amine/de4e184e2189fecd370aae953bcf4cb7 to your computer and use it in GitHub Desktop.
cropping the region of interest
def region_of_interest(image):
height = image.shape[0]
width = image.shape[1]
polygons = np.array([[(10,height), (width,height), (width,1100), (630, 670), (10, 1070)]])
mask = np.zeros_like(image)
cv2.fillPoly(mask, polygons, 255)
masked_image = cv2.bitwise_and(image, mask)
return masked_image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment