Skip to content

Commit

Permalink
Remove comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikonooooo committed Dec 3, 2023
1 parent 22d0327 commit a8db071
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/processing/trendline.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from state import GameState, BallFrame, Box


class LinearTrendline:
def __init__(self, state: GameState, args):
self.args = args
Expand Down Expand Up @@ -70,7 +71,12 @@ def estimate_missing_positions(self):

# Create a new BallFrame with estimated position
predicted_box = self.create_predicted_box(x_pred, y_pred)
current_frame.ball = BallFrame(predicted_box.xmin, predicted_box.ymin, predicted_box.xmax, predicted_box.ymax)
current_frame.ball = BallFrame(
predicted_box.xmin,
predicted_box.ymin,
predicted_box.xmax,
predicted_box.ymax,
)

def create_predicted_box(self, x_center, y_center, ball_size=20):
# Assuming a fixed size for the ball for simplicity
Expand Down Expand Up @@ -114,7 +120,9 @@ def create_predicted_box(self, x_center, y_center, ball_size=20):
# if abs(frame.ball.ax) > dynamic_threshold or abs(frame.ball.ay) > dynamic_threshold:
# frame.ball = None

def is_spatial_change_abrupt(self, current_frame, spatial_threshold=70, window_size=15):
def is_spatial_change_abrupt(
self, current_frame, spatial_threshold=70, window_size=15
):
if current_frame.ball:
x2, y2 = current_frame.ball.box.center()

Expand All @@ -126,7 +134,7 @@ def is_spatial_change_abrupt(self, current_frame, spatial_threshold=70, window_s

distance = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
if distance > spatial_threshold:
print(f"Frame {current_frame.frameno}: Abrupt spatial change detected. Distance: {distance:.2f}")
# print(f"Frame {current_frame.frameno}: Abrupt spatial change detected. Distance: {distance:.2f}")
return True
break

Expand Down

0 comments on commit a8db071

Please sign in to comment.