AI_trainer focuses on counting the number of curls done by an individual.
- It takes the angle formed by the right hand for calculations.
- We will use the pose estimation running on the CPU to find the correct points and using these points we will get the desired angles. Then based on these angles we can find many gestures including the number of biceps curls
MediaPipe and OpenCV :to gather data about the various joints in our body such as our wrists, shoulders, etc. for making our calculation with angles possible to count our repetitions with heavier weights, NumPy : It will help us with our trigonometry to calculate the angles
To make the detections possible, we need to recolor our image because OpenCV renders the RGB image to BGR color format but for MediaPipe to work, we need to convert our BGR image back to RGB. Print the detections of our model. Lastly change the color format back to BGR format as OpenCV runs on BGR format, and then we can start rendering our detections.
There are 33 landmarks in total, starting from index 0. These represent the different joints within the pose, , if we want to calculate the angle for our Right hand’s bicep curl, we would require the joints of shoulder, elbow and wrist which are 12, 14 and 16 respectively.
First we get the coordinates of the threejoints which we require to get the angle calculated. Then we can calculate the slopes of the joints using NumPy. Angles are calculated in radians which then can be converted into degrees.