Computer vision pipeline for tracking a spring-pendulum system from multi-camera video, extracting dominant oscillation modes via PCA, and estimating physical parameters analytically.
The full project report is available at: mech0107_coursework1_final.pdf
The coursework specification is available at: MECH0107_CW1_2526.pdf
| Notebook | Description |
|---|---|
| Notebooks/main.ipynb | Main analysis notebook — full pipeline using the PendulumTracker class |
| Notebooks/testing_and_viz.ipynb | Exploratory development and visualisation notebook |
-
Data Loading — loads
.matfiles from three camera views; rotates Camera 3 to align orientation - Pre-processing — grayscale conversion and Gaussian blur
- Area of Interest — manually confirmed bounding regions for each camera
- Detection Pipeline — median background subtraction, thresholding, morphological dilation, contour detection
- Centroid Tracking — frame-by-frame centroid extraction with interpolation for missed detections
- Frequency Analysis — FFT-based dominant frequency detection per camera signal
- PSD Filtering — noise reduction by zeroing low-power spectral components
- Gabor Transform — time-frequency spectrogram to confirm frequency stationarity
- PCA — 6-component PCA on standardised centroid data to isolate oscillation modes
-
Analytical Modeling — estimates spring constant
$k$ (from PC1) and pendulum length$L$ (from PC2), compared against undamped cosine solutions
Raw .mat files are stored in data/matlab_files/ (not tracked by git due to size).
| File | Contents |
|---|---|
cam1.mat |
vidFrames1_4 — 480×640×3×392 frames |
cam2.mat |
vidFrames2_4 — 480×640×3×405 frames |
cam3.mat |
vidFrames3_4 — 640×480×3×394 frames (rotated on load) |
pip install -r requirements.txt
Key dependencies: numpy, scipy, opencv-python, scikit-image, scikit-learn, matplotlib.