Hacker News new | past | comments | ask | show | jobs | submit login
Slouchy – a small Python script that warns you if you're slouching (github.com/pyskell)
99 points by 4684499 on Oct 13, 2015 | hide | past | favorite | 26 comments



I can recommend to peruse the source code. It's well written and documented. Such projects always put a smile on my face, since they demonstrate how far we've come in some respects:

- We've learned how to write and produce reusable, easily digestable code

- Python gives us a language that is concise, readable

- Frameworks like OpenCV let us do incredible things

- Open Source allows us to share it and collaborate*

- Platforms like Github facilitate the entire experience

10 years ago it took forever to configure my webcam on my Linux machine. I had to scour mailing lists and custom web sites to download various versions of kernel patches. Now my webcam is built-in and it takes 2-3 commands to take something off of Github and have fun.

* Of course Open Source is not new, but today it really seems like "Open Source won".


What about these magic string: "slouching_alert(QString, QString)"? I don't know Python. Does it work by reflection? I assume these are some kind of bindings to an underlying native API or something? It doesn't look very maintainable...


Qt uses slots and signals to control messaging between threads (e.g. the UI and the workers).

The Python binding to Qt is good, but it is auto-generated (from C++) and some of it shows up as non-Pythonic mechanisms or conventions.


Newer versions of PyQt have replaced the magic strings with a system that's much more Pythonic, using decorators and OOP.

I guess the author just wanted to keep backwards compatibility with old versions (or isn't aware of the change).

Edit: If anyone's interested, here's the new syntax: http://pyqt.sourceforge.net/Docs/PyQt4/new_style_signals_slo...


Thanks for this. I had no idea a different mechanism existed.


is PySide2 also getting that new system?



Nothing to do with Python, it looks like a Qt thing. Not much the author can do about that.


Hey there sthim. Slouchy author here.

I just wanted to say thank you for your comments. It really put a smile on my face to see someone liked my actual code.


You know, I had a similar idea a few years ago. Initial idea was to prevent eye strain. You can check it out: http://viewaide.com/ Here I analyze more than slouching (distance to the monitor and even blink rate). It was written in C++ in my students years and code style is a shame on me. But if someone is interested, I can upload this on Github.


I'm aware of a commercial application that uses computer vision to monitor a computer user's posture. http://www.postureminder.co.uk/


Please do!


How do you install that on a mac? Do you have to use http://www.pythonschool.net/pyqt/distributing-your-applicati...?


Hey, there's now Mac install instructions in the README. Check them out and if you have any issues let me know.


brew install


I stop myself from slouching on long drives by adjusting the rearview mirror such that if I'm not sitting up straight, it won't show the back window correctly.

I notice pretty quickly when I'm not seeing the full rear window anymore, and adjust my posture.

I've been wondering if a similar tactic might work for monitors -- e.g., the same tech that can make a monitor intentionally hard for someone next to you to read might also let you adjust it so that if you slump down a few inches, it's hard to see.

Not sure of a similar tactic for public speaking (since nowadays you're likely to have a mic on your lapel...) but it also works for recording; you adjust your posture how it ought to be for good voice production, adjust the mic with it, and then if you slump the mic is no longer in the right place.


I've got my monitors on 2 boxes adding about 6 inches each to their height. When I first started looking up to use them it was so uncomfortable and distracting that I could not work. I kept at it though and I find my posture has improved and the thought of going back is now uncomfortable.

I also recommend the following exercises which have improved my posture such that people have been saying that I look taller. https://www.youtube.com/watch?v=FTV6UCh-yhs I have been doing them against my wall when I have 5 minutes to wait for a build or in the shower when I'm rinsing off.


If you'd prefer hardware: http://www.lumobodytech.com/lumo-lift/


Really interesting project!

Caveat, not to take anything away from it, but I've found that my posture is mostly correlated with how much exercise I'm getting, and that I have a pretty limited ability to consciously fix it over a sustained period of time. Maybe Slouchy will help you, but if you end up frustrated by constant warnings, consider easing into a routine with some back and shoulders exercises.


I vaguely remember reading that not all slouching is equal and that some forms of slouching are actually better for you (I googled but cannot find the original article but it appears there are various similar articles).

For example the leaning backwards slouch is supposedly better for your back than just sitting completely erect.


I had a similar idea for public speakers.

There are known good and bad stances when you are giving a speech. The idea would be to follow the speaker and recognize his position using for example a kinect camera.

You could then get feedback either at the end of a dry run, or in real-time during the presentation.


Maybe feedback through a hidden shock collar of sorts?


This is neat.

OpenCV can also detect smoking. Will this be the next step in the trend to collect as much health data as possible?


Is the setup menu supposed to do anything? It doesn't do anything for me on a Mac.


Yup, it takes a reference measurement of your upright posture. You should see your webcam indicator light flash. Slouchy then uses this reference to periodically check for slouching.

Please note that some Mac cameras require time to "warm up", so if yours is one of these then check slouchy.ini for a camera_delay config option.


Great, now my credit score will be affected by my posture as well




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: