There are different ways to detect if someone is sitting or standing with a bad posture. Different companies are trying to detect if you are slouching and remind you to sit/stand straight. One of these is Lumo (https://www.lumobodytech.com/) which is using wearable monitors to the angle of your spine based on an accelerometer/gyro. An entirely different approach is using face tracking based on a regular webcam. Besides the webcam itself, no additional hardware is necessary.
I came up with this idea and a simple Processing.org-Script three years ago: http://coretechrobotics.blogspot.de/2014/05/headup-webcam-posture-monitor.html
My software called "Headup" is based on an example for the OpenCV Processing library by Greg Borenstein:
Based on this example, I took the height and size of the recognized face to determine of someone is slouching or sitting too close to the monitor. You sit straight, then calibrate the software. If your face moves below this threshold, an alarm pops up over the webcam image. The project got featured on hackaday and around that time someone asked me to make an improved version. This second version includes an additional popup-window, so the program can be minimized.
If you want to try out the software, all the necessary files and the source code is available on github: