proof of concept
This commit is contained in:
26
live_view.py
Normal file
26
live_view.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import gphoto2 as gp
|
||||
import cv2
|
||||
import numpy as np
|
||||
|
||||
camera = gp.Camera()
|
||||
camera.init()
|
||||
|
||||
def liveview():
|
||||
while True:
|
||||
# Pobierz klatkę z LiveView
|
||||
file = camera.capture_preview()
|
||||
data = file.get_data_and_size()
|
||||
frame = np.frombuffer(data, dtype=np.uint8)
|
||||
frame = cv2.imdecode(frame, cv2.IMREAD_COLOR)
|
||||
|
||||
if frame is not None:
|
||||
cv2.imshow("LiveView", frame)
|
||||
|
||||
if cv2.waitKey(1) == 27: # ESC
|
||||
break
|
||||
|
||||
cv2.destroyAllWindows()
|
||||
camera.exit()
|
||||
|
||||
if __name__ == "__main__":
|
||||
liveview()
|
||||
Reference in New Issue
Block a user