Measurement of the atmospheric muon charge ratio with the OPERA detector