In February, a woman told the police that a delivery man had exposed himself to her in a Manhattan building. He was about 5 feet 6 inches tall.

Two months later, evidence shows, the police arrested the wrong man. He was 6-foot-2.

The man, Trevis Williams, was driving from Connecticut to Brooklyn on the day of the crime, and location data from his phone put him about 12 miles away at the time. But a facial recognition program plucked his image from an array of mug shots and the woman identified him as the flasher.

Trevis Williams is eight inches taller than a man accused of flashing a woman in Union Square in February. The police arrested him anyway.