Effects of scattering by inhomogeneous media on the performance of integrated grating couplers