Optical emission measurements of H2 and D2 molecules in the divertor region of ASDEX Upgrade