Created
March 1, 2017 19:42
-
-
Save guilhermemauro/257cedef966bb4ce0d7822f0e1d40b2b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#cut image staying just the field choosed | |
def getField(coord, frame): | |
crop_img = frame[coord[0]:coord[1], coord[2]:coord[3]] | |
return crop_img | |
#find X and/or O with color detection in cut image | |
def getContoursHSV(img): | |
mask = cv2.inRange(cv2.cvtColor(img, cv2.COLOR_BGR2HSV), CARD_COLOR_LOW, CARD_COLOR_UP) | |
if len(mask) > 0: | |
dilation = cv2.dilate(mask,KERNEL,iterations = 2) | |
cnt = findBiggestContour(dilation) | |
return cnt | |
else: | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment