Created
November 5, 2021 15:04
-
-
Save Mehdi-Amine/de4e184e2189fecd370aae953bcf4cb7 to your computer and use it in GitHub Desktop.
cropping the region of interest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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