forked from wyu12/DCT-Computer-Vision
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
17 lines (16 loc) · 647 Bytes
/
Copy pathtest.py
File metadata and controls
17 lines (16 loc) · 647 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import cv2
import apriltag
if __name__ == '__main__':
cap = cv2.VideoCapture(0)
detector = apriltag.Detector()
directory = "data/Track 10-22/"
file = directory+"30_3.png"
img = cv2.imread(file, cv2.IMREAD_GRAYSCALE)
size = (int(img.shape[1]*0.5), int(img.shape[0]*0.5))
output = cv2.resize(img, size)
thresh = cv2.adaptiveThreshold(output, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY, 11, 2)
#test, thresh = cv2.threshold(output, 75, 255, cv2.ADAPTIVE_THRESH_MEAN_C)
cv2.imwrite("output_1.png", thresh)
detector.detect(thresh, return_image=True)
cap.release()
cv2.destroyAllWindows()