Judges have ruled against a shopper who brought a legal challenge against police use of automated facial recognition (AFR) technology.
The court refused the judicial review on all grounds, finding South Wales Police had followed the rules and their use of AFR was justified.
The High Court said this was the first time any court in the world had considered the use of the technology.
Civil rights group Liberty said its client would appeal against the ruling.
It had argued it was akin to the unregulated taking of DNA or fingerprints without consent, and it is campaigning for an outright ban of the practice.
The judicial review was held in May after Ed Bridges, from Cardiff, claimed his human rights were breached when he was photographed while Christmas shopping.
His legal challenge argued the use of the tool breached his right to privacy as well as data protection and equality laws.
The court's key findings included:
- South Wales Police's use of AFR met the requirements of the Human Rights Act and its actions were subject to sufficient legal controls
- On data protection, the force was processing personal data, but in a lawful manner that met the conditions set out in the legislation
- The force had complied with equality laws
- The current legal regime is adequate to ensure the appropriate and non-arbitrary use of AFR.
Liberty lawyer Megan Goulding said: "This disappointing judgment does not reflect the very serious threat that facial recognition poses to our rights and freedoms.
"Facial recognition is a highly intrusive surveillance technology that allows the police to monitor and track us all."
Mr Bridges said he had his image captured by the technology a second time at a peaceful protest against the arms trade.
On Wednesday he added: "South Wales Police has been using facial recognition indiscriminately against thousands of innocent people, without our knowledge or consent.
"This sinister technology undermines our privacy and I will continue to fight against its unlawful use to ensure our rights are protected and we are free from disproportionate government surveillance."
A spokesperson for the Information Commissioner, which had argued during the judicial review the legal framework for police use of AFR was not sufficient, said they would be reviewing the judgment carefully.
They welcomed the finding that the police use of the technology involved processing sensitive personal data.
"Our investigation into the first police pilots of this technology has recently finished. We will now consider the court's findings in finalising our recommendations and guidance to police forces about how to plan, authorise and deploy any future [facial recognition] systems.
"In the meantime, any police forces or private organisations using these systems should be aware that existing data protection law and guidance still apply."
Automated facial recognition technology maps faces in a crowd by measuring the distance between features, then compares results with a "watch list" of images - which can include suspects, missing people and persons of interest.
Concerns have been raised the technology is intrusive and more likely to return false positives for women and people from ethnic minorities.
South Wales Police, Metropolitan Police and Leicestershire Police have used facial recognition in public spaces since June 2015.
South Wales Chief Constable Matt Jukes said the decision was welcome but not the end of the "wider debate".
"I recognise that the use of AI and face-matching technologies around the world is of great interest and, at times, concern.
"So, I'm pleased that the court has recognised the responsibility that South Wales Police has shown in our programme. With the benefit of this judgment, we will continue to explore how to ensure the ongoing fairness and transparency of our approach."
South Wales Police and Crime Commissioner Alun Michael said his priority had been to ensure the police "make best use of technology to keep the public safe while also working within the law and protecting civil liberties."
The Home Office welcomed the judgment confirming there was a "clear and sufficient legal framework" for the use of AFR.
Mr Justice Swift and Lord Justice Haddon-Cave, who gave their decision on Wednesday, had previously described it as "an important case that makes novel and potentially far-reaching" conclusions.