The invention discloses a method for modeling a background based on a
camera response function in an automatic
gain scene, which comprises the following steps of: performing automatic
gain progressiveness-based analysis to obtain a roughly divided background area, obtaining low-
noise training data by using a joint
histogram method, and performing
recovery once to obtain a globally optimal
camera response function by the method based on maximum likelihood
estimation and parameter constraints; online calculating a
gain ratio frame by frame by utilizing correlation between a foreground and background difference and the gain ratio and the
homography of a
grayscale difference function relative to the gain ratio; and if the gain ratio is not 1, performing updating to obtain a background
reference frame the same as a current
reference frame by using the
camera response function and the gain ratio, otherwise determining the background
reference frame is unchanged, and obtaining the background reference frame with a
gain coefficient the same as that of the current frame along with the change of the
gain coefficient of a camera. By the method, the shortcomings of high background change speed, caused by difficulties in realizing automatic gain along with the camera, of the conventional methods are overcome, thereby ensuring high-efficiency
motion detection.