Measurement of the magnetic birefringence in oxygen and nitrogen gases