diff --git a/CameraController.cs b/CameraController.cs index 6662c35..6466c17 100644 --- a/CameraController.cs +++ b/CameraController.cs @@ -17,15 +17,14 @@ public sealed class CameraController private readonly int _cropWidth; private readonly int _cropHeight; private readonly KalmanTracker _kalman; - private readonly int _lostFreezeFrames; - private readonly float _cameraEasing; - - // --- Dropout tolerance --- - private const int DropoutToleranceFrames = 20; private int _dropoutCounter; - // --- NEW: EMA smoothing --- - private const float EmaFactor = 0.85f; // 0.85 = smooth but responsive + // --- Dropout tolerance --- + private const int DropoutToleranceFrames = 20; + private const float EmaFactor = 0.65f; // smoother but responsive + private const float CameraEasing = 0.03f; // stronger follow-through + private const int LostFreezeFrames = 60; // 2 seconds at 30 FPS + private int _lostFrames; private Point2f _cameraCenter; @@ -40,20 +39,17 @@ public sealed class CameraController int videoHeight, int cropWidth, int cropHeight, - KalmanTracker kalman, - int lostFreezeFrames, - float cameraEasing) + KalmanTracker kalman + ) { - _videoWidth = videoWidth; + _videoWidth = videoWidth; _videoHeight = videoHeight; - _cropWidth = cropWidth; - _cropHeight = cropHeight; - _kalman = kalman; - _lostFreezeFrames = lostFreezeFrames; - _cameraEasing = cameraEasing; + _cropWidth = cropWidth; + _cropHeight = cropHeight; + _kalman = kalman; _cameraCenter = new Point2f(videoWidth / 2f, videoHeight / 2f); - _state = TrackState.Tracking; + _state = TrackState.Tracking; _kalman.Reset(_cameraCenter); } @@ -100,7 +96,7 @@ public sealed class CameraController { _lostFrames++; - if (_lostFrames <= _lostFreezeFrames) + if (_lostFrames <= LostFreezeFrames) { _state = TrackState.LostFreeze; objectCenter = null; @@ -132,16 +128,10 @@ public sealed class CameraController smoothedCenter.Y * (1 - EmaFactor) + _cameraCenter.Y * EmaFactor ); - // fast easing - float fastEasing = 0.015f; _cameraCenter = new Point2f( - _cameraCenter.X + (smoothedCenter.X - _cameraCenter.X) * fastEasing, - _cameraCenter.Y + (smoothedCenter.Y - _cameraCenter.Y) * fastEasing); + _cameraCenter.X + (smoothedCenter.X - _cameraCenter.X) * CameraEasing, + _cameraCenter.Y + (smoothedCenter.Y - _cameraCenter.Y) * CameraEasing); - // configurable easing - _cameraCenter = new Point2f( - _cameraCenter.X + (smoothedCenter.X - _cameraCenter.X) * _cameraEasing, - _cameraCenter.Y + (smoothedCenter.Y - _cameraCenter.Y) * _cameraEasing); } else if (_state == TrackState.LostFreeze) { diff --git a/Properties/launchSettings.json b/Properties/launchSettings.json index 399c31d..5ffc2d4 100644 --- a/Properties/launchSettings.json +++ b/Properties/launchSettings.json @@ -1,6 +1,14 @@ { "profiles": { - "splitter": { + "WSL": { + "commandName": "WSL2", + "distributionName": "" + }, + "Prod": { + "commandName": "Project", + "commandLineArgs": "\"C:\\Users\\uncls\\Pictures\\2026\\2026 - Secret Rule\\20260426_212004.mp4\" \"C:\\Users\\uncls\\Pictures\\2026\\2026 - Secret Rule\\Shorts\" --crop --detect=body" + }, + "Debug": { "commandName": "Project", "commandLineArgs": "\"C:\\Users\\uncls\\Pictures\\2026\\2026 - Secret Rule\\20260426_212004.mp4\" \"C:\\Users\\uncls\\Pictures\\2026\\2026 - Secret Rule\\Shorts\" --crop --detect=body --debug --text" } diff --git a/TrackingSplitter.cs b/TrackingSplitter.cs index 0d91d9f..81d6814 100644 --- a/TrackingSplitter.cs +++ b/TrackingSplitter.cs @@ -12,9 +12,6 @@ public class TrackingSplitter( Action drawProgress ) : LoggingBase(log, drawProgress) { - private const int LostFreezeFrames = 60; // 2 seconds at 30 FPS - private const float CameraEasing = 0.03f; - public async Task TrackAndExtract( string srcFileName, string destFileName, @@ -70,9 +67,8 @@ public class TrackingSplitter( videoHeight, originalCropWidth, originalCropHeight, - kalman, - LostFreezeFrames, - CameraEasing); + kalman + ); var startTime = DateTime.UtcNow;