forked from ParadoxZero/rubiks-cube-solver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalibrate.py
37 lines (28 loc) · 1.16 KB
/
calibrate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import cv2
boundary = [
[(153.88465646137416, 132.63403346386615, 173.59095763616946),(25.9188323246707, 9.84051263794945, 60.749733001068)], #Red
[(201.1804912780349, 136.01530793876825, 92.82769668921324),(137.93912424350304, 59.34033463866145, 12.37201851192595)], #Blue
[(130.63545745817018, 147.88892844428624, 237.47632609469562),(38.4432182271271, 62.68992524029905, 181.69668921324316)], #orange
[(201.20149519401923, 192.44606621573516, 181.64542541829834),(146.34674261302956, 137.60056959772163, 127.12353150587398)], #White
[(85.92559629761482, 159.56461374154503, 75.48629405482378),(35.28195087219651, 117.95550017799928, 17.02456390174439)], #green
[(88.78996084015664, 210.84514061943753, 179.02100391598435),(29.74012103951584, 140.436098255607, 114.10679957280172)], #Yellow
]
resolution = X,Y = 640 , 480
sqrs = [
((Y/6)*3,(Y/6)*5),
((Y/6)*3,(Y/6)*4),
((Y/6)*3,(Y/6)*3),
((Y/6)*4,(Y/6)*5),
((Y/6)*4,(Y/6)*4),
((Y/6)*4,(Y/6)*3),
((Y/6)*5,(Y/6)*5),
((Y/6)*5,(Y/6)*4),
((Y/6)*5,(Y/6)*3)
]
def reset():
camera = cv2.VideoCapture(0)
if not(camera.isOpened()):
camera.open()
while True:
if cv2.waitKey(2) & 0xFF == ord('q'):
break