去除FFMPEG后端
This commit is contained in:
@@ -2,6 +2,7 @@ import cv2
|
||||
from PyQt5.QtCore import qDebug, QMutex
|
||||
|
||||
from .base_thread import BaseThread
|
||||
from . import param_settings as settings
|
||||
|
||||
|
||||
class CameraProcessingThread(BaseThread):
|
||||
@@ -47,10 +48,28 @@ class CameraProcessingThread(BaseThread):
|
||||
|
||||
self.processing_mutex.lock()
|
||||
raw_frame = self.capture_buffer_manager.get_device(self.device_id).get()
|
||||
|
||||
# Validate frame before processing
|
||||
if raw_frame.image is None or raw_frame.image.size == 0:
|
||||
self.processing_mutex.unlock()
|
||||
continue
|
||||
|
||||
und_frame = self.camera_model.undistort(raw_frame.image)
|
||||
pro_frame = self.camera_model.project(und_frame)
|
||||
flip_frame = self.camera_model.flip(pro_frame)
|
||||
self.processing_mutex.unlock()
|
||||
|
||||
# Check if the processed frame has valid dimensions
|
||||
name = self.camera_model.camera_name
|
||||
if name in settings.project_shapes:
|
||||
# For left and right cameras, the flip operation changes the shape
|
||||
if name in ['left', 'right']:
|
||||
expected_shape = settings.project_shapes[name] + (3,)
|
||||
else:
|
||||
expected_shape = settings.project_shapes[name][::-1] + (3,)
|
||||
if flip_frame.shape != expected_shape:
|
||||
print(f"Warning: {name} camera frame has unexpected shape {flip_frame.shape}, expected {expected_shape}")
|
||||
continue
|
||||
|
||||
self.proc_buffer_manager.sync(self.device_id)
|
||||
self.proc_buffer_manager.set_frame_for_device(self.device_id, flip_frame)
|
||||
|
||||
Reference in New Issue
Block a user