erste Vresion pistill.py
This commit is contained in:
2
camera/.gitignore
vendored
2
camera/.gitignore
vendored
@@ -1,3 +1,3 @@
|
||||
bin
|
||||
lib
|
||||
|
||||
*.jpg
|
||||
|
35
camera/pistill.py
Executable file
35
camera/pistill.py
Executable file
@@ -0,0 +1,35 @@
|
||||
#! /usr/bin/python
|
||||
|
||||
from picamera2 import Picamera2
|
||||
from libcamera import controls
|
||||
from time import sleep
|
||||
import sys
|
||||
|
||||
to_file=''
|
||||
picam = Picamera2()
|
||||
|
||||
def take_still(filename):
|
||||
config = picam.create_preview_configuration()
|
||||
picam.configure(config)
|
||||
|
||||
picam.start()
|
||||
picam.set_controls({"AfMode": controls.AfModeEnum.Continuous})
|
||||
sleep(5)
|
||||
picam.capture_file(filename)
|
||||
picam.close()
|
||||
|
||||
def parseArgs(argv):
|
||||
global to_file
|
||||
count = 0
|
||||
for arg in argv:
|
||||
if arg == '-o':
|
||||
to_file = argv[count+1]
|
||||
|
||||
count += 1
|
||||
|
||||
if __name__ =='__main__':
|
||||
parseArgs(sys.argv)
|
||||
print(f'to_file={to_file}')
|
||||
take_still(to_file)
|
||||
|
||||
|
Reference in New Issue
Block a user