Skip to content

ball_velocityのメソッドを分割 #85

@Manato-310

Description

@Manato-310

ball_velocity内のCSVファイルへの格納コマンドをstore_ball_positionの書き方を見ながら分ける。

new_velocity_data = [[speed, direction_deg, state1, state2, frame2]] # 新しいボール速度のデータ
df = pd.DataFrame(new_velocity_data, columns=["speed", "direction", "state1", "state2", "frame_number"]) # ボール速度のデータフレームを作成
ball_velocity_path = os.path.join(path, "ball_velocity.csv") # ボール速度のCSVファイルパス
if not os.path.isdir(path):
os.mkdir(path) # 出力先ディレクトリが存在しない場合は作成
if not os.path.exists(ball_velocity_path):
df.to_csv(ball_velocity_path, mode='w', header=True, index=False) # ボール速度のCSVファイルが存在しない場合は新規作成
else:
df.to_csv(ball_velocity_path, mode='a', header=False, index=False) # 存在する場合は追記

↑これを別のメソッドにする

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions