You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
629 B
36 lines
629 B
9 months ago
|
#! /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)
|
||
|
|
||
|
|