-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCamera.py
More file actions
69 lines (64 loc) · 1.45 KB
/
Camera.py
File metadata and controls
69 lines (64 loc) · 1.45 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# import cv2
# import time
#
# cap = cv2.VideoCapture(0)
#
# if not cap.isOpened():
# print("Cannot open camera")
# exit()
#
# # 循环直到视频结束
# while cap.isOpened():
# # 读取下一帧
# ret, frame = cap.read()
#
# # 如果正确读取帧,ret为True
# if not ret:
# print("无法读取视频流或视频结束")
# break
#
# # 显示帧
# cv2.imshow("Video", frame)
#
# # 按'ESC'退出视频
# if cv2.waitKey(10) & 0xFF == 27:
# break
#
# cap.set(cv2.CAP_PROP_AUTOFOCUS, 0)
# cap.set(cv2.CAP_PROP_FOCUS, 100)
#
# current_focus = cap.get(cv2.CAP_PROP_FOCUS)
# print("Current focus: ", current_focus)
#
# time.sleep(1)
#
# focus_value = current_focus + 10
# cap.set(cv2.CAP_PROP_FOCUS, focus_value)
#
# new_focus = cap.get(cv2.CAP_PROP_FOCUS)
# print("New focus: ", new_focus)
#
# cap.release()
# text = "@珐露珊瑚宫\u202d\u202d\u2067~喵\u2067\u202d 超市你"
# print(text)
import cv2
import time
import sys
# print("开始拍摄图片")
# images = []
# for i in range(10):
# time.sleep(0.5)
# images.append(cv2.VideoCapture(0).read()[1])
imgs = []
imgs.append(cv2.imread("1.jpg"))
imgs.append(cv2.imread("2.jpg"))
# imgs.append(cv2.imread("3.jpg"))
stitcher = cv2.Stitcher.create()
status, pano = stitcher.stitch(imgs)
if status == cv2.Stitcher_OK:
cv2.imshow("pano", pano)
cv2.waitKey(0)
else:
sys.exit("Error during stitching")
cv2.imwrite("output.jpg", pano)
print("Done")