web前备份

This commit is contained in:
2025-12-23 09:18:32 +08:00
parent d8b28c238b
commit 4961794bf5
26 changed files with 1124 additions and 232 deletions

View File

@@ -11,7 +11,7 @@ class CaptureThread(BaseThread):
device_id,
flip_method=0,
drop_if_full=True,
api_preference=cv2.CAP_ANY,
api_preference=cv2.CAP_V4L2,
resolution=None,
parent=None):
"""

View File

@@ -76,10 +76,33 @@ class FisheyeCameraModel(object):
result = cv2.remap(image, *self.undistort_maps, interpolation=cv2.INTER_LINEAR,
borderMode=cv2.BORDER_CONSTANT)
return result
# def undistort(self, image):
# uimg = cv2.UMat(image)
# uresult = cv2.remap(
# uimg,
# *self.undistort_maps,
# interpolation=cv2.INTER_LINEAR,
# borderMode=cv2.BORDER_CONSTANT,
# borderValue=(0, 0, 0)
# )
# return uresult.get()
# def project(self, image):
# result = cv2.warpPerspective(image, self.project_matrix, self.project_shape)
# return result
def project(self, image):
result = cv2.warpPerspective(image, self.project_matrix, self.project_shape)
return result
# 转为 UMat触发 GPU 路径)
uimg = cv2.UMat(image)
uresult = cv2.warpPerspective(
uimg,
self.project_matrix,
self.project_shape,
flags=cv2.INTER_LINEAR,
borderMode=cv2.BORDER_CONSTANT,
borderValue=(0, 0, 0)
)
return uresult.get() # 转回 numpy array 供后续使用
def flip(self, image):
if self.camera_name == "front":

View File

@@ -8,6 +8,7 @@ def gstreamer_pipeline(cam_id=0,
framerate=30,
format="YUYV",
):
print("11111111233333333333545656646464646")
"""
Use libgstreamer to open csi-cameras.
"""
@@ -17,7 +18,6 @@ def gstreamer_pipeline(cam_id=0,
"videoconvert ! "
"video/x-raw,format=YUYV ! " # 转为 OpenCV 能直接用的 BGR 格式
"appsink"
)