If your dog has a tendency to mount and hump your leg, it probably doesn't mean the same thing as when he humps another animal. While dogs may hump each other to establish dominance or mate, they generally have different motives with people. Your dog's behavior may be psychological, sexual or even learned, so pay attention to the environmental factors when he mounts so you can better understand his reasoning.
When your dog has a lot of pent-up excitement and he doesn't know how to channel it, humping may be his go-to solution. This is why dog-on-human humping frequently occurs when an owner comes home -- the dog is so excited to see him that he doesn't know what to do, so he mounts and humps him. This isn't necessarily related to anything sexual or even dominance, but rather the simple fact that the dog has excited energy to burn off.
Nervousness and Anxiety
Dogs may hump people or inanimate objects as a way of coping with anxiety or nervousness. For example, your dog may hump unsuspecting strangers visiting your home if their presence makes him uneasy. Cognitive dissonance may also make him anxious enough to hump you. For example, when you return home, he may bark out of excitement. If you scold him for barking, he becomes confused, because he feels happiness at your return and unhappiness at being scolded. This confusion may compel him to engage in a simple, comforting, instinctive behavior like humping.
Plenty of dog behaviors are learned because of how humans react to them -- for example, if you react positively when your dog kisses you, he learns to do it again and again. Because your dog doesn't inherently know what behaviors are and aren't acceptable, he may pick up the humping habit because he's learned from you or from others that it's OK. Neglecting to discourage the behavior allows the habit to form -- he may even develop a habit of humping your leg as a means of getting your attention.
While dogs don't hump humans to try and mate with them, they may do it as a means of masturbation. Both intact and neutered animals may masturbate for the pleasant physical sensations, whether their targets be stuffed animals, furniture or humans. While neutering your dog may curb this behavior, the older he gets and the longer he keeps up the habit, the harder it will be for him to stop -- it typically takes a combination of neutering and behavioral training to end the humping.