still updating the 3d video

This commit is contained in:
2025-07-08 15:26:33 +03:00
parent 2532bf6219
commit a565cd67e1
14 changed files with 1180 additions and 150 deletions

75
test_video_generator.py Normal file
View File

@@ -0,0 +1,75 @@
#!/usr/bin/env python3
"""
Test script to verify the enhanced 3D video generator works without overflow errors
"""
import sys
import os
sys.path.append('/home/pi/Desktop/traccar_animation')
from py_scripts.video_3d_generator import create_space_entry_frame
import numpy as np
def test_space_entry_frame():
"""Test the space entry frame generation"""
print("Testing space entry frame generation...")
# Sample position data
start_pos = {
'latitude': 45.7749,
'longitude': -122.4194,
'speed': 50,
'deviceTime': '2025-07-08 12:00:00'
}
# Test parameters
center_lat = 45.7749
center_lon = -122.4194
min_lat = 45.7000
max_lat = 45.8500
min_lon = -122.5000
max_lon = -122.3500
width = 1920
height = 1080
# Test multiple frames to ensure no overflow
for frame_index in range(0, 90, 10): # Test every 10th frame
print(f"Testing frame {frame_index}/90...")
try:
frame = create_space_entry_frame(
start_pos, center_lat, center_lon,
min_lat, max_lat, min_lon, max_lon,
width, height, frame_index, 90
)
# Check frame integrity
if frame is None:
print(f"ERROR: Frame {frame_index} is None")
return False
if frame.shape != (height, width, 3):
print(f"ERROR: Frame {frame_index} has wrong shape: {frame.shape}")
return False
# Check for valid pixel values
if np.any(frame < 0) or np.any(frame > 255):
print(f"ERROR: Frame {frame_index} has invalid pixel values")
return False
print(f"Frame {frame_index} OK - Shape: {frame.shape}, Min: {np.min(frame)}, Max: {np.max(frame)}")
except Exception as e:
print(f"ERROR: Frame {frame_index} failed: {e}")
return False
print("All space entry frames generated successfully!")
return True
if __name__ == "__main__":
success = test_space_entry_frame()
if success:
print("✅ Space entry frame generation test PASSED")
sys.exit(0)
else:
print("❌ Space entry frame generation test FAILED")
sys.exit(1)