copyclare.model package#

Submodules#

copyclare.model.accuracy_v2 module#

Contributors: Adi Bozzhanov, Tianhao Chen

class copyclare.model.accuracy_v2.AccuracyModel(exercise, joints)#

Bases: object

accuracy(frame, reltime)#
color_frame(frame, landmark_list, accuracy)#

Draws a skeleton on top of the user.

Parameters
  • frame – opencv frame containing an image to be colored.

  • landmark_list – Contains coordinates of landmarks of interest

  • accuracy – a real number that’s used to determine the color of the skeleton

find_angle(frame, joint, landmark_list)#

Finds an angle of any given joint.

Parameters
  • frame – OpenCV frame

  • joint – String value representing the joing

  • landmark_list – mediapipe landmark_list

get_accuracy(angle, reltime, joint)#

Calculats the accuracy given the angle, joint and the relative time.

Parameters
  • angle – float angle value

  • reltime – float timestamp within the range (0-duration of the video)

  • joint – String value representing the joint to be considered.

Reurns:

accuracy value in the range 0-100

get_angles(video_path)#

Initialises angles json for an exercise video

Parameters

vieo_path – absolute path to the video

Returns

a dictionary where each key is a joint and value is a list of angle/time pairs

joint_adjacent = {'left_elbow': (15, 11), 'left_shoulder': (13, 12), 'right_elbow': (12, 16), 'right_shoulder': (11, 14)}#
joints_map = {'left_elbow': 13, 'left_shoulder': 11, 'right_elbow': 14, 'right_shoulder': 12}#
copyclare.model.accuracy_v2.round_decimals_up(number: float, decimals: int = 1)#

copyclare.model.pose_module module#

Contributors: Adi Bozzhanov, Sree Sanakkayala, Tianhao Chen

class copyclare.model.pose_module.PoseModule#

Bases: object

find_angle(img, p1, p2, p3, draw=True)#

Calculates the angle given and image, and 3 joints

Returns

float value of the angle in degrees

find_landmarks(img, draw=True)#

Finds landmarks given the image

Returns

landmark_list

find_person(img, draw=False)#

Find the person in the frame

store_data(frame_num, angle)#

Module contents#

Contributors: Adi Bozzhanov