forked from Munna-Manoj/SQPnP_G
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_repository.sh
More file actions
executable file
ยท329 lines (260 loc) ยท 9.13 KB
/
update_repository.sh
File metadata and controls
executable file
ยท329 lines (260 loc) ยท 9.13 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
#!/bin/bash
# SQPnP Repository Update Script
# This script helps update your GitHub repository with Python bindings and new documentation
set -e # Exit on any error
echo "๐ SQPnP Repository Update Script"
echo "=================================="
echo ""
# Function to check if we're in a git repository
check_git_repo() {
if ! git rev-parse --git-dir > /dev/null 2>&1; then
echo "โ Error: Not in a git repository"
echo "Please run this script from the root of your SQPnP repository"
exit 1
fi
echo "โ
Git repository detected"
}
# Function to check git status
check_git_status() {
echo ""
echo "๐ Current Git Status:"
git status --short
echo ""
echo "๐ Recent commits:"
git log --oneline -5
}
# Function to clean compiled files
clean_compiled_files() {
echo ""
echo "๐งน Cleaning compiled files..."
# Remove compiled Python files
find . -name "*.so" -delete
find . -name "*.pyd" -delete
find . -name "*.o" -delete
find . -name "*.a" -delete
# Remove Python cache
find . -name "__pycache__" -type d -exec rm -rf {} + 2>/dev/null || true
find . -name "*.pyc" -delete
# Remove build directories
rm -rf build/ dist/ *.egg-info/ 2>/dev/null || true
echo "โ
Compiled files cleaned"
}
# Function to add new files
add_new_files() {
echo ""
echo "๐ Adding new files to git..."
# Add all new files
git add .
echo "โ
Files added to staging area"
}
# Function to show what will be committed
show_changes() {
echo ""
echo "๐ Changes to be committed:"
git diff --cached --name-status
echo ""
echo "๐ Summary of changes:"
echo "- Updated main README.md with comprehensive documentation"
echo "- Added Python bindings with pybind11"
echo "- Created comprehensive .gitignore file"
echo "- Updated Python bindings README with detailed instructions"
echo "- Added installation script for Python bindings"
echo "- Updated requirements.txt with all dependencies"
echo "- Enhanced example usage with comprehensive tests"
echo "- Added real-time head pose estimation demo"
echo "- Added demo screenshots in assests/ folder"
}
# Function to commit changes
commit_changes() {
echo ""
echo "๐พ Committing changes..."
# Create commit message
commit_msg="feat: Add Python bindings and comprehensive documentation
- Add Python bindings using pybind11 for easy integration
- Create comprehensive README.md with C++ and Python usage
- Add detailed Python bindings documentation and examples
- Include real-time head pose estimation demo
- Add installation script for automated setup
- Update project structure and add .gitignore
- Include demo screenshots and assets
- Add comprehensive testing and benchmarking examples
Python bindings features:
- Support for pinhole, fisheye, and distortion camera models
- Integrated RANSAC for robust estimation
- High-performance C++ bindings with minimal overhead
- Real-time head pose estimation with MediaPipe integration
- Comprehensive error handling and validation
Breaking changes: None
Migration guide: See README.md for installation instructions"
git commit -m "$commit_msg"
echo "โ
Changes committed successfully"
}
# Function to push to remote
push_changes() {
echo ""
echo "๐ Pushing to remote repository..."
# Get current branch
current_branch=$(git branch --show-current)
echo "Current branch: $current_branch"
# Ask user if they want to push
read -p "Do you want to push to remote repository? (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
git push origin "$current_branch"
echo "โ
Changes pushed to remote repository"
else
echo "โญ๏ธ Skipping push to remote"
fi
}
# Function to create release notes
create_release_notes() {
echo ""
echo "๐ Creating release notes..."
cat > RELEASE_NOTES.md << 'EOF'
# SQPnP v2.0.0 - Python Bindings Release
## ๐ What's New
This major release adds comprehensive Python bindings to the SQPnP library, making it accessible to a wider audience of researchers and developers.
### โจ New Features
#### Python Bindings
- **Easy-to-use Python API**: Simple interface with NumPy arrays
- **Multiple camera models**: Support for pinhole, fisheye, and distortion models
- **Integrated RANSAC**: Robust estimation with outlier rejection
- **High performance**: Direct C++ bindings with minimal overhead
- **Real-time demo**: Live head pose estimation with webcam
#### Documentation & Examples
- **Comprehensive README**: Updated with both C++ and Python usage
- **Detailed API reference**: Complete documentation for all features
- **Installation scripts**: Automated setup for different platforms
- **Real-time demo**: Head pose estimation with MediaPipe integration
- **Performance benchmarks**: Comprehensive testing and optimization
#### Developer Experience
- **Automated installation**: Cross-platform install script
- **Comprehensive testing**: Unit tests and integration tests
- **Error handling**: Robust validation and error reporting
- **Performance optimization**: Optimized for real-time applications
### ๐ง Installation
#### C++ (Existing)
```bash
mkdir build && cd build
cmake ..
make -j4
```
#### Python (New)
```bash
cd python_bindings
pip install -e .
```
### ๐ Quick Start
#### Python Usage
```python
import numpy as np
import sqpnp_python
# Create solver and solve PnP
solver = sqpnp_python.SQPnPSolver()
result = solver.solve_pinhole(points_3d, points_2d, camera_params)
if result.success:
print(f"Rotation: {result.rotation}")
print(f"Translation: {result.translation}")
```
#### Real-time Demo
```bash
python adapter.py
```
### ๐ฎ Demo Features
- Real-time face detection using MediaPipe
- 3D head pose estimation using SQPnP
- Visual axes overlay on the face
- Performance metrics (FPS, CPU usage)
- Support for different landmark subsets
### ๐ Performance
- **C++**: Optimized for embedded devices and real-time applications
- **Python**: Minimal overhead with direct C++ bindings
- **RANSAC**: Integrated outlier rejection for robust estimation
- **Multi-threading**: Support for parallel processing
### ๐ Migration Guide
No breaking changes for existing C++ users. Python users can start with the new bindings immediately.
### ๐ Documentation
- [Main README](README.md) - Comprehensive project overview
- [C++ API Documentation](CLEAN_README.md) - Detailed C++ usage
- [Python API Documentation](python_bindings/README.md) - Python bindings guide
- [Real-time Demo](adapter.py) - Live head pose estimation
### ๐ Acknowledgments
- Original SQPnP implementation by G. Terzakis and M. Lourakis
- RANSAC implementation from RansacLib
- Python bindings using pybind11
- Real-time demo using MediaPipe Face Mesh
### ๐ License
Same as the original SQPnP project.
---
**Note**: This release maintains full backward compatibility with existing C++ code while adding powerful new Python capabilities.
EOF
echo "โ
Release notes created in RELEASE_NOTES.md"
}
# Function to show next steps
show_next_steps() {
echo ""
echo "๐ฏ Next Steps:"
echo "=============="
echo ""
echo "1. ๐ Review the changes:"
echo " git diff HEAD~1"
echo ""
echo "2. ๐งช Test the installation:"
echo " cd python_bindings && python test_sqpnp.py"
echo ""
echo "3. ๐ฎ Try the real-time demo:"
echo " python adapter.py"
echo ""
echo "4. ๐ Update your GitHub repository:"
echo " - Create a new release with RELEASE_NOTES.md"
echo " - Update repository description and topics"
echo " - Add badges for build status and Python version"
echo ""
echo "5. ๐ Update external documentation:"
echo " - Update any external references to your repository"
echo " - Share with the computer vision community"
echo ""
echo "6. ๐ง Consider additional improvements:"
echo " - Add CI/CD pipeline for automated testing"
echo " - Create conda package for easier distribution"
echo " - Add more camera models and features"
echo ""
echo "โ
Repository update completed successfully!"
}
# Main execution
main() {
echo "Starting repository update process..."
echo ""
# Check if we're in a git repository
check_git_repo
# Show current status
check_git_status
# Clean compiled files
clean_compiled_files
# Add new files
add_new_files
# Show changes
show_changes
# Ask for confirmation
echo ""
read -p "Do you want to commit these changes? (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
# Commit changes
commit_changes
# Create release notes
create_release_notes
# Push to remote
push_changes
# Show next steps
show_next_steps
else
echo "โญ๏ธ Update cancelled"
echo "You can manually commit the changes later with:"
echo " git add ."
echo " git commit -m 'Your commit message'"
echo " git push origin main"
fi
}
# Run main function
main "$@"