2026.6.9小更新
This commit is contained in:
@@ -10,6 +10,7 @@ from ais_bench.infer.interface import InferSession
|
|||||||
# ==================== 配置区域 ======================
|
# ==================== 配置区域 ======================
|
||||||
MODEL_PATH = "./om/yolo26n-balloon.om" # YOLO26 模型路径
|
MODEL_PATH = "./om/yolo26n-balloon.om" # YOLO26 模型路径
|
||||||
INPUT_VIDEO = "./asset/test_video.mp4" # 输入的测试视频
|
INPUT_VIDEO = "./asset/test_video.mp4" # 输入的测试视频
|
||||||
|
RTSP_URL = "rtsp://192.168.144.25:8554/main.264"
|
||||||
CONF_THRESHOLD = 0.25 # 置信度阈值
|
CONF_THRESHOLD = 0.25 # 置信度阈值
|
||||||
|
|
||||||
# -------------- 无线图传网络配置 --------------
|
# -------------- 无线图传网络配置 --------------
|
||||||
@@ -106,11 +107,13 @@ def draw_boxes(img, detections):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
detector = YOLO26UAVInfer(MODEL_PATH)
|
detector = YOLO26UAVInfer(MODEL_PATH)
|
||||||
cap = cv2.VideoCapture(INPUT_VIDEO)
|
|
||||||
from control import UAVController
|
from control import UAVController
|
||||||
|
|
||||||
uav = UAVController()
|
uav = UAVController()
|
||||||
|
os.environ['OPENCV_FFMPEG_CAPTURE_OPTIONS'] = 'rtsp_transport;tcp'
|
||||||
|
cap = cv2.VideoCapture(RTSP_URL,cv2.CAP_FFMPEG)
|
||||||
|
if not cap.isOpened():
|
||||||
|
cap = cv2.VideoCapture(INPUT_VIDEO)
|
||||||
|
print("❌ 网口连接失败")
|
||||||
if not cap.isOpened():
|
if not cap.isOpened():
|
||||||
print("❌ 无法打开视频源")
|
print("❌ 无法打开视频源")
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import cv2
|
||||||
|
import os
|
||||||
|
|
||||||
|
os.environ['OPENCV_FFMPEG_CAPTURE_OPTIONS'] = 'rtsp_transport;tcp'
|
||||||
|
|
||||||
|
# 改用正确的地址
|
||||||
|
rtsp_url = "rtsp://192.168.144.25:8554/main.264"
|
||||||
|
|
||||||
|
print(f"[测试] 正在尝试连接: {rtsp_url}")
|
||||||
|
cap = cv2.VideoCapture(rtsp_url, cv2.CAP_FFMPEG)
|
||||||
|
|
||||||
|
if not cap.isOpened():
|
||||||
|
print("[结果] 无法打开视频流。")
|
||||||
|
else:
|
||||||
|
ret, frame = cap.read()
|
||||||
|
if not ret or frame is None:
|
||||||
|
print("[结果] 读取帧失败,视频流可能为空。")
|
||||||
|
else:
|
||||||
|
print(f"[结果] 成功读取第一帧!图像尺寸为: {frame.shape}")
|
||||||
|
cap.release()
|
||||||
Reference in New Issue
Block a user