The invasion of privacy comes in when you create an exact replica of someone. As detailed as Barclay's holodeck simulations of Troi were, he must have been using some kind of holoimage of her, not just his imagination.
If it was forbidden in the Trekverse, Geordi would not have been able to create Leah Brahms (including her psychological profile!), because the computer would simply not let him do it (privacy settings in the Starfleet database and all that).
The invasion of privacy in Barclay's case would ONLY be the taking of the pictures without consent, not the digital recreation for personal use. But then again, that's what paparazzi do in the real world and it's widely accepted.
Imagining having sex with someone is one thing, but I think running a simulation of someone like that infringes on a person's right to privacy.
How would you feel is someone had a RealDoll made that looked just like you?
Depending on who uses it, I'd ask: "Why just the doll?"
And if you masturbate to photographs of your crush on Facebook, it's actually YOUR private right to do so.
I like Dax's response to Bashir's Dax in If Wishes Were Horses. "If anything I should apologize to you for intruding on your private fantasies".
That is indeed a good point about it.
People act like it's a horrible invasion of their privacy if someone,
only for himself, imagines stuff with them. But the bigger invasion of privacy is how they find out about that after all. People should be able to do whatever the hell they want. And if it's just for personal use, it doesn't hurt ANYONE. And if you find out about it, then you gotta ask yourself first how you found out about it (probably by invading the privacy of someone else).
It's like checking emails of your partner if you suspect (s)he's cheating on you. That doesn't make it right.
Just imagine a world where every Hollywood celebrity could sue anyone who jerked off to footage of them. They SHOULD be able to stop paparazzi taking pictures of them everywhere, though, because that is the actual invasion of privacy.