Phase Retrieval with Application to Optical Imaging