Update README.md
Browse files
README.md
CHANGED
@@ -1,134 +1,9 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
📍 **Repository source** : [SoccerNet Camera Calibration](https://github.com/SoccerNet/sn-calibration) [Marc Gutiérrez-Pérez](https://github.com/mguti97/PnLCalib)
|
11 |
-
📖 **Paper** : SoccerNet Camera Calibration Challenge
|
12 |
-
👥 **Auteurs** : Équipe SoccerNet
|
13 |
-
|
14 |
-
## Fonctionnalités
|
15 |
-
|
16 |
-
✅ Calibration automatique de caméras à partir d'images de terrain de football
|
17 |
-
✅ API REST avec FastAPI
|
18 |
-
✅ Support des formats d'image : JPG, PNG
|
19 |
-
|
20 |
-
## Installation locale
|
21 |
-
|
22 |
-
```bash
|
23 |
-
# Cloner le repository
|
24 |
-
git clone https://github.com/2nzi/PnLCalib.git
|
25 |
-
cd PnLCalib
|
26 |
-
|
27 |
-
# Installer les dépendances
|
28 |
-
pip install -r requirements.txt
|
29 |
-
|
30 |
-
# Lancer l'API
|
31 |
-
python run_api.py
|
32 |
-
```
|
33 |
-
|
34 |
-
L'API sera accessible sur : http://localhost:8000
|
35 |
-
|
36 |
-
## Utilisation
|
37 |
-
|
38 |
-
### Endpoint principal : `/calibrate`
|
39 |
-
|
40 |
-
**POST** `/calibrate` - Calibrer une caméra à partir d'une image et de lignes du terrain
|
41 |
-
|
42 |
-
**Paramètres :**
|
43 |
-
- `image` : Fichier image (multipart/form-data)
|
44 |
-
- `lines_data` : JSON des lignes du terrain (string)
|
45 |
-
|
46 |
-
### Exemple d'utilisation
|
47 |
-
|
48 |
-
#### Avec JavaScript/Fetch
|
49 |
-
```javascript
|
50 |
-
const formData = new FormData();
|
51 |
-
formData.append('image', imageFile);
|
52 |
-
formData.append('lines_data', JSON.stringify({
|
53 |
-
"Big rect. right top": [
|
54 |
-
{"x": 1342.88, "y": 1076.99},
|
55 |
-
{"x": 1484.74, "y": 906.37}
|
56 |
-
],
|
57 |
-
"Big rect. right main": [
|
58 |
-
{"x": 1484.74, "y": 906.37},
|
59 |
-
{"x": 1049.62, "y": 748.02}
|
60 |
-
],
|
61 |
-
"Circle central": [
|
62 |
-
{"x": 1580.73, "y": 269.84},
|
63 |
-
{"x": 1533.83, "y": 288.86}
|
64 |
-
]
|
65 |
-
// ... autres lignes
|
66 |
-
}));
|
67 |
-
|
68 |
-
const response = await fetch('http://localhost:8000/calibrate', {
|
69 |
-
method: 'POST',
|
70 |
-
body: formData
|
71 |
-
});
|
72 |
-
|
73 |
-
const result = await response.json();
|
74 |
-
console.log('Paramètres de calibration:', result.camera_parameters);
|
75 |
-
```
|
76 |
-
|
77 |
-
#### Avec curl
|
78 |
-
```bash
|
79 |
-
curl -X POST "http://localhost:8000/calibrate" \
|
80 |
-
-F "[email protected]" \
|
81 |
-
-F 'lines_data={"Big rect. right top":[{"x":1342.88,"y":1076.99}]}'
|
82 |
-
```
|
83 |
-
|
84 |
-
### Format de réponse
|
85 |
-
|
86 |
-
```json
|
87 |
-
{
|
88 |
-
"status": "success",
|
89 |
-
"camera_parameters": {
|
90 |
-
"pan_degrees": -45.2,
|
91 |
-
"tilt_degrees": 12.8,
|
92 |
-
"roll_degrees": 1.2,
|
93 |
-
"position_meters": [10.5, 20.3, 5.8],
|
94 |
-
"x_focal_length": 1200.5,
|
95 |
-
"y_focal_length": 1201.2,
|
96 |
-
"principal_point": [960, 540]
|
97 |
-
},
|
98 |
-
"input_lines": { /* lignes validées */ },
|
99 |
-
"message": "Calibration réussie"
|
100 |
-
}
|
101 |
-
```
|
102 |
-
|
103 |
-
## Documentation
|
104 |
-
|
105 |
-
Une fois l'API lancée, accédez à la documentation interactive :
|
106 |
-
- **Swagger UI** : http://localhost:8000/docs
|
107 |
-
- **ReDoc** : http://localhost:8000/redoc
|
108 |
-
|
109 |
-
## Health Check
|
110 |
-
|
111 |
-
```bash
|
112 |
-
curl http://localhost:8000/health
|
113 |
-
```
|
114 |
-
|
115 |
-
## Support des lignes de terrain
|
116 |
-
|
117 |
-
L'API accepte ces types de lignes de terrain :
|
118 |
-
- `Big rect. right/left top/main/bottom`
|
119 |
-
- `Small rect. right/left top/main`
|
120 |
-
- `Circle right/left/central`
|
121 |
-
- `Side line bottom/left`
|
122 |
-
- `Middle line`
|
123 |
-
...
|
124 |
-
|
125 |
-
Chaque ligne est définie par une liste de points avec coordonnées `x` et `y`.
|
126 |
-
|
127 |
-
## Crédits
|
128 |
-
|
129 |
-
Basé sur le travail original de l'équipe SoccerNet pour le Camera Calibration Challenge [Marc Gutiérrez-Pérez](https://github.com/mguti97/PnLCalib).
|
130 |
-
Transformé en API REST par [2nzi](https://github.com/2nzi).
|
131 |
-
|
132 |
-
## Licence
|
133 |
-
|
134 |
-
Voir [LICENSE](LICENSE) - Basé sur la licence du projet original SoccerNet.
|
|
|
1 |
+
---
|
2 |
+
title: PnLCalib
|
3 |
+
emoji: 📐
|
4 |
+
colorFrom: green
|
5 |
+
colorTo: blue
|
6 |
+
sdk: docker
|
7 |
+
app_file: Dockerfile
|
8 |
+
pinned: false
|
9 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|