Until then, the firemen units were formed from samurai and were too few in number, but the newly established units included chōnin, the class of merchants and craftsmen. Each town created multiple firemen groups (there were 48 in Edo), each with an assigned area, having its own unique uniform and matoi flag.
As you can see in the photo, the matoi wasn't actually a flag, it was a complicated, three-dimesional object made of paper, straw braids, leather and wood, used for identification and for signaling the place of the fire... It was also used like the today's beacon lights: the firemen were running with the matoi carrier in front, to signal bystanders to make way for the group.
Travel tip: If you're in Japan at the beginning of the year, you can see traditional firefighting groups re-enacted at the Japanese New Year's Parade of Fire Brigades (Dezome-shiki) in Odaiba, around January 6th.
EXIF info:
Nikon D90
Lens: VR 70-300mm F/4.5-5.6G
Focal Length: 200mm
Aperture: F/6.3
Shutter Speed: 1/400s
ISO Sensitivity: ISO 200