SH Script um Camersettings nach booten zu setzen

Antworten
Benutzeravatar
Frankomio
Fortgeschrittener
Beiträge: 71
Registriert: 9. Jan 2025 08:35
Wohnort: Bottrop
Has thanked: 9 times
Been thanked: 4 times

SH Script um Camersettings nach booten zu setzen

Dieses Skript setzt alle 3 Kameras mit identischen Parametern in einer Schleife.

v4l2-utils Muss installiert sein

Zeile 7-10 bitte anpassen auf die Ausgabe von v4l2-ctl --list-devices

(Es wurden die Hex-Werte genutzt um unterschiedliche Schreibweisen der Settings zu umgehen !


setcam.sh

Code: Alles auswählen

#!/bin/bash
#systemctl stop autodarts
sleep 2

#v4l2-ctl --list-devices

# adjust 3 videocams to your needs !
cam[1]=video0
cam[2]=video10
cam[3]=video6







for i in {1..3}; do
export ${cam[$i]};


echo ${cam[$i]} setting up....
v4l2-ctl -d /dev/${cam[$i]} -c 0x00980900=-40 #brightness
v4l2-ctl -d /dev/${cam[$i]} -c 0x00980901=10 #contrast
v4l2-ctl -d /dev/${cam[$i]} -c 0x00980902=64 #saturation
v4l2-ctl -d /dev/${cam[$i]} -c 0x00980903=0 #hue

v4l2-ctl -d /dev/${cam[$i]} -c 0x0098090c=1 #white_balance_automatic
#v4l2-ctl -d /dev/${cam[$i]} -c 0x0098091a=4550 #white_balance_temperature

v4l2-ctl -d /dev/${cam[$i]} -c 0x00980910=72 #gamma
v4l2-ctl -d /dev/${cam[$i]} -c 0x00980918=1 #power_line_frequency 1=50hz
#v4l2-ctl -d /dev/${cam[$i]} -c 0x00980913=0 #gain


v4l2-ctl -d /dev/${cam[$i]} -c 0x0098091b=3 #sharpness
v4l2-ctl -d /dev/${cam[$i]} -c 0x0098091c=10 #Backlight Compensation

v4l2-ctl -d /dev/${cam[$i]} -c 0x009a0901=3 #Auto Exposure
#v4l2-ctl -d /dev/${cam[$i]} -c 0x009a0902=320 #Exposure Time

v4l2-ctl -d /dev/${cam[$i]} -c 0x009a0903=0 #Exposure, Dynamic Framerate

echo
echo
echo Output Settings of /dev/${cam[$i]} :

v4l2-ctl -d /dev/${cam[$i]} --list-ctrls ;

done


echo
echo
echo Output Settings of first Cam:
v4l2-ctl -d /dev/${cam[$i]} --all

echo

# systemctl start autodarts

echo ENDSCRIPT
Antworten