A computer algorithm can tell if a person is gay or straight simply by scanning a picture of their face, researchers have shown.

Artificial intelligence software developed at the University of Stanford can predict a person’s sexuality with far more accuracy than humans, suggesting a “gaydar” app may not be far away.

The research has potentially troublesome implications for citizens’ privacy and safety.