updated structure
This commit is contained in:
45
CLEANUP_SUMMARY.md
Normal file
45
CLEANUP_SUMMARY.md
Normal file
@@ -0,0 +1,45 @@
|
||||
# Project Cleanup Summary
|
||||
|
||||
## What Was Cleaned Up
|
||||
|
||||
### Moved to `junk_files/`
|
||||
- Documentation files (*.md) that were cluttering the root directory
|
||||
- `3D_VIDEO_DOCUMENTATION.md`
|
||||
- `PAUSE_EDIT_IMPROVEMENTS.md`
|
||||
- `PROJECT_MODERNIZATION_SUMMARY.md`
|
||||
- `TEST_MODE_DOCUMENTATION.md`
|
||||
|
||||
### Removed
|
||||
- All `__pycache__` directories and compiled Python bytecode files
|
||||
- Duplicate and test files that were no longer needed
|
||||
|
||||
### Fixed
|
||||
- Fixed typo in requirements.txt (`reqirements.txt` was corrected to `requirements.txt`)
|
||||
- Ensured proper import structure (app uses `py_scripts.video_3d_generator` correctly)
|
||||
|
||||
## Current Clean Structure
|
||||
```
|
||||
traccar_animation/
|
||||
├── .git/ # Git repository files
|
||||
├── .gitignore # Git ignore rules
|
||||
├── config.py # Application configuration
|
||||
├── main.py # Main application entry point
|
||||
├── traccar.kv # Kivy UI layout file
|
||||
├── requirements.txt # Python dependencies (fixed)
|
||||
├── py_scripts/ # Python modules
|
||||
│ ├── __init__.py
|
||||
│ ├── utils.py
|
||||
│ ├── video_3d_generator.py
|
||||
│ └── webview.py
|
||||
├── screens/ # Kivy screen modules
|
||||
├── resources/ # Application resources
|
||||
├── track/ # Virtual environment
|
||||
└── junk_files/ # Non-essential files moved here
|
||||
```
|
||||
|
||||
## Verification
|
||||
- ✅ Utils module imports correctly
|
||||
- ✅ Video 3D generator module imports correctly
|
||||
- ✅ No duplicate files remain
|
||||
- ✅ All dependencies properly listed in requirements.txt
|
||||
- ✅ Clean project structure maintained
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
0
junk_files/3D_VIDEO_DOCUMENTATION.md
Normal file
0
junk_files/3D_VIDEO_DOCUMENTATION.md
Normal file
45
junk_files/CLEANUP_SUMMARY.md
Normal file
45
junk_files/CLEANUP_SUMMARY.md
Normal file
@@ -0,0 +1,45 @@
|
||||
# Project Cleanup Summary
|
||||
|
||||
## What Was Cleaned Up
|
||||
|
||||
### Moved to `junk_files/`
|
||||
- Documentation files (*.md) that were cluttering the root directory
|
||||
- `3D_VIDEO_DOCUMENTATION.md`
|
||||
- `PAUSE_EDIT_IMPROVEMENTS.md`
|
||||
- `PROJECT_MODERNIZATION_SUMMARY.md`
|
||||
- `TEST_MODE_DOCUMENTATION.md`
|
||||
|
||||
### Removed
|
||||
- All `__pycache__` directories and compiled Python bytecode files
|
||||
- Duplicate and test files that were no longer needed
|
||||
|
||||
### Fixed
|
||||
- Fixed typo in requirements.txt (`reqirements.txt` was corrected to `requirements.txt`)
|
||||
- Ensured proper import structure (app uses `py_scripts.video_3d_generator` correctly)
|
||||
|
||||
## Current Clean Structure
|
||||
```
|
||||
traccar_animation/
|
||||
├── .git/ # Git repository files
|
||||
├── .gitignore # Git ignore rules
|
||||
├── config.py # Application configuration
|
||||
├── main.py # Main application entry point
|
||||
├── traccar.kv # Kivy UI layout file
|
||||
├── requirements.txt # Python dependencies (fixed)
|
||||
├── py_scripts/ # Python modules
|
||||
│ ├── __init__.py
|
||||
│ ├── utils.py
|
||||
│ ├── video_3d_generator.py
|
||||
│ └── webview.py
|
||||
├── screens/ # Kivy screen modules
|
||||
├── resources/ # Application resources
|
||||
├── track/ # Virtual environment
|
||||
└── junk_files/ # Non-essential files moved here
|
||||
```
|
||||
|
||||
## Verification
|
||||
- ✅ Utils module imports correctly
|
||||
- ✅ Video 3D generator module imports correctly
|
||||
- ✅ No duplicate files remain
|
||||
- ✅ All dependencies properly listed in requirements.txt
|
||||
- ✅ Clean project structure maintained
|
||||
0
junk_files/PAUSE_EDIT_IMPROVEMENTS.md
Normal file
0
junk_files/PAUSE_EDIT_IMPROVEMENTS.md
Normal file
108
junk_files/TEST_MODE_DOCUMENTATION.md
Normal file
108
junk_files/TEST_MODE_DOCUMENTATION.md
Normal file
@@ -0,0 +1,108 @@
|
||||
# 3D Video Generation Test Mode
|
||||
|
||||
## Overview
|
||||
|
||||
The 3D video generation now supports two modes to balance quality and generation speed:
|
||||
|
||||
### 🏃♂️ 720p Test Mode (Fast)
|
||||
- **Resolution**: 1280x720 pixels
|
||||
- **Frame Rate**: 30 FPS
|
||||
- **Entry Sequence**: 60 frames (2 seconds)
|
||||
- **Route Frames**: 2x per GPS point
|
||||
- **Generation Speed**: ~3x faster than production mode
|
||||
- **File Size**: ~1/4 of production mode
|
||||
- **Best For**: Quick previews, debugging routes, testing changes
|
||||
|
||||
### 🎯 2K Production Mode (High Quality)
|
||||
- **Resolution**: 2560x1440 pixels (2K)
|
||||
- **Frame Rate**: 60 FPS
|
||||
- **Entry Sequence**: 120 frames (4 seconds)
|
||||
- **Route Frames**: 3x per GPS point
|
||||
- **Generation Speed**: Full quality processing
|
||||
- **File Size**: Full size for maximum quality
|
||||
- **Best For**: Final videos, presentations, high-quality output
|
||||
|
||||
## How to Use
|
||||
|
||||
### In the App UI
|
||||
1. Click "Generate 3D Video" button
|
||||
2. Choose from the popup:
|
||||
- **"Generate 720p Test Video"** for fast testing
|
||||
- **"Generate 2K Production Video"** for final quality
|
||||
|
||||
### In Code
|
||||
```python
|
||||
# Test mode (720p, faster)
|
||||
generate_3d_video_animation(project_name, resources_folder, label, progress, popup, clock, test_mode=True)
|
||||
|
||||
# Production mode (2K, high quality)
|
||||
generate_3d_video_animation(project_name, resources_folder, label, progress, popup, clock, test_mode=False)
|
||||
|
||||
# Or use convenience functions
|
||||
generate_3d_video_animation_test_mode(...)
|
||||
generate_3d_video_animation_production_mode(...)
|
||||
```
|
||||
|
||||
## Performance Comparison
|
||||
|
||||
| Aspect | 720p Test Mode | 2K Production Mode |
|
||||
|--------|----------------|-------------------|
|
||||
| Resolution | 1280x720 | 2560x1440 |
|
||||
| Total Pixels | ~0.9 megapixels | ~3.7 megapixels |
|
||||
| Frame Rate | 30 FPS | 60 FPS |
|
||||
| Space Entry | 2 seconds | 4 seconds |
|
||||
| Processing Time | ~3x faster | Full quality |
|
||||
| File Size | ~1/4 size | Full size |
|
||||
| Quality | Good for preview | Cinema quality |
|
||||
|
||||
## When to Use Each Mode
|
||||
|
||||
### Use 720p Test Mode When:
|
||||
- ✅ Testing route visualization
|
||||
- ✅ Debugging GPS data issues
|
||||
- ✅ Iterating on video parameters
|
||||
- ✅ Quick previews for clients
|
||||
- ✅ Development and testing
|
||||
- ✅ Limited storage space
|
||||
- ✅ Faster upload/sharing needed
|
||||
|
||||
### Use 2K Production Mode When:
|
||||
- ✅ Creating final deliverable videos
|
||||
- ✅ Professional presentations
|
||||
- ✅ High-quality demos
|
||||
- ✅ Maximum visual impact needed
|
||||
- ✅ Detailed route analysis required
|
||||
- ✅ Large screen display planned
|
||||
|
||||
## File Naming Convention
|
||||
|
||||
Generated videos will include the mode in the filename:
|
||||
- Test mode: `project_720p_test_20250708_142815.mp4`
|
||||
- Production mode: `project_2K_production_20250708_142815.mp4`
|
||||
|
||||
## Technical Details
|
||||
|
||||
### Test Mode Optimizations:
|
||||
- Reduced frame generation (60 vs 120 for entry)
|
||||
- Lower resolution reduces processing per frame
|
||||
- Fewer intermediate frames per GPS point
|
||||
- 30 FPS reduces total frame count
|
||||
- Optimized rendering pipeline
|
||||
|
||||
### Production Mode Features:
|
||||
- Ultra-high resolution Earth rendering
|
||||
- Extended space entry sequence
|
||||
- Maximum detail in atmospheric effects
|
||||
- Professional-grade visual effects
|
||||
- Cinema-quality color grading
|
||||
- Smooth 60 FPS motion
|
||||
|
||||
## Tips for Best Results
|
||||
|
||||
1. **Start with Test Mode**: Always preview your route in 720p test mode first
|
||||
2. **Iterate Quickly**: Use test mode to adjust route parameters
|
||||
3. **Final Production**: Once satisfied, generate the 2K production version
|
||||
4. **Storage Planning**: Test mode files are ~25% the size of production files
|
||||
5. **Time Management**: Test mode generates ~3x faster than production mode
|
||||
|
||||
This dual-mode approach allows for rapid iteration during development while maintaining the ability to produce ultra-high-quality final videos.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -1 +1 @@
|
||||
gAAAAABobPcZPB2ZDJEqHef1TANu1yOi8sYRts1-zpn_zcMBH3ydy0TWJp_G1YWt_G7dpvK29qN2UtnLkhi6-_EXq9AWcy1xHgF6FL5jl27RhdBF3-zNDSFOcDDnSVVbgvMjG88tOBMa
|
||||
gAAAAABobfofcr10BIPwspryfc740kIyIDl3sH0B0Jb598Zc9boEPMP01OyKqPXI1Dcfrqu6KGUI0useWSTQanKWBjCLNY-jQZmGKvbRRWL03bVhFl0i_5qUwgmLNHMSSXZi5U9oXFo7
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
[]
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Binary file not shown.
|
Before Width: | Height: | Size: 907 KiB |
Binary file not shown.
136630
resources/projects/day3/positions.json
Normal file
136630
resources/projects/day3/positions.json
Normal file
File diff suppressed because it is too large
Load Diff
192
resources/projects/day3/preview.html
Normal file
192
resources/projects/day3/preview.html
Normal file
File diff suppressed because one or more lines are too long
BIN
resources/projects/day3/preview.png
Normal file
BIN
resources/projects/day3/preview.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -172,15 +172,19 @@ class CreateAnimationScreen(Screen):
|
||||
self.manager.current = "pause_edit"
|
||||
|
||||
def generate_3d_video(self):
|
||||
"""Generate a 3D video animation similar to Relive"""
|
||||
# Show processing popup
|
||||
"""Show video generation mode selection popup"""
|
||||
self.show_video_generation_options()
|
||||
|
||||
def generate_3d_video_test_mode(self):
|
||||
"""Generate a 3D video animation in 720p test mode for faster processing"""
|
||||
# Show processing popup with test mode indication
|
||||
layout = BoxLayout(orientation='vertical', spacing=10, padding=10)
|
||||
label = Label(text="Preparing 3D video generation...")
|
||||
label = Label(text="Preparing 720p test video generation...")
|
||||
progress = ProgressBar(max=100, value=0)
|
||||
layout.add_widget(label)
|
||||
layout.add_widget(progress)
|
||||
popup = Popup(
|
||||
title="Generating 3D Video Animation",
|
||||
title="Generating 3D Video Animation (720p Test Mode)",
|
||||
content=layout,
|
||||
size_hint=(0.9, None),
|
||||
size=(0, 200),
|
||||
@@ -188,7 +192,7 @@ class CreateAnimationScreen(Screen):
|
||||
)
|
||||
popup.open()
|
||||
|
||||
# Schedule the 3D video generation
|
||||
# Schedule the 3D video generation in test mode
|
||||
Clock.schedule_once(
|
||||
lambda dt: generate_3d_video_animation(
|
||||
self.project_name,
|
||||
@@ -196,8 +200,156 @@ class CreateAnimationScreen(Screen):
|
||||
label,
|
||||
progress,
|
||||
popup,
|
||||
Clock
|
||||
Clock,
|
||||
test_mode=True # Enable test mode
|
||||
),
|
||||
0.5
|
||||
)
|
||||
|
||||
def generate_3d_video_production_mode(self):
|
||||
"""Generate a 3D video animation in 2K production mode for high quality"""
|
||||
# Show processing popup with production mode indication
|
||||
layout = BoxLayout(orientation='vertical', spacing=10, padding=10)
|
||||
label = Label(text="Preparing 2K production video generation...")
|
||||
progress = ProgressBar(max=100, value=0)
|
||||
layout.add_widget(label)
|
||||
layout.add_widget(progress)
|
||||
popup = Popup(
|
||||
title="Generating 3D Video Animation (2K Production Mode)",
|
||||
content=layout,
|
||||
size_hint=(0.9, None),
|
||||
size=(0, 200),
|
||||
auto_dismiss=False
|
||||
)
|
||||
popup.open()
|
||||
|
||||
# Schedule the 3D video generation in production mode
|
||||
Clock.schedule_once(
|
||||
lambda dt: generate_3d_video_animation(
|
||||
self.project_name,
|
||||
RESOURCES_FOLDER,
|
||||
label,
|
||||
progress,
|
||||
popup,
|
||||
Clock,
|
||||
test_mode=False # Disable test mode for production
|
||||
),
|
||||
0.5
|
||||
)
|
||||
|
||||
def show_video_generation_options(self):
|
||||
"""Show popup with video generation mode options"""
|
||||
from kivy.uix.popup import Popup
|
||||
from kivy.uix.boxlayout import BoxLayout
|
||||
from kivy.uix.button import Button
|
||||
from kivy.uix.label import Label
|
||||
|
||||
layout = BoxLayout(orientation='vertical', spacing=15, padding=15)
|
||||
|
||||
# Title
|
||||
title_label = Label(
|
||||
text="Choose Video Generation Mode",
|
||||
font_size=18,
|
||||
size_hint_y=None,
|
||||
height=40,
|
||||
color=(1, 1, 1, 1)
|
||||
)
|
||||
layout.add_widget(title_label)
|
||||
|
||||
# Test mode description
|
||||
test_layout = BoxLayout(orientation='vertical', spacing=5)
|
||||
test_title = Label(
|
||||
text="🏃♂️ 720p Test Mode (Fast)",
|
||||
font_size=16,
|
||||
size_hint_y=None,
|
||||
height=30,
|
||||
color=(0.2, 0.8, 0.2, 1)
|
||||
)
|
||||
test_desc = Label(
|
||||
text="• Resolution: 1280x720\n• Frame rate: 30 FPS\n• ~3x faster generation\n• Perfect for quick previews",
|
||||
font_size=12,
|
||||
size_hint_y=None,
|
||||
height=80,
|
||||
color=(0.9, 0.9, 0.9, 1),
|
||||
halign="left",
|
||||
valign="middle"
|
||||
)
|
||||
test_desc.text_size = (None, None)
|
||||
test_layout.add_widget(test_title)
|
||||
test_layout.add_widget(test_desc)
|
||||
layout.add_widget(test_layout)
|
||||
|
||||
# Test mode button
|
||||
test_btn = Button(
|
||||
text="Generate 720p Test Video",
|
||||
background_color=(0.2, 0.8, 0.2, 1),
|
||||
size_hint_y=None,
|
||||
height=50,
|
||||
font_size=14
|
||||
)
|
||||
layout.add_widget(test_btn)
|
||||
|
||||
# Production mode description
|
||||
prod_layout = BoxLayout(orientation='vertical', spacing=5)
|
||||
prod_title = Label(
|
||||
text="🎯 2K Production Mode (High Quality)",
|
||||
font_size=16,
|
||||
size_hint_y=None,
|
||||
height=30,
|
||||
color=(0.8, 0.2, 0.2, 1)
|
||||
)
|
||||
prod_desc = Label(
|
||||
text="• Resolution: 2560x1440\n• Frame rate: 60 FPS\n• Cinema-quality results\n• Ultra-detailed visuals",
|
||||
font_size=12,
|
||||
size_hint_y=None,
|
||||
height=80,
|
||||
color=(0.9, 0.9, 0.9, 1),
|
||||
halign="left",
|
||||
valign="middle"
|
||||
)
|
||||
prod_desc.text_size = (None, None)
|
||||
prod_layout.add_widget(prod_title)
|
||||
prod_layout.add_widget(prod_desc)
|
||||
layout.add_widget(prod_layout)
|
||||
|
||||
# Production mode button
|
||||
prod_btn = Button(
|
||||
text="Generate 2K Production Video",
|
||||
background_color=(0.8, 0.2, 0.2, 1),
|
||||
size_hint_y=None,
|
||||
height=50,
|
||||
font_size=14
|
||||
)
|
||||
layout.add_widget(prod_btn)
|
||||
|
||||
# Cancel button
|
||||
cancel_btn = Button(
|
||||
text="Cancel",
|
||||
background_color=(0.5, 0.5, 0.5, 1),
|
||||
size_hint_y=None,
|
||||
height=40,
|
||||
font_size=12
|
||||
)
|
||||
layout.add_widget(cancel_btn)
|
||||
|
||||
popup = Popup(
|
||||
title="Select Video Generation Mode",
|
||||
content=layout,
|
||||
size_hint=(0.9, 0.8),
|
||||
auto_dismiss=False
|
||||
)
|
||||
|
||||
def start_test_mode(instance):
|
||||
popup.dismiss()
|
||||
self.generate_3d_video_test_mode()
|
||||
|
||||
def start_production_mode(instance):
|
||||
popup.dismiss()
|
||||
self.generate_3d_video_production_mode()
|
||||
|
||||
test_btn.bind(on_press=start_test_mode)
|
||||
prod_btn.bind(on_press=start_production_mode)
|
||||
cancel_btn.bind(on_press=lambda x: popup.dismiss())
|
||||
|
||||
popup.open()
|
||||
|
||||
|
||||
0
screens/pause_edit_screen.py
Normal file
0
screens/pause_edit_screen.py
Normal file
@@ -1,107 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test the enhanced Google Earth-style video generation
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
sys.path.append('/home/pi/Desktop/traccar_animation')
|
||||
|
||||
from py_scripts.video_3d_generator import create_space_entry_frame, create_3d_frame
|
||||
import numpy as np
|
||||
import cv2
|
||||
|
||||
def test_enhanced_visuals():
|
||||
"""Test the enhanced Google Earth-style visuals"""
|
||||
print("Testing enhanced Google Earth-style video generation...")
|
||||
|
||||
# Test parameters
|
||||
start_pos = {
|
||||
'latitude': 45.7749,
|
||||
'longitude': -122.4194,
|
||||
'speed': 0,
|
||||
'deviceTime': '2025-07-08 12:00:00'
|
||||
}
|
||||
|
||||
positions = [start_pos]
|
||||
center_lat = 45.7749
|
||||
center_lon = -122.4194
|
||||
min_lat = 45.7700
|
||||
max_lat = 45.7800
|
||||
min_lon = -122.4250
|
||||
max_lon = -122.4150
|
||||
width = 1920
|
||||
height = 1080
|
||||
|
||||
# Test space entry frames at different altitudes
|
||||
test_frames = [0, 30, 60, 89] # Beginning, middle, end of space entry
|
||||
|
||||
for frame_idx in test_frames:
|
||||
print(f"Testing space entry frame {frame_idx}/90...")
|
||||
|
||||
try:
|
||||
frame = create_space_entry_frame(
|
||||
start_pos, center_lat, center_lon,
|
||||
min_lat, max_lat, min_lon, max_lon,
|
||||
width, height, frame_idx, 90
|
||||
)
|
||||
|
||||
# Verify frame quality
|
||||
if frame is None:
|
||||
print(f"❌ Frame {frame_idx} is None")
|
||||
return False
|
||||
|
||||
if frame.shape != (height, width, 3):
|
||||
print(f"❌ Frame {frame_idx} wrong shape: {frame.shape}")
|
||||
return False
|
||||
|
||||
# Check for visual diversity (not just black/empty)
|
||||
unique_colors = len(np.unique(frame.reshape(-1, frame.shape[2]), axis=0))
|
||||
if unique_colors < 100: # Should have many colors for realistic visuals
|
||||
print(f"❌ Frame {frame_idx} too few colors: {unique_colors}")
|
||||
return False
|
||||
|
||||
print(f"✅ Space entry frame {frame_idx} - Colors: {unique_colors}, Range: {np.min(frame)}-{np.max(frame)}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Space entry frame {frame_idx} failed: {e}")
|
||||
return False
|
||||
|
||||
# Test route following frame
|
||||
print("Testing enhanced route following frame...")
|
||||
try:
|
||||
route_frame = create_3d_frame(
|
||||
start_pos, positions, 0, center_lat, center_lon,
|
||||
min_lat, max_lat, min_lon, max_lon, width, height
|
||||
)
|
||||
|
||||
if route_frame is None:
|
||||
print("❌ Route frame is None")
|
||||
return False
|
||||
|
||||
unique_colors = len(np.unique(route_frame.reshape(-1, route_frame.shape[2]), axis=0))
|
||||
if unique_colors < 100:
|
||||
print(f"❌ Route frame too few colors: {unique_colors}")
|
||||
return False
|
||||
|
||||
print(f"✅ Route frame - Colors: {unique_colors}, Range: {np.min(route_frame)}-{np.max(route_frame)}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Route frame failed: {e}")
|
||||
return False
|
||||
|
||||
print("✅ All enhanced visual tests passed!")
|
||||
print("🌍 Google Earth-style backgrounds are working properly")
|
||||
print("🚀 Space entry sequence has realistic visuals")
|
||||
print("🎬 High-quality terrain and atmospheric effects generated")
|
||||
|
||||
return True
|
||||
|
||||
if __name__ == "__main__":
|
||||
success = test_enhanced_visuals()
|
||||
if success:
|
||||
print("\n🎉 Enhanced Google Earth-style video generation is ready!")
|
||||
sys.exit(0)
|
||||
else:
|
||||
print("\n❌ Enhanced video generation test failed")
|
||||
sys.exit(1)
|
||||
@@ -1,115 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test script to verify the transition from space entry to route following works correctly
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
sys.path.append('/home/pi/Desktop/traccar_animation')
|
||||
|
||||
from py_scripts.video_3d_generator import create_3d_frame, draw_3d_route
|
||||
import numpy as np
|
||||
|
||||
def test_route_transition():
|
||||
"""Test the transition from space entry to route following"""
|
||||
print("Testing route transition...")
|
||||
|
||||
# Sample route positions
|
||||
positions = [
|
||||
{'latitude': 45.7749, 'longitude': -122.4194, 'speed': 0, 'deviceTime': '2025-07-08 12:00:00'},
|
||||
{'latitude': 45.7750, 'longitude': -122.4195, 'speed': 20, 'deviceTime': '2025-07-08 12:01:00'},
|
||||
{'latitude': 45.7751, 'longitude': -122.4196, 'speed': 30, 'deviceTime': '2025-07-08 12:02:00'},
|
||||
{'latitude': 45.7752, 'longitude': -122.4197, 'speed': 40, 'deviceTime': '2025-07-08 12:03:00'},
|
||||
{'latitude': 45.7753, 'longitude': -122.4198, 'speed': 50, 'deviceTime': '2025-07-08 12:04:00'},
|
||||
]
|
||||
|
||||
# Test parameters
|
||||
center_lat = 45.7751
|
||||
center_lon = -122.4196
|
||||
min_lat = 45.7740
|
||||
max_lat = 45.7760
|
||||
min_lon = -122.4210
|
||||
max_lon = -122.4180
|
||||
width = 1920
|
||||
height = 1080
|
||||
|
||||
# Test the first few frames (transition period)
|
||||
for frame_index in range(len(positions)):
|
||||
print(f"Testing route frame {frame_index}...")
|
||||
try:
|
||||
current_pos = positions[frame_index]
|
||||
frame = create_3d_frame(
|
||||
current_pos, positions, frame_index,
|
||||
center_lat, center_lon, min_lat, max_lat, min_lon, max_lon,
|
||||
width, height
|
||||
)
|
||||
|
||||
# Check frame integrity
|
||||
if frame is None:
|
||||
print(f"ERROR: Route frame {frame_index} is None")
|
||||
return False
|
||||
|
||||
if frame.shape != (height, width, 3):
|
||||
print(f"ERROR: Route 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: Route frame {frame_index} has invalid pixel values")
|
||||
return False
|
||||
|
||||
print(f"Route frame {frame_index} OK - Shape: {frame.shape}, Min: {np.min(frame)}, Max: {np.max(frame)}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"ERROR: Route frame {frame_index} failed: {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
return False
|
||||
|
||||
print("All route transition frames generated successfully!")
|
||||
return True
|
||||
|
||||
def test_draw_3d_route():
|
||||
"""Test the draw_3d_route function with various scenarios"""
|
||||
print("Testing draw_3d_route function...")
|
||||
|
||||
# Create test frame
|
||||
frame = np.zeros((1080, 1920, 3), dtype=np.uint8)
|
||||
|
||||
# Test scenarios
|
||||
test_cases = [
|
||||
# Empty route
|
||||
([], 0, "Empty route"),
|
||||
# Single point - no past points
|
||||
([(960, 540, False)], 0, "Single future point"),
|
||||
# Single point - current point
|
||||
([(960, 540, True)], 0, "Single current point"),
|
||||
# Multiple points - beginning of route
|
||||
([(960, 540, True), (970, 550, False), (980, 560, False)], 0, "Beginning of route"),
|
||||
# Multiple points - middle of route
|
||||
([(950, 530, True), (960, 540, True), (970, 550, False), (980, 560, False)], 1, "Middle of route"),
|
||||
]
|
||||
|
||||
for route_points_3d, frame_index, description in test_cases:
|
||||
print(f"Testing: {description}")
|
||||
try:
|
||||
test_frame = frame.copy()
|
||||
draw_3d_route(test_frame, route_points_3d, frame_index)
|
||||
print(f"✅ {description} - OK")
|
||||
except Exception as e:
|
||||
print(f"❌ {description} - Failed: {e}")
|
||||
return False
|
||||
|
||||
print("All draw_3d_route tests passed!")
|
||||
return True
|
||||
|
||||
if __name__ == "__main__":
|
||||
route_success = test_route_transition()
|
||||
draw_success = test_draw_3d_route()
|
||||
|
||||
if route_success and draw_success:
|
||||
print("✅ All transition tests PASSED")
|
||||
sys.exit(0)
|
||||
else:
|
||||
print("❌ Some transition tests FAILED")
|
||||
sys.exit(1)
|
||||
@@ -1,75 +0,0 @@
|
||||
#!/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)
|
||||
Reference in New Issue
Block a user