-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpreview.py
More file actions
101 lines (54 loc) · 1.62 KB
/
preview.py
File metadata and controls
101 lines (54 loc) · 1.62 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# coding: utf-8
# In[1]:
import cv2
import olympusair
import numpy as np
# In[2]:
cam = olympusair.Camera()
# In[3]:
cam.commInterface()
# In[4]:
print cam
# In[5]:
cam.switchMode('standalone')
# In[6]:
cam.switchMode('rec')
# In[7]:
cam.getProperty('FOCUS_STILL')
cam.setProperty('FOCUS_STILL','FOCUS_MF')
cam.getProperty('FOCUS_STILL')
cam.getProperty('RAW')
cam.setProperty('RAW','ON')
cam.getProperty('RAW')
cam.getProperty('TAKE_DRIVE')
cam.setProperty('TAKE_DRIVE','DRIVE_NORMAL')
cam.getProperty('TAKE_DRIVE')
cam.getProperty('TAKEMODE')
cam.setProperty('TAKEMODE','P')
cam.getProperty('TAKEMODE')
cam.getProperty('DESTINATION_FILE')
cam.setProperty('DESTINATION_FILE','DESTINATION_FILE_MEDIA')
cam.getProperty('DESTINATION_FILE')
# In[8]:
cam.startPreview('0640x0480')
# In[9]:
cv2.namedWindow('Preview',cv2.WINDOW_NORMAL)
cv2.moveWindow('Preview',800,50)
cv2.resizeWindow('Preview',640,480)
while (1):
lvFrame = olympusair.LiveViewFrame()
lvFrame.getLiveViewFrame(cam.lvSocket)
tst = np.fromstring(lvFrame.jpegStream, dtype = np.uint8)
img = cv2.imdecode(tst,1)
cv2.putText(img,'S: %i/%is A: f#%.1f' % (lvFrame.shutterCurrNum,lvFrame.shutterCurrDenom,lvFrame.fNumberCurr),
(10,15),cv2.FONT_HERSHEY_PLAIN,1,(0,0,255))
cv2.putText(img,'ISO: %i' % (lvFrame.iso),(10,30),cv2.FONT_HERSHEY_PLAIN,1,(0,255,0))
cv2.imshow('Preview',img)
cv2.setWindowProperty('Preview',cv2.WND_PROP_FULLSCREEN,cv2.WINDOW_FULLSCREEN)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cv2.destroyAllWindows()
# In[10]:
cam.stopPreview()
cam.disconnect()
# In[ ]: