Facial recognition technology used by a police force lacks sufficient legal framework, the information commissioner's lawyers have said.
If used routinely, without tighter rules, it could track people's habits, a judicial review in Cardiff heard.
Ed Bridges has launched the first major legal challenge over South Wales Police's use of the equipment after his picture was taken while shopping.
Gerry Facenna QC raised concerns about the force's use of the technology.
Automatic facial recognition (AFR) technology maps faces in a crowd by measuring the distance between facial features then compares results with images on a "watch list".
The information commissioner is described as an "intervener" in the review, but is not a complainant.
Mr Facenna, representing the commissioner, said with 12.5 million images on the police national database - including those not found guilty of a crime - rules were also needed on which images from that are included on the "watch list".
The list currently includes suspects, missing people and persons of interest.
Mr Bridges told the hearing that weak regulation means AFR breached human rights.
Mr Facenna said questions about its use included when and where it can be used, what can be done with the footage, whose approval would be needed for it and whether it could be confirmed the system was not being hacked.
He said the Home Office previously agreed the regime could be strengthened in its own biometric strategy.
Civil rights group Liberty said the use of the tool is equivalent to the unregulated taking of DNA or fingerprints without consent.
But South Wales Police has defended its application and the force told the court it used the equipment within the correct legal framework.
The hearing has now concluded.
Mr Justice Swift and Lord Justice Haddon-Cave said they would take their time to consider what they described as "an important case that makes novel and potentially far-reaching" conclusions.
South Wales Police said it welcomed the judicial review.
Deputy Chief Constable Richard Lewis said: "We have sought to be proportionate, transparent and lawful in our use of AFR during the trial period and have worked with many stakeholders to develop our approach and deployments.
"During this period we have made a significant number of arrests and brought numerous criminals to justice," he said.