@@ -35,7 +35,7 @@ public void RequestSizeChange(int newSize)
3535 }
3636
3737 // Dynamic properties instead of constants
38- private int IMAGE_SIZE => _currentImageSize ;
38+ public int IMAGE_SIZE => _currentImageSize ;
3939 private int NUM_DETECTIONS { get ; set ; } = 8400 ; // Will be set dynamically for dynamic models
4040 private bool IsDynamicModel { get ; set ; } = false ;
4141 private int ModelFixedSize { get ; set ; } = 640 ; // Store the fixed size for non-dynamic models
@@ -46,6 +46,7 @@ public void RequestSizeChange(int newSize)
4646 } ;
4747 public Dictionary < int , string > ModelClasses => _modelClasses ; // apparently this is better than making _modelClasses public
4848 public static event Action < Dictionary < int , string > > ? ClassesUpdated ;
49+ public static event Action < int > ? ImageSizeUpdated ;
4950
5051 private const int SAVE_FRAME_COOLDOWN_MS = 500 ;
5152
@@ -347,6 +348,7 @@ private bool ValidateOnnxShape()
347348 // For dynamic models, calculate NUM_DETECTIONS based on selected image size
348349 NUM_DETECTIONS = CalculateNumDetections ( IMAGE_SIZE ) ;
349350 LoadClasses ( ) ;
351+ ImageSizeUpdated ? . Invoke ( IMAGE_SIZE ) ;
350352 LogManager . Log ( LogLevel . Info , $ "Loaded dynamic model - using selected image size { IMAGE_SIZE } x{ IMAGE_SIZE } with { NUM_DETECTIONS } detections", true , 3000 ) ;
351353 }
352354 else
@@ -384,6 +386,7 @@ private bool ValidateOnnxShape()
384386
385387 // The IMAGE_SIZE property will now return the correct value
386388 NUM_DETECTIONS = CalculateNumDetections ( fixedInputSize ) ;
389+ ImageSizeUpdated ? . Invoke ( fixedInputSize ) ;
387390 }
388391 else if ( ! supportedSizes . Contains ( fixedSizeStr ) )
389392 {
@@ -625,8 +628,8 @@ private async void UpdateFOV()
625628
626629 await Application . Current . Dispatcher . BeginInvoke ( ( ) =>
627630 Dictionary . FOVWindow . FOVStrictEnclosure . Margin = new Thickness (
628- Convert . ToInt16 ( displayRelativeX / WinAPICaller . scalingFactorX ) - ( IMAGE_SIZE / 2 ) ,
629- Convert . ToInt16 ( displayRelativeY / WinAPICaller . scalingFactorY ) - ( IMAGE_SIZE / 2 ) , 0 , 0 ) ) ;
631+ Convert . ToInt16 ( displayRelativeX / WinAPICaller . scalingFactorX ) - 320 , // this is based off the window size, not the size of the model -whip
632+ Convert . ToInt16 ( displayRelativeY / WinAPICaller . scalingFactorY ) - 320 , 0 , 0 ) ) ;
630633 }
631634 }
632635
0 commit comments