This paper proposed an automatic exposure algorithm based on luminance histogram and region segmentation. The method ensures well exposure to the main object under the backlighting or excessive front-lighting conditions, and uses the characteristics of the luminance histogram to judge the scene condition. According to the luminance histogram, if the image under normal light conditions, the method compares the average luminance value of the image with the corresponding reference target brightness value to adjust exposure compensation. If the image under special conditions, the average brightness value will be calculated using fixed-partition method and exposure compensation will be adjusted. The paper combines auto-exposure and auto-gain control to adjust the exposure compensation. As it turns out, this method in a variety of light conditions can achieve well exposure.