Localization of optimal perturbations using a projection operator