This letter presents an adaptive contrast enhancement algorithm considering both preservation of the shape of a one-dimensional (1-D) histogram and statistical information on the gray-level differences between neighboring pixels obtained by a 2-D histogram. The proposed system consists of two modules. One is to enhance the entire contrast by stretching the 1-D histogram while preserving the shape of the histogram. The other is to improve the details of nonsmooth areas occurring frequently in input images. These are formulated into a single constrained optimization problem. Compared with several state-of-the-art enhancement algorithms, the proposed algorithm shows highly competitive performance.