Here is a good way to put this fact into practice:
Everyone has a few really good photos of themselves - photos in which you look your best (thinnest, hottest, happiest, most confident, etc.). The camera caught you at your best angle, you were wearing your best colors and your hair looks really good. You probably enjoy looking at these pictures because they make you feel good about yourself. It isn't just a matter of looking good; these pictures probably capture a certain poise or spirit of which you are proud - they illustrate you at your best.
Choose the best of these photos in your mind. The next time you catch yourself slouching, remember that photos, and specifically, remind yourself that you are the person in that picture. You will automatically and immediately (albeit temporarily) correct your posture. With repetition, you will begin to see yourself as the person in the photo more than you see yourself as the person who slouches. Before long, perfect posture will be a habit.