video-plate-calibration:
README/CONTEXT
This commit is contained in:
+65
-4
@@ -80,9 +80,10 @@ Modèles principaux :
|
||||
| Modèle | Rôle |
|
||||
|---|---|
|
||||
| `Configuration` | Config globale active (caméra, GRBL, tracking, calibration) |
|
||||
| `MultiWell` | Plaque multi-puits (position HG/HD/BG/BD, grille 6×4, pas XY) |
|
||||
| `MultiWell` | Plaque multi-puits (position HG/HD/BG/BD, grille 6×4, pas XY, crop_radius) |
|
||||
| `Well` | Puit individuel (nom Ai..Di) |
|
||||
| `WellPosition` | Position XY mm d'un puit dans un MultiWell + px_per_mm |
|
||||
| `WellPosition` | Position XY mm d'un puit dans un MultiWell + px_per_mm (calibration optique caméra) |
|
||||
| `VideoPlate` | Vidéo plaque entière associée à un MultiWell — champs : `px_per_mm` (échelle vidéo ~15 px/mm), `x_origin_mm` / `y_origin_mm` (origine CNC stable, indépendante de la calibration) |
|
||||
| `Experiment` | Session de capture sur un MultiWell (durée, début/fin) |
|
||||
| `Session` | Groupe d'expériences avec planification (ClockedSchedule one-shot) |
|
||||
| `SessionExperiment` | Liaison Session ↔ Experiment |
|
||||
@@ -109,13 +110,14 @@ Modèle `ExperimentConfig` : paramètres de tracking par puit (px_per_mm, fps, s
|
||||
|---|---|
|
||||
| `grbl.py` | Pilotage CNC via port série (G-code, homing, déplacement XY) |
|
||||
| `grbl_simulator.py` | Simulateur GRBL pour dev sans matériel |
|
||||
| `capture_interface.py` | Interface abstraite de capture |
|
||||
| `capture_interface.py` | Interface abstraite de capture — crop circulaire, edge enhance, debug overlay, tracking |
|
||||
| `picamera2_capture.py` | Capture ArduCam via Picamera2 |
|
||||
| `webcam_capture.py` | Capture webcam via OpenCV |
|
||||
| `videofile_capture.py` | Lecture fichier vidéo (test/sim) |
|
||||
| `videoplate_capture.py` | Capture par crop dynamique dans une vidéo plaque entière — position GRBL → région extraite, hot swap vidéo, plein cadre à l'origine |
|
||||
| `planarian_tracker.py` | Tracking multi-individus : MOG2 + algorithme hongrois (`scipy`) |
|
||||
| `planarian_metrics.py` | Métriques par frame et summary (mobilité, thigmo, photo, chemo, social) |
|
||||
| `tube_aligner.py` | Alignement et calibration optique du tube |
|
||||
| `tube_aligner.py` | Détection HoughCircles + CLAHE, calibration optique, plage rayon configurable (`set_radius_range`) |
|
||||
| `circular_crop.py` | Découpe circulaire des images de puit |
|
||||
| `reductstore.py` | Interface ReductStore (stockage/lecture frames time série) |
|
||||
| `system_stats.py` | Stats système (CPU, RAM, disque — affichage dashboard) |
|
||||
@@ -190,6 +192,65 @@ python3 planarian_sim.py --count 5 --photo-mode fixed --photo-x 0.2 --photo-y 0.
|
||||
|
||||
---
|
||||
|
||||
## Mode capture vidéo plaque (`capture_type == 'video'`)
|
||||
|
||||
Alternative à la caméra ArduCam : une **vidéo de la plaque entière** enregistrée une fois,
|
||||
rejouée en boucle pendant les scans. Adapté aux labos sans Raspberry Pi ou pour tests hors matériel.
|
||||
|
||||
### Flux
|
||||
```
|
||||
VideoPlateCapture.capture_frame()
|
||||
→ lit la frame courante de la vidéo
|
||||
→ extrait un carré 2r×2r centré sur (GRBL_x, GRBL_y) converti en pixels
|
||||
→ si GRBL à (0,0) : retourne la frame entière (vue plaque)
|
||||
→ sinon : retourne le crop du puit courant
|
||||
→ process_frame()
|
||||
→ edge_enhance (optionnel, CLAHE + Canny overlay vert)
|
||||
→ TubeAligner.detect_tube() (optionnel, debug HoughCircles)
|
||||
→ crop circulaire (optionnel)
|
||||
```
|
||||
|
||||
### Calibration vidéo
|
||||
- `VideoPlate.px_per_mm` : échelle de la vidéo (~15 px/mm) — **différent** de `WellPosition.px_per_mm` (~50 px/mm, optique caméra)
|
||||
- `VideoPlate.x_origin_mm` / `y_origin_mm` : position CNC correspondant au pixel (0,0) de la vidéo — **stable**, jamais modifiée par la calibration des puits
|
||||
- `MultiWell.crop_radius` : rayon du crop en pixels — contrôle la taille de la vue par puit
|
||||
|
||||
### Contrôles calibration UI (boutons)
|
||||
| Bouton | Action |
|
||||
|---|---|
|
||||
| Debug | Active `TubeAligner.debug` — détection HoughCircles en continu |
|
||||
| Overlay | Affiche/masque les annotations de détection sans couper la détection |
|
||||
| Contours | Active edge enhance (CLAHE + Canny overlay vert) sur la frame propre |
|
||||
| Recadrer | Active le crop circulaire + navigue vers la position Base (mode vidéo) |
|
||||
|
||||
### `TubeAligner.set_radius_range(min_ratio, max_ratio)`
|
||||
Ajuste la plage de recherche HoughCircles en fraction de `min(w,h)` :
|
||||
- Mode caméra : `0.26–0.37` (tube occupe ~30% du champ)
|
||||
- Mode vidéo : `0.38–0.47` (puit remplit le crop, ratio ~0.43–0.50)
|
||||
|
||||
---
|
||||
|
||||
## Déploiement réseau isolé (labo sans internet)
|
||||
|
||||
```
|
||||
GitHub ←→ Portable (internet) ←→ Routeur OpenWrt ←→ Machine labo (SSH)
|
||||
```
|
||||
|
||||
Mise à jour sans internet :
|
||||
```bash
|
||||
# Sur la machine labo (une fois)
|
||||
git config receive.denyCurrentBranch updateInstead
|
||||
|
||||
# Sur le portable — ajouter le labo comme remote
|
||||
git remote add labo ssh://user@<ip-labo>/chemin/PlanarianScanner
|
||||
|
||||
# Workflow répétable
|
||||
git pull origin video-plate-calibration # portable ← GitHub
|
||||
git push labo video-plate-calibration # labo ← portable
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Licence
|
||||
|
||||
GPL-3.0
|
||||
|
||||
Reference in New Issue
Block a user