File tree Expand file tree Collapse file tree
src/om1_vlm/anonymizationSys/face_recog_stream Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11from __future__ import annotations
22
33import logging
4+ import subprocess
45from typing import Optional
56
67import cv2
@@ -79,6 +80,31 @@ def open_capture(
7980 self .cap .set (cv2 .CAP_PROP_BUFFERSIZE , 1 )
8081 self .cap .set (cv2 .CAP_PROP_AUTO_EXPOSURE , 3 )
8182
83+ try :
84+ subprocess .run (
85+ [
86+ "v4l2-ctl" ,
87+ "-d" ,
88+ device ,
89+ "--set-ctrl=exposure_dynamic_framerate=1" ,
90+ ],
91+ check = True ,
92+ capture_output = True ,
93+ text = True ,
94+ )
95+ logging .info ("Enabled exposure_dynamic_framerate on %s" , device )
96+ except FileNotFoundError :
97+ logging .warning (
98+ "v4l2-ctl not found; install v4l-utils to enable "
99+ "exposure_dynamic_framerate"
100+ )
101+ except subprocess .CalledProcessError as e :
102+ logging .warning (
103+ "Failed to set exposure_dynamic_framerate on %s: %s" ,
104+ device ,
105+ (e .stderr or e .stdout or "" ).strip (),
106+ )
107+
82108 if not self .cap or not self .cap .isOpened ():
83109 raise RuntimeError (f"Failed to open camera device { device } " )
84110
You can’t perform that action at this time.
0 commit comments