diff --git a/Sports2D/compute_angles.py b/Sports2D/compute_angles.py index 57bfe79..5c2aa77 100644 --- a/Sports2D/compute_angles.py +++ b/Sports2D/compute_angles.py @@ -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): @@ -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) diff --git a/Sports2D/detect_pose.py b/Sports2D/detect_pose.py index 0779b57..aad500d 100644 --- a/Sports2D/detect_pose.py +++ b/Sports2D/detect_pose.py @@ -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] @@ -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.') \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 807aba7..214810d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = sports2d -version = 0.2.2 +version = 0.2.3 author = David Pagnon author_email = contact@david-pagnon.com description = Detect pose and compute 2D joint angles from a video.