Last active
June 30, 2019 22:08
-
-
Save begnini/0194ba7f26e23a8c18d37f6188062922 to your computer and use it in GitHub Desktop.
ROI nao retangulo
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
import cv2 | |
import numpy as np | |
image = cv2.imread('QWO9Y.jpg') | |
mask = np.zeros(image.shape, dtype=np.uint8) | |
# pontos do poligono | |
pts = [ | |
[150, 124], | |
[327, 135], | |
[340, 181], | |
[582, 274], | |
[510, 344], | |
[168, 240] | |
] | |
pts = np.array(pts, np.int32) | |
pts = pts.reshape((-1,1,2)) | |
mask = cv2.fillPoly(mask, [pts], (255, 255, 255)) | |
masked = cv2.bitwise_and(image, mask) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment