The giant dipole resonance in the transition region from spherical to deformed nuclear shapes