You know, I had a similar idea a few years ago. Initial idea was to prevent eye strain. You can check it out: <a href="http:&#x2F;&#x2F;viewaide.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;viewaide.com&#x2F;</a>
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.