Weak localization and the transmission matrix