The optimization of a phase-only filter (POF) in terms of discrimination capability is presented. The notion of a phase-difference histogram and its modification are proposed for selecting the support function of the POF. Some numerical results obtained with the conventional POF and the optimized POF are given. The discrimination capability is increased significantly. © 1994 Optical Society of America.