Theory of optical edge detection and imaging of thick layers