In this correspondence, a generalized version of the ICM method for im
age enhancement is developed. The proposed algorithm utilizes the char
acteristic of Markov random fields (MRF) in modeling the contextual in
formation embedded in image formation. To cope with real images, a new
local MRF model with a second-order neighborhood is introduced. This
model extracts contextual information not only from the intensity leve
ls but also from the relative position of neighboring cliques, Also, a
n outlier rejection method is presented. In this method, the rejection
depends on each candidate's contribution to the local variance. To co
pe with a mixed noise case, a hypothesis test is implemented as part o
f the restoration procedure. The proposed algorithm performs signal ad
aptive, nonlinear, and recursive filtering. In comparing the performan
ce of the new procedure with several well-known order statistic filter
s, the superiority of the proposed algorithm is demonstrated both in t
he mean-square-error (MSE) and the mean-absolute-error (MAE) senses. I
n addition, the new algorithm preserves the details of the images well
, It should be noted that the blurring effect is not considered in thi
s work.