Shoulder Press Exercise Analysis using OpenCV and MediaPipe (with visualization)

Ali Sajid
4 min readMay 22, 2022
Initial Interface

MediaPipe is a Framework for building machine learning pipelines for processing time-series data like video, audio, etc. While OpenCV-Python is a library of Python bindings designed to solve computer vision problems. Similarly, Tkinter is the standard GUI library for Python. Python when combined with Tkinter provides a fast and easy way to create GUI applications. Tkinter provides a powerful object-oriented interface to the Tk GUI toolkit.

Using aforementioned programming tools, we will develop a Graphical User Interface to analyze Seated Dumbbell Shoulder Press Exercise. A visualization of what we are going to develop is as follows:

Sample Output

Objective and Motivation:

The prime objective and motivation for development of ”AI/CV Based Shoulder Press Exercise Analysis” is to present the community, a utility for easy, instant and user-friendly real-time exercise inspection, keeping in view the significance of workout for a healthy lifestyle in the hurry and scurry of life these days. This can also serve as a personal gym trainer with no monthly charges.

Salient Features:

There is a wide range of functions from Live Camera to Recorded Video analysis along with setting up for a Workout Goal, Results Window, and calculation of calories burnt. Background music option and fascinating graphical interface empower and boost up the user towards accomplishing his target. Besides, there is a GIF demonstrating the legitimate conduct of targeted exercise.

Main Menu Interface

Details of the Features:

As mentioned above, there are a lot of features in the program. Find the details and explanation along with their visualization below:

1- Live Camera Feature:

In this part, there are a number of widgets available such as Start/Pause Button which, as name suggests, will initiate and hold the analysis. There are constantly updated Repetitions and Timer displayed on the screen. There is an indication of posture correction for user to realize if he’s going fine. Besides, A progress bar is also displayed on the interface. A very fascinating option available is that of playing music that will, for sure, electrify the enthusiasm of the exercise seeker.

Live Camera Interface
Live Camera Interface Code

2- Recorded Video Analysis Feature:

This window is similar to Live Camera one expect that, as indicated by its name, it performs the analysis on recorded videos. This feature is useful to check a person’s action who is not live or physically present on the spot. This interface contains all the widgets as that of Live Camera but the music option.

Recorded Video Interface
Recorded Video Interface Code

Set Goal Feature:

It is another useful and interesting feature of this User Interface. As implied by its title, it allows the seeker to set a goal for himself. After its placement, the user will get a proper and continuously updated feedback of his target achievement progress. In the end of this analysis. the user will get to know if he’s reached his goal or not. Besides, the total exercise time, repetition sets, and burnt calories will be displayed for a motivating experience.

Goal Setting Environment
Goal Setting Interface Code

4- Results Window:

For displaying the end results of the analysis keeping in view the set goal, there is a Results Window too with a number of widgets and a lot of useful information.

Results Window
Results Interface Code

Complete Code:

For accessing this program, you can find the Code here.

Future Inclusions:

Future Horizons in this regard include the addition of some more exercises, stretches, and yoga poses to make it a full fledge Mobile Application which can be used as a Personal gym Trainer with no monthly fee.

About Developers:

Ali Sajid and Noor Sultan, studying at the department Mechatronics and Control Engineering at University of Engineering and Technology, Lahore have a profound and keen interest in Computer Vision and its applications and this very interest caused them to implement a computer vision approach as their semester project for their Computer Programming course. Under the guidance of Prof. Ahsan Naeem, a number of open-source python libraries encompassing OpenCV, MediaPipe, NumPy, Tkinter, Pygame, and Pillow etc are incorporated. A long series of strivings and struggles are there in order to make the software efficient and methodical both in terms of pace and space.

Noor Sultan and Ali Sajid

Contact Us:

Ali Sajid’s LinkedIn

Noor Sultan’s LinkedIn

Hope you find it useful. Thanks for reading!

--

--