From 7f8159d7a8ae432f951d2adc7869b648bf2f1597 Mon Sep 17 00:00:00 2001 From: Diego Freitas Date: Tue, 5 May 2026 16:49:36 -0300 Subject: [PATCH] pequenos ajustes --- Python/OAK/datasets/oak-fcc-3/_0_capture.py | 2 +- .../oak-fcc-3/calibration/module_params.json | 8 ++++---- .../oak-fcc-3/core/oak_fcc3_manager.py | 19 +++++++++++++++++++ .../utils/sensor_calibration_tool.py | 4 +++- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/Python/OAK/datasets/oak-fcc-3/_0_capture.py b/Python/OAK/datasets/oak-fcc-3/_0_capture.py index 3fbccd191..036afdc12 100644 --- a/Python/OAK/datasets/oak-fcc-3/_0_capture.py +++ b/Python/OAK/datasets/oak-fcc-3/_0_capture.py @@ -179,7 +179,7 @@ def main(): print("============================================") beauty_preview = False - radiometric_ae = True + radiometric_ae = False auto_save = False last_auto_t = 0.0 preview_upscale = args.preview_upscale diff --git a/Python/OAK/datasets/oak-fcc-3/calibration/module_params.json b/Python/OAK/datasets/oak-fcc-3/calibration/module_params.json index ec8c27d67..3e0bb0f98 100644 --- a/Python/OAK/datasets/oak-fcc-3/calibration/module_params.json +++ b/Python/OAK/datasets/oak-fcc-3/calibration/module_params.json @@ -12,8 +12,8 @@ "rgb": { "ae_enable": false, "awb_enable": false, - "exposure_time_us": 20000, - "analogue_gain": 1.2100000000000002, + "exposure_time_us": 3000, + "analogue_gain": 1.21, "colour_gains": [ 1.0, 1.0 @@ -22,14 +22,14 @@ "re": { "ae_enable": false, "awb_enable": false, - "exposure_time_us": 20000, + "exposure_time_us": 5000, "analogue_gain": 1.0, "colour_gains": null }, "nir": { "ae_enable": false, "awb_enable": false, - "exposure_time_us": 20000, + "exposure_time_us": 3000, "analogue_gain": 1.0, "colour_gains": null } diff --git a/Python/OAK/datasets/oak-fcc-3/core/oak_fcc3_manager.py b/Python/OAK/datasets/oak-fcc-3/core/oak_fcc3_manager.py index b72417480..008a6ffa6 100644 --- a/Python/OAK/datasets/oak-fcc-3/core/oak_fcc3_manager.py +++ b/Python/OAK/datasets/oak-fcc-3/core/oak_fcc3_manager.py @@ -18,6 +18,7 @@ class OakFcc3Manager: sync_mode="best", sync_tolerance_ms=12.0, buffer_size=8, + only_camera=None ): self.fps = fps self.width = width @@ -28,6 +29,7 @@ class OakFcc3Manager: self.output_dtype = output_dtype self.capture_mode = capture_mode self.raw_policy = raw_policy + self.only_camera = only_camera self.roles = roles or { "CAM_A": "rgb", @@ -97,11 +99,15 @@ class OakFcc3Manager: for f in features: socket = f.socket socket_name = socket.name + if self.only_camera is not None and socket_name != self.only_camera: + continue + role = self.roles.get(socket_name, "unknown") print(f"[OAK] Criando câmera {socket_name} sensor={f.sensorName} role={role}") cam = self.pipeline.create(dai.node.Camera).build(socket) + self.apply_initial_camera_controls_to_node(cam, socket_name) ctrl_q = cam.inputControl.createInputQueue() if self._is_preview_mode(): @@ -518,6 +524,19 @@ class OakFcc3Manager: return result + def apply_initial_camera_controls_to_node(self, cam, cam_id): + ctrl_state = self.camera_controls.get(cam_id, {}) + + ae = bool(ctrl_state.get("ae_enable", False)) + exp_us = int(ctrl_state.get("exposure_time_us") or 15000) + gain = float(ctrl_state.get("analogue_gain") or 1.0) + + if not ae: + cam.initialControl.setManualExposure( + exp_us, + self._gain_to_iso(gain) + ) + def _send_control(self, cam_id, ctrl): if cam_id not in self.control_queues: raise RuntimeError(f"Fila de controle não existe para {cam_id}") diff --git a/Python/OAK/datasets/oak-fcc-3/utils/sensor_calibration_tool.py b/Python/OAK/datasets/oak-fcc-3/utils/sensor_calibration_tool.py index cb28b619c..1701248fe 100644 --- a/Python/OAK/datasets/oak-fcc-3/utils/sensor_calibration_tool.py +++ b/Python/OAK/datasets/oak-fcc-3/utils/sensor_calibration_tool.py @@ -889,6 +889,7 @@ def main(): parser.add_argument("--mock_nir", default="", help="Imagem mock para role nir") parser.add_argument("--offline_sample_json", default="", help="JSON de sample salvo para análise offline") parser.add_argument("--offline_save_dir", default="calibration/offline_samples", help="Pasta para salvar frames brutos offline") + parser.add_argument("--only_camera", default=None, choices=["CAM_A", "CAM_B", "CAM_C"]) args = parser.parse_args() cam = MultiSpectralClient( @@ -901,7 +902,8 @@ def main(): capture_mode=args.capture_mode, raw_policy=args.raw_policy, module_calibration_json=None, - radiometric_enabled=True, + radiometric_enabled=False, + only_camera=args.only_camera, ) offline_mode = bool(args.offline_sample_json)