Detection and treatment of refractive errors