From 31915dc7d6e4464d3ba322d821b2660e05fda8b9 Mon Sep 17 00:00:00 2001 From: Olli Graf Date: Mon, 4 Mar 2024 09:42:31 +0100 Subject: [PATCH] erste Vresion pistill.py --- camera/.gitignore | 2 +- camera/pistill.py | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100755 camera/pistill.py diff --git a/camera/.gitignore b/camera/.gitignore index c6415d1..b91b170 100644 --- a/camera/.gitignore +++ b/camera/.gitignore @@ -1,3 +1,3 @@ bin lib - +*.jpg diff --git a/camera/pistill.py b/camera/pistill.py new file mode 100755 index 0000000..3aa8dfd --- /dev/null +++ b/camera/pistill.py @@ -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) + +