The main object is to improve image contrast, highlight the target area, and solve the darker image, the poor contrast,the obscure target area,and the difficulty to analyze, so that the right judgments can be made to identify the problem. The image of the target,the background separation,and the two parts of the gray values were processed in order to highlight the target and inhibit the background,so that people or machines can make a better analysis and processing. And the X-ray image is used as an example simulation. The experiments show that the algorithm can achieve image enhancement, can enhance the target area,can inhibit the background region, thereby enhancing the image contrast, the target area stand out from the background area, the image will help us to observe, analyze, judge and process.