The transformer label says "PRIMARY: BLK & WHT". So its black and white wires are the 120 V ("primary") connections. Its other wires are the "secondary", ie the 24 V connections. The theory is simple enough: one of the transformer secondary wires should lead directly to the R terminal; the other one is C. I'm not certain but it looks like the secondary wires might both be blue.
Figuring out which is which, and sorting out whether your thermostat wires are reversed, is a little more complicated. Start by disconnecting the thermostat from its wiring. We'll re-connect it later.
Next let's identify which of the thermostat terminals is the R terminal. Start at either of the terminals and trace the wiring, working toward the transformer. It might help to also start at the transformer and trace one of the wires, working toward the thermostat terminals. Eventually you'll find a continuous wiring path between one of the secondary wires and one of the thermostat terminals. That terminal is the R terminal. If your W wire is connected to it then swap the R and W wire connections.
Finally, track the C connection from the transformer secondary out to some place that's convenient to tap. Just follow it along until you get to a terminal where the C wire could be reasonably attached. Ideally it should be on the right-hand side of that barrier which divides the low-voltage thermostat stuff from the mains-voltage stuff. When you do find a good location, connect your spare (blue?) thermostat conductor there.
Now it's time to test. With the thermostat still disconnected turn the system power on. Measure AC voltage between the thermostat R and W wires and between the R and C wires. You should find something like 24-28 volts between each of those pairs, and about 0 volts between W and C. Next, short R to W to call for heat. The system should begin heating in its usual way and continue as long as R and W are shorted.
With those checks passed, go ahead and connect the thermostat.