Skip to content

Commit

Permalink
solve minor bug
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpagnon committed Jun 12, 2023
1 parent 07b3f3e commit b1358b1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions Sports2D/compute_angles.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,8 @@ def compute_angles_fun(config_dict):
cv2.imwrite(str(frames_img[frame_nb]), frame)
if show_angles_vid:
writer.write(frame)
writer.release()
if show_angles_vid:
writer.release()

# Else from pose video (or base video if pose video does not exist)
elif Path.exists(video_base) or Path.exists(video_pose):
Expand All @@ -495,9 +496,9 @@ def compute_angles_fun(config_dict):
else:
break

cap.release()
writer.release()
if show_angles_vid:
cap.release()
writer.release()
if Path.exists(video_pose): os.remove(video_pose)
os.rename(video_pose2,video_pose)
if Path.exists(video_pose2): os.remove(video_pose2)
Expand Down
4 changes: 2 additions & 2 deletions Sports2D/detect_pose.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def json_to_csv(json_path, frame_rate, pose_model, interp_gap_smaller_than, filt

# Create dataframe
df_list=[]
time = np.expand_dims( np.arange(0,len(Coords[i])/frame_rate, 1/frame_rate), axis=0 )
time = np.expand_dims( np.arange(0,len(Coords[i]), 1)/frame_rate, axis=0 )
time_coords = np.concatenate(( time, Coords[i].T ))
df_list += [pd.DataFrame(time_coords, index=index_csv).T]

Expand Down Expand Up @@ -606,4 +606,4 @@ def detect_pose_fun(config_dict):
model_complexity = config_dict.get('pose').get('BLAZEPOSE').get('model_complexity')
Blazepose_runsave.blazepose_detec_func(input_file=video_path, save_images=save_img, to_json=True, save_video=save_vid, to_csv=True, output_folder=result_dir, model_complexity=model_complexity)

logging.info(f'Done.')
logging.info(f'Done.')
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = sports2d
version = 0.2.2
version = 0.2.3
author = David Pagnon
author_email = [email protected]
description = Detect pose and compute 2D joint angles from a video.
Expand Down

0 comments on commit b1358b1

Please sign in to comment.