Like many people in our technology-dependent society today, I spend way too many hours in front of a screen each day. Not only do I use my computer for work, but I also use it as a source of entertainment and social networking. I often find myself with slouching shoulders and my head tilted forward for hours on end which has led to habitual poor posture. I know that being on the younger side of the spectrum affords me more leeway in the physical harm this cause my body, but I wanted to get ahead and start working on my posture now before the damage is irreversible. Poor posture can lead to headaches, jaw pain, reduced lung function, gastrointestinal issues, back pain, and shoulder pain which only get worse with more prolonged exposure.

What it does

This program uses a built-in webcam/USB webcam to monitor the user's posture while running the application. After the user starts the program the webcam begins to actively monitor their torso for changes in posture. When posture has significantly changed from an ideal position, the application provides a visual and audible warning for the user to readjust their posture. When the user has returned to their ideal position, the program will notify them that their posture is well again. The user can exit the program at any time using the GUI.

How I built it

I started by using the webcam to take an initial snapshot of the user. This RBG picture is then converted into grayscale and the boundaries outlining the user and surroundings are mapped. A custom filter is applied to eliminate shapes in the background and focus on the user's profile. Then the shadow cast by the user is filtered out, and the remaining boundaries are divided into the left, center, and right side of the image. Each section undergoes a quadratic linear regression and the derivatives of these regressions are used to determine when certain slopes occur on the user's profile outline in order to mark the shoulders and head. The distances between the shoulders and head are determined. This process is repeated with a new snapshot after a slight pause and compared to the initial snapshot. If a threshold difference is reached, the GUI notifies the user with a visual warning and an audible tone that their posture has become worse. When the user corrects their posture, the GUI notifies them that their posture has improved.

Challenges I ran into

I had issues filtering out background objects, especially when the lighting behind me changed. I also needed the background to be primarily monochromatic in order to prevent the program from mistaking the user as part of the background.

Accomplishments that I'm proud of

I am proud that I actually finished this in one day from start to finish, especially after showing up late due to a delayed flight.

What I learned

I learned how to integrate a webcam's abilities into an active monitoring system (in a non-creepy way). I also learned how to convert an image into binary information for analysis using matrices.

What's next for Perfect Posture

Perfect Posture's next steps include developing a filter for varying backgrounds with different objects, colors, and brightnesses. Another future feature involves a posture coach that tracks improvements in posture over time and can show users their progression to better posture.

Built With

Share this project: