-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_test.py
More file actions
49 lines (43 loc) · 1.21 KB
/
debug_test.py
File metadata and controls
49 lines (43 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import traceback
import sys
print("Step 1: importing cv2...")
import cv2
print("OK")
print("Step 2: importing mediapipe...")
import mediapipe as mp
print("OK")
print("Step 3: importing numpy...")
import numpy as np
print("OK")
print("Step 4: initializing MediaPipe Pose...")
try:
mp_pose = mp.solutions.pose
pose = mp_pose.Pose(
static_image_mode=False,
model_complexity=1,
smooth_landmarks=True,
min_detection_confidence=0.55,
min_tracking_confidence=0.5,
)
print("OK")
pose.close()
except Exception as e:
print(f"FAILED: {e}")
traceback.print_exc()
print("Step 5: reading one RTSP frame...")
try:
import os
os.environ["OPENCV_FFMPEG_CAPTURE_OPTIONS"] = "rtsp_transport;tcp|fflags;nobuffer|flags;low_delay"
cap = cv2.VideoCapture("rtsp://admin:admin@192.168.1.10/2", cv2.CAP_FFMPEG)
cap.set(cv2.CAP_PROP_BUFFERSIZE, 1)
ret, frame = cap.read()
if ret and frame is not None:
print(f"OK - got frame {frame.shape}")
else:
print("FAILED - cap.read() returned no frame")
cap.release()
except Exception as e:
print(f"FAILED: {e}")
traceback.print_exc()
print("\nAll steps done.")
input("Press Enter to exit...")