A method for extracting moving targets under complex illumination changes at night
By constructing a background model and region growing algorithm, the problem of inaccurate moving target extraction caused by illumination changes in active infrared camera imaging videos is solved, and accurate moving target extraction under complex lighting conditions is achieved.
Patent Information
- Application Number
- CN202111538008.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-15
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2041-12-15
AI Technical Summary
In the existing technology, when the lighting changes seriously in the active infrared camera imaging video, the moving target extraction is inaccurate, resulting in the extraction result containing a large number of background pixels and lacking practical value.
A background model is constructed, information entropy is calculated through differential image and gamma transformation, initial growth seed points and growth threshold are selected, and the moving target is segmented using the region growing algorithm.
In videos with severe illumination changes, moving targets are accurately extracted, which improves the accuracy of moving target extraction and the results can be used for further analysis and utilization.
Smart Images

Figure QLYQS_2 
Figure QLYQS_4 
Figure QLYQS_8
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of video extraction, and in particular to a method for extracting moving targets under complex illumination changes at night. Background Art
[0002] In the field of public video surveillance, the types of video surveillance equipment commonly used at night can be divided into two types, one is active infrared camera and the other is passive infrared camera. Active infrared camera emits infrared light to illuminate the monitored area and images the monitored area by collecting reflected infrared light. Passive infrared camera forms images by collecting the radiation energy of different objects in the monitored area. Since the cost of active infrared camera is lower than that of passive camera, active infrared camera is widely used in the field of public video surveillance. However, active infrared camera is easily affected by light interference when imaging the monitored area. Light interference mainly comes from two aspects. One is that the moving target is close to the infrared fill light of the infrared camera, and the moving target blocks part of the infrared light, so that the monitored area except the moving target receives less infrared light, which ultimately causes the imaging picture of this part of the area to be darker than the imaging picture of the moving target. The second is the illumination change caused by artificial infrared light to the monitored area, which causes the imaging of the monitored area to cause brightness changes. The active infrared imaging screen is as follows: Figure 1 As shown, Figure (a) shows the image when there is no illumination change, and Figure (b) shows the image when illumination changes dramatically. The image produced by an active infrared imager is a grayscale image, with each pixel value ranging from 0 to 255. Due to the influence of light interference, pixel values can vary significantly, with the most severe cases increasing to over 200 or decreasing to below 100. However, human vision cannot directly detect the extent of illumination changes; only when illumination changes are very dramatic can the degree of illumination change be clearly discerned.
[0003] The result of moving object extraction is a binary image. Pixels representing moving objects are called foreground pixels and should be displayed as white, with a pixel value of 255. Pixels representing non-moving objects are called background pixels and should be displayed as black, with a pixel value of 0. Current technologies for moving object extraction are sensitive to lighting variations and cannot handle video images with drastic lighting changes. The extracted moving objects contain a large number of background pixels, rendering the extracted results useless. Summary of the Invention
[0004] The purpose of the present invention is to provide a method for extracting moving targets under complex illumination changes at night, so as to solve the problem of inaccurate extraction of moving targets in the existing technology when there are serious illumination changes in the imaging video of an active infrared camera.
[0005] The technical solution of the present invention to solve the above technical problems is as follows:
[0006] The present invention provides a method for extracting moving targets under complex illumination changes at night, the method comprising:
[0007] S1: Acquire video data in a nighttime environment with light interference;
[0008] S2: constructing a background model based on some continuous frame images of the video data;
[0009] S3: Processing the video data according to the background model to obtain a processing result;
[0010] S4: According to the processing result, the moving target is extracted using a region growing algorithm.
[0011] Optionally, in step S1, an active infrared camera is used to acquire the video data, and the video data is infrared data.
[0012] Optionally, step S2 includes:
[0013] Determine the target pixel point and target neighborhood;
[0014] Acquire a target number of consecutive frame images within a target neighborhood of the target pixel point;
[0015] Calculate the average value of pixel values of target number of frames;
[0016] The background model is constructed according to the average value.
[0017] Optionally, the background model M(x) is:
[0018] M(x)={y i (x)y i (x)∈N AG (x)i=1,2,…,20}
[0019] Among them, y i (x) represents the i-th sample point in the background model M(x) corresponding to the pixel x; N AG (x) represents the image f AG The set of all pixels in the 8-neighborhood of the pixel in (x), and That is, the image after averaging the first 20 frames of video data, f i is the i-th frame image of the video data.
[0020] Optionally, step S3 includes:
[0021] Obtaining a differential image of a current frame image of the video data according to the background model;
[0022] performing a gamma transformation on the differential image to obtain a transformed image;
[0023] Calculating the information entropy of the transformed image;
[0024] According to the information entropy, an initial growth seed point is selected and a growth threshold is calculated;
[0025] The initial growth seed point and the growth threshold are output as the processing result.
[0026] Optionally, obtaining a differential image of a current frame image of the video data according to the background model includes:
[0027] Randomly acquiring a plurality of samples from the background model;
[0028] Calculating the difference between each pixel point of the sample and the pixel point of the current frame image respectively, to obtain a plurality of difference values that is consistent with the number of the plurality of sample points;
[0029] calculating a mean of a plurality of said differences;
[0030] The mean is taken as the difference image.
[0031] Optionally, the information entropy is calculated in the following manner:
[0032]
[0033] Among them, L is the gray level of the image, P k Representing an image The ratio of pixels with a pixel value of k to the total pixels of the image, represents the transformed image; is the information entropy of the differential image of the i-th frame after gamma transformation.
[0034] Optionally, selecting an initial growth seed point according to the information entropy includes:
[0035] A1: Determine whether the information entropy is greater than the reference entropy. If so, proceed to step A2; otherwise, proceed to step A3.
[0036] A2: In the transformed image, taking the pixel value of 250 as the starting point, obtaining a target number of pixels in the direction of the pixel value of 0 and then proceeding to step A6;
[0037] A3: determining an area with a larger grayscale value in the transformed image;
[0038] A4: Determine the pixel value with the largest number of pixels in the area with a larger grayscale value;
[0039] A5: Taking the pixel value with the largest number of pixels in the region with the larger grayscale value as the center, obtain the target number of pixels from the adjacent pixel values and then proceed to step A6;
[0040] A6: Use the target number of pixels as initial growth seed points.
[0041] Alternatively, the growth threshold h is calculated as follows:
[0042]
[0043] Among them, S b is the experience value; MAX s is the maximum image entropy. The maximum entropy of the grayscale image is 8 and the minimum is 0. b is the benchmark threshold of region growing segmentation, which is 0.3. is the information entropy of the differential image of the i-th frame after gamma transformation.
[0044] The present invention has the following beneficial effects:
[0045] The present invention first constructs a background model for the entire video, subtracts frames with severe illumination variations from the background model to obtain a differential image, transforms the pixel values of the differential image, selects different growth seed points and growth thresholds based on the information entropy of the transformed image, and finally uses a region growing algorithm to segment moving targets. This can address the problem of inaccurate extraction of moving targets by existing technologies when there are severe illumination variations in imaging videos from active infrared cameras. The present invention's technology provides more accurate extraction of moving targets from video images with illumination variations, and the extracted results can be used for further analysis and utilization of moving targets. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 This is a display diagram of active infrared imaging in the prior art;
[0047] Figure 2 This is a flow chart of the method for extracting moving targets under complex lighting changes at night provided by the present invention;
[0048] Figure 3 A flow chart of selecting initial growth seed points according to the information entropy in the method for extracting moving targets under complex nighttime illumination changes provided by the present invention;
[0049] Figure 4 is the histogram of the transformed image. DETAILED DESCRIPTION
[0050] The principles and features of the present invention are described below with reference to the accompanying drawings. The examples given are only used to explain the present invention and are not used to limit the scope of the present invention.
[0051] Example
[0052] The present invention provides a method for extracting moving targets under complex illumination changes at night. Figure 2 As shown, the moving target extraction method includes:
[0053] S1: Acquire video data in a nighttime environment with light interference;
[0054] S2: constructing a background model based on some continuous frame images of the video data;
[0055] S3: Processing the video data according to the background model to obtain a processing result;
[0056] S4: According to the processing result, the moving target is extracted using a region growing algorithm.
[0057] In the present invention, an active infrared camera is used to acquire the video data, which is infrared data. The video is captured in a nighttime environment with illumination interference. The video is a single-channel grayscale image in the .avi format. Of course, those skilled in the art may also acquire the video data using other methods and save it in other formats, and this invention does not limit this.
[0058] Optionally, step S2 includes:
[0059] Determine the target pixel point and target neighborhood;
[0060] Acquire a target number of consecutive frame images within a target neighborhood of the target pixel point;
[0061] Calculate the average value of pixel values of target number of frames;
[0062] The background model is constructed according to the average value.
[0063] As an embodiment, in the present invention, the average value of the pixel values of the first 20 consecutive frames of the video is used to construct a background model for the video. From the perspective of the pixel point, the background model of a pixel point contains 20 samples, and these 20 samples are respectively from the point 8 area of the pixel.
[0064] Optionally, the background model M(x) is:
[0065] M(x)={y i (x)y i (x)∈N AG (x)i=1,2,…,20}
[0066] Among them, y i (x) represents the i-th sample point in the background model M(x) corresponding to the pixel x; N AG (x) represents the image f AG The set of all pixels in the 8-neighborhood of the pixel in (x), and That is, the image after averaging the first 20 frames of video data, f i is the i-th frame image of the video data.
[0067] Optionally, step S3 includes:
[0068] Obtaining a differential image of a current frame image of the video data according to the background model;
[0069] Specifically comprising: randomly acquiring a plurality of samples in the background model;
[0070] Calculating the difference between each pixel point of the sample and the pixel point of the current frame image respectively, to obtain a plurality of difference values that is consistent with the number of the plurality of sample points;
[0071] calculating a mean of a plurality of said differences;
[0072] The mean is taken as the difference image.
[0073] As an embodiment, the present invention randomly selects n sample points from the background model, and then calculates the difference between the pixel point of the current frame image and the n sample points, and then takes the average of their differences as the difference image.
[0074]
[0075] Among them, j is a random number between 1 and N; there are n random numbers in total, n is an empirical value, after experimental testing, n can be taken as 5; y j (x) is the jth sample point in the background model M(x) corresponding to the pixel x. i (x) is the pixel value of pixel x in the i-th frame image in the video.
[0076] performing a gamma transformation on the differential image to obtain a transformed image;
[0077] The formula for gamma transformation is:
[0078] s=cr γ
[0079] Where c is 1, γ is 0.4, r is the pixel value of the difference image, and s is the pixel value of the pixel in the transformed image. The transformed image is recorded as
[0080] The information entropy of an image reflects the distribution of gray levels of the image to a certain extent, so it is necessary to calculate the information entropy of the transformed image.
[0081] Optionally, the information entropy is calculated in the following manner:
[0082]
[0083] Among them, L is the gray level of the image, P k Representing an image The ratio of pixels with a pixel value of k to the total pixels of the image, represents the transformed image; is the information entropy of the differential image of the i-th frame after gamma transformation.
[0084] According to the information entropy, an initial growth seed point is selected and a growth threshold is calculated;
[0085] Optionally, obtaining a differential image of a current frame image of the video data according to the background model includes:
[0086] Alternatively, refer to Figure 3 As shown, according to the information entropy, selecting the initial growth seed point includes:
[0087] A1: Determine whether the information entropy is greater than the reference entropy. If so, proceed to step A2; otherwise, proceed to step A3.
[0088] A2: In the transformed image, taking the pixel value of 250 as the starting point, obtaining a target number of pixels in the direction of the pixel value of 0 and then proceeding to step A6;
[0089] A3: determining an area with a larger grayscale value in the transformed image;
[0090] A4: Determine the pixel value with the largest number of pixels in the area with a larger grayscale value;
[0091] A5: Taking the pixel value with the largest number of pixels in the region with the larger grayscale value as the center, obtain the target number of pixels from the adjacent pixel values and then proceed to step A6;
[0092] by Figure 4 For example, the horizontal axis in the histogram represents the pixel value, and the vertical axis is the total number of pixel points corresponding to the pixel value. When the pixel value with the largest number of pixel points is 100, the corresponding pixel points are close to 7000, so the 100 pixel value is determined to be the center pixel value, and the target number of pixel points is obtained in the neighborhood of pixel values 50 and / or 150.
[0093] A6: Use the target number of pixels as initial growth seed points.
[0094] Specifically, when When the entropy value of the image is relatively small and the illumination change is relatively small, the image after gamma transformation The grayscale distribution of the entire image is uneven. The grayscale is distributed in two areas, namely the grayscale value close to the background point and the moving target point. The grayscale value of the moving target point is larger, so Find the pixel value with the largest number of pixels in the distribution area of the larger gray value, and then select H pixels from this pixel value and its adjacent pixel values as the initial seed points; When , the entropy value of the image is relatively large, that is, the intensity of the illumination change is relatively large. After the gamma transformation, the difference between the pixel value of the background point of the image and the pixel value of the target point is small, and the pixel value of the moving target is large. Starting from pixel value 250, search towards 0 for H pixels as initial seed points to avoid interference points with large pixel values. The pixel value range is 0-255. Since the pixel value of an image of a normal object is unlikely to be 255, a pixel value of 255 is largely due to white noise generated by noise. Therefore, to avoid noise to a certain extent, search from 250 towards 0.
[0095] Alternatively, the growth threshold h is calculated as follows:
[0096]
[0097] Among them, S b It is an empirical value. Through experimental testing, the value of the present invention is 3.0; MAX s is the maximum image entropy. The maximum entropy of the grayscale image is 8 and the minimum is 0. b is the benchmark threshold of region growing segmentation, which is 0.3. is the information entropy of the differential image of the i-th frame after gamma transformation.
[0098] The initial growth seed point and the growth threshold are output as the processing result.
[0099] The region growing algorithm is an image segmentation algorithm. The initial growth seed point and growth threshold in the region growing algorithm determine the final image segmentation result, deciding which region in the image to start growing and when to stop growing. The initial growth seed point is considered a set of pixels with the same attributes. A check is performed to see if all connected components of the initial growth seed point have the same attributes as the initial growth seed point, that is, if the pixel difference is less than the growth threshold h. Pixels with the same attributes as the initial growth seed point are merged with the initial growth seed point to form a growth seed point. The algorithm then continues to determine if all connected components of the growth seed point have the same attributes as the growth seed point until all connected components have different attributes from the growth seed point. The resulting growth seed points, or growth region, are the moving target of the current video frame.
[0100] The present invention has the following beneficial effects:
[0101] The present invention first constructs a background model for the entire video, subtracts frames with severe illumination variations from the background model to obtain a differential image, transforms the pixel values of the differential image, selects different growth seed points and growth thresholds based on the information entropy of the transformed image, and finally uses a region growing algorithm to segment moving targets. This can address the problem of inaccurate extraction of moving targets by existing technologies when there are severe illumination variations in imaging videos from active infrared cameras. The present invention's technology provides more accurate extraction of moving targets from video images with illumination variations, and the extracted results can be used for further analysis and utilization of moving targets.
[0102] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for extracting moving targets under complex illumination changes at night, characterized in that: The moving target extraction method comprises: S1: Acquire video data in a nighttime environment with light interference; S2: constructing a background model based on some continuous frame images of the video data; S3: Processing the video data according to the background model to obtain a processing result; S4: extracting the moving target using a region growing algorithm according to the processing result; The step S2 includes: Determine the target pixel point and target neighborhood; Acquire a target number of consecutive frame images within a target neighborhood of the target pixel point; Calculate the average value of pixel values of target number of frames; constructing the background model according to the average value; The step S3 comprises: Obtaining a differential image of a current frame image of the video data according to the background model; performing a gamma transformation on the differential image to obtain a transformed image; Calculating the information entropy of the transformed image; According to the information entropy, an initial growth seed point is selected and a growth threshold is calculated; outputting the initial growth seed point and the growth threshold as the processing result; According to the information entropy, selecting the initial growth seed point includes: A1: Determine whether the information entropy is greater than the reference entropy. If so, proceed to step A2; otherwise, proceed to step A3. A2: In the transformed image, taking the pixel value of 250 as the starting point, obtaining a target number of pixels in the direction of the pixel value of 0 and then proceeding to step A6; A3: determining an area with a larger grayscale value in the transformed image; A4: Determine the pixel value with the largest number of pixels in the area with a larger grayscale value; A5: Taking the pixel value with the largest number of pixels in the region with the larger grayscale value as the center, obtain the target number of pixels from the adjacent pixel values and then proceed to step A6; A6: Using the target number of pixels as initial growth seed points; The growth threshold Calculated as follows: in, is the experience value; is the maximum image entropy; is the benchmark threshold for region growing segmentation, For the The information entropy of the frame difference image after gamma transformation.
2. The method for extracting moving targets under complex illumination changes at night according to claim 1, characterized in that: In the step S1, an active infrared camera is used to acquire the video data, which is infrared data.
3. The method for extracting moving targets under complex illumination changes at night according to claim 1, characterized in that: The background model for: in, Represents pixel points Corresponding background model The sample points; Indicated in the image The set of all pixels in the 8-neighborhood of the pixel in , that is, the image after averaging the first 20 frames of video data, The first Frame image.
4. The method for extracting moving targets under complex illumination changes at night according to claim 1, characterized in that: The step of obtaining a differential image of a current frame of the video data according to the background model includes: Randomly acquiring a plurality of samples from the background model; Calculating the difference between each pixel point of the sample and the pixel point of the current frame image respectively, to obtain a plurality of difference values that is consistent with the number of the plurality of sample points; calculating a mean of a plurality of said differences; The mean is taken as the difference image.
5. The method for extracting moving targets under complex illumination changes at night according to claim 1, characterized in that: The information entropy is calculated as follows: in, is the grayscale level of the image, Representing an image The pixel value is The ratio of pixels to the total pixels of the image, represents the transformed image; For the The information entropy of the frame difference image after gamma transformation.
Citation Information
Patent Citations
Method and system for detecting moving objects
CN101739550A
Method for detecting and tracking infrared small target in complex background
CN102103748A
Video based movement target detecting method
CN108537821A