@@ -457,24 +457,16 @@ impl VideoFilterImpl for EdgeImpulseOverlay {
457457 . iter ( )
458458 . map ( |roi| {
459459 let score = roi. label . parse :: < f64 > ( ) . unwrap_or ( 0.0 ) ;
460- // Scale coordinates based on input and output dimensions
461- let scale_x = frame. width ( ) as f64 / settings. model_input_width as f64 ;
462- let scale_y = frame. height ( ) as f64 / settings. model_input_height as f64 ;
463- let scaled_x = ( roi. x as f64 * scale_x) as i32 ;
464- let scaled_y = ( roi. y as f64 * scale_y) as i32 ;
465- let scaled_w = ( roi. width as f64 * scale_x) as i32 ;
466- let scaled_h = ( roi. height as f64 * scale_y) as i32 ;
460+ // Coordinates are already scaled to frame resolution by the inference element
461+ // No additional scaling needed
467462 gst:: debug!(
468463 CAT ,
469464 obj = self . obj( ) ,
470- "Processing grid cell: original= ({}, {}) {}x{} -> scaled=({}, {}) {}x{} score={:.1}% (scale_x={:.2}, scale_y={:.2}, model_size={}x{} )" ,
465+ "Processing grid cell: ({}, {}) {}x{} score={:.1}% (already scaled to frame resolution )" ,
471466 roi. x, roi. y, roi. width, roi. height,
472- scaled_x, scaled_y, scaled_w, scaled_h,
473- score * 100.0 ,
474- scale_x, scale_y,
475- settings. model_input_width, settings. model_input_height
467+ score * 100.0
476468 ) ;
477- ( scaled_x , scaled_y , scaled_w , scaled_h , score)
469+ ( roi . x as i32 , roi . y as i32 , roi . width as i32 , roi . height as i32 , score)
478470 } )
479471 . collect ( ) ;
480472 ( anomaly, grid)
@@ -584,7 +576,7 @@ impl VideoFilterImpl for EdgeImpulseOverlay {
584576
585577 // Draw visual anomaly grid
586578 for ( x, y, width, height, score) in grid {
587- // Note: coordinates are already scaled from the grid creation
579+ // Note: coordinates are already scaled to frame resolution by the inference element
588580 // Normalize raw anomaly scores for visualization
589581 // Use threshold (6.0) as reference point and scale to 0-1 range
590582 let threshold = 6.0 ;
0 commit comments