-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtake_calibration_pictures.py
43 lines (30 loc) · 1.06 KB
/
take_calibration_pictures.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
38
39
40
41
42
43
from libraries.lib import Image_Stream
import cv2 as cv
image_streamer = Image_Stream()
# Image left
image_path_l = '.\Images\Left\calibration_l_'
# Image right
image_path_r = '.\Images\Right\calibration_r_'
# Image together
image_path_t = '.\Images\Together\calibration_'
counter=0
while True:
try:
image1,image2 = image_streamer.get_Images()
cv.imshow('frame1', image1)
cv.imshow('frame2', image2)
if cv.waitKey(10) == ord('q'):
break
if cv.waitKey(1) == ord('s'):
counter = counter + 1
filename_l = image_path_l + str(counter) + '.jpg'
filename_r = image_path_r + str(counter) + '.jpg'
filename_t_l = image_path_t + 'l_' + str(counter) + '.jpg'
filename_t_r = image_path_t + 'r_' + str(counter) + '.jpg'
cv.imwrite(filename_l, image1)
cv.imwrite(filename_r, image2)
cv.imwrite(filename_t_l, image1)
cv.imwrite(filename_t_r, image2)
print('images saved')
except Exception as e:
print(e)