The Procession de la Sanch has its origins in the middle ages. As condemned prisoners were led to their deaths, both prisoner and executioner were hooded. In order to protect their identities and perhaps in a show of solidarity with the principle actors in these dramas, the groups of men who accompanied them also wore the distinctive peaked hood. These Penitents were there to give solace to the person about to die, remembering that Christ too was condemned and that through his sacrifice even the lowliest of sinners could be saved through penitence.
Over time the drama developed into a regular, annual religious procession. The original purpose dropped by the wayside but the garb remained, and the Penitents' purpose evolved exclusively into a commemoration of the most famous condemned man in Christendom. Thus, on his day of execution, Good Friday, they march through towns in a somber display of mourning.
These are some photos from from my visit to see the Procession in Perpignan: