Parking space state detection method, device, equipment and storage medium
By identifying and labeling shadow changes caused by scene factors as background, and using Gaussian mixture model and frame difference algorithm, the problems of lighting changes and interference from shadows of distracting objects in parking lock detection are solved, thus improving the accuracy of parking space status detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- MOMENTA (SUZHOU) TECHNOLOGY CO LTD
- Filing Date
- 2024-11-28
- Publication Date
- 2026-05-29
AI Technical Summary
Existing parking lock detection technologies are easily affected by changes in lighting and shadows from obstructions in video surveillance, leading to a decrease in the accuracy of parking space status detection.
By identifying shadow changes caused by scene factors and marking them as background, Gaussian mixture model and frame difference algorithm are used to distinguish and mark inherent dynamic shadow areas, eliminate shadow interference, and improve the accuracy of parking space status detection.
It effectively eliminates shadow interference caused by scene factors, improves the accuracy of parking space status detection, and ensures that video analysis technology can accurately identify shadow changes when vehicles enter and exit parking spaces.
Smart Images

Figure CN122116218A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of parking lock detection technology, and in particular to a parking space status detection method, device, equipment, and storage medium. Background Technology
[0002] Parking lock detection is a crucial traffic monitoring system primarily used to determine the occupancy status of parking lots or roadside parking spaces. It involves technologies such as sensor technology, image processing, and wireless communication. With the continuous advancement of intelligent transportation systems and smart city construction, parking lock detection technology is receiving increasing attention. Current parking lock detection methods mostly rely on video surveillance or geomagnetic sensors for real-time parking space monitoring.
[0003] The process of detecting parking space status based on video surveillance typically involves installing cameras on parking locks to monitor parking spaces in real time, collecting surveillance video, and then using image recognition technology to analyze changes in shadows in the video to determine whether the parking space is occupied. However, there are interfering factors in the scene where the parking space is located, such as changes in lighting, swaying leaves, and shadows cast by passing vehicles and pedestrians, all of which can affect the shadow state in the video and interfere with the determination of parking space status through video analysis. Summary of the Invention
[0004] This application provides a parking space status detection method, apparatus, device, and storage medium. It identifies shadows caused by scene factors, marks the shadow changes caused by scene factors as background in the video, and then performs video analysis. This eliminates the influence of shadows caused by scene factors on the video foreground, thereby improving the accuracy of detecting parking space occupancy.
[0005] In a first aspect, embodiments of this application provide a parking space status detection method, applied to an electronic device. The method includes: obtaining the state change of an inherent dynamic shadow corresponding to a target parking space over time; the inherent dynamic shadow is a shadow of the target parking space caused by scene factors unrelated to vehicle parking; the scene factors include changes in illumination and movement of interfering objects; based on the state change of the inherent dynamic shadow over time, marking a target area in each frame of a key image in the monitoring video of the target parking space as a dynamic background; the target area is the pixel area corresponding to the inherent dynamic shadow in the current frame image; and detecting the parking space status in the monitoring video carrying the marking.
[0006] The parking space status detection method proposed in this application first identifies shadow changes caused by scene factors, including shadow changes caused by changes in lighting and shadow changes caused by the movement of interfering objects. In the monitoring video, the identified shadow changes caused by scene factors are marked as background. Then, the video with shadow changes caused by scene factors as background is analyzed, thereby eliminating the interference of shadows caused by scene factors on the image recognition of other shadows. This ensures that the video analysis technology can accurately identify shadow changes caused by vehicles entering and leaving parking spaces, thereby improving the accuracy of parking space status detection.
[0007] In one possible implementation, the method further includes: Calculate the difference region between each key image frame and the reference frame in the surveillance video to obtain at least one motion shadow region in the surveillance video that is in motion. Obtain the influencing factors that cause each motion shadow region; Based on the influence factor, determine whether the motion shadow region is the inherent dynamic shadow.
[0008] In one possible implementation, determining whether the motion shadow region is the inherent dynamic shadow based on the influence factor includes: When any moving shadow region corresponds to an influencing factor that is the scene factor, the moving shadow region is determined to be the inherent dynamic shadow.
[0009] One possible implementation involves obtaining the influencing factors that cause each pixel region, including: For each key image frame of the surveillance video, the pixels in the image are classified. When the classification result of the pixel is one of the following background regions, the influencing factor corresponding to the pixel is determined to be the scene factor; the background region includes shadows caused by changes in illumination, shadows caused by the swaying of interfering objects, and shadows caused by the movement of interfering objects.
[0010] In one possible implementation, the method further includes: If the image region corresponding to the pixel is an inherent dynamic shadow, mark the image frame corresponding to the first time according to the first time of acquiring the image frame corresponding to the pixel as an inherent dynamic shadow; Obtain the state changes of the inherent dynamic shadow corresponding to the target parking space over time, including: Image frames marked with inherent dynamic shadows are sorted according to their respective first time size; Based on the inherent dynamic shadow's state change over time, the target area in each key frame of the surveillance video of the target parking space is marked as a dynamic background, including: In the image frames arranged according to the first time, the inherent dynamic shadow is marked as a dynamic background.
[0011] In one possible implementation, the difference region between each key image frame and a reference frame in the surveillance video is calculated to obtain at least one motion shadow region in the surveillance video that is in motion, including: The image of the target parking space is acquired when it is unaffected by scene factors and is used as the reference frame; The frame difference algorithm is used to calculate the difference image between each key image and the reference frame in sequence; When the difference between any key image and the reference frame is greater than a preset threshold, the difference image is determined as the motion shadow region.
[0012] In one possible implementation, for each key image frame of the surveillance video, the pixels in the image are classified, including: Gaussian distributions were set for shadows caused by changes in illumination, shadows caused by the swaying of interfering objects, and shadows caused by the movement of interfering objects, respectively, and Gaussian mixture models were established. Multiple pixels in each key frame image are input into the Gaussian mixture model, and the Gaussian mixture model is used to cluster the multiple pixels and match the pixels to the set Gaussian model. When a pixel matches any of the following Gaussian models: shadows caused by changes in lighting, shadows caused by the movement of objects, and shadows caused by the movement of objects, the pixel classification result is output, and the pixel is identified as a background pixel. When no Gaussian model is matched, the output pixel is the foreground pixel.
[0013] In one possible implementation, multiple pixels from each key frame are input into the Gaussian mixture model, and the Gaussian mixture model is used to cluster the multiple pixels, matching the pixels to a set Gaussian model, including: Calculate the mean and variance of different Gaussian models; Based on the degree of matching between each pixel value and the mean and variance, the pixel values are classified into the corresponding Gaussian distribution; The method further includes: Update the corresponding weights for each Gaussian model based on the actual pixels matched. Based on the weights corresponding to each Gaussian model, the probabilities of illumination changes, object swaying, and object movement as scene factors are adjusted.
[0014] In one possible implementation, the method further includes: Update the foreground mask of the marked moving object based on the foreground pixels; If the foreground mask is an arbitrary motion shadow region, perform connected component analysis on the foreground mask to identify independent moving objects.
[0015] In one possible implementation, before marking the target area in each key frame of the surveillance video of the target parking space as a dynamic background based on the state change of the inherent dynamic shadow over time, the method further includes: The color difference is calculated by comparing the pixels in the motion shadow area with the background pixels in the key frame of the surveillance video. A texture analysis algorithm is used to compare the texture similarity between the motion shadow region and the background region in the keyframe of the monitoring video, and the similarity is calculated. Based on the aforementioned influence factor, determining whether the motion shadow region is the inherent dynamic shadow includes: When the color difference and the similarity are both within their respective reasonable ranges, and the influencing factor corresponding to any moving shadow region is the scene factor, the region of the inherent dynamic shadow is optimized according to the influencing factor.
[0016] In one possible implementation, the motion shadow region is determined to be the foreground when the color difference or the similarity is not within its respective reasonable range.
[0017] In one possible implementation, the method further includes: Collect light intensity data of the scene corresponding to the target parking space; Calculate the trend of light intensity change over time; Compare the trend of the light intensity over time with the state change of the foreground pixels over time; If the trend of change is consistent with the state change of the foreground pixel over time, update the state change of the foreground pixel and the inherent dynamic shadow over time.
[0018] In one possible implementation, before performing connected component analysis on the foreground mask to identify individual moving objects, the method further includes: Perform opening and closing operations on the foreground mask to adjust the foreground mask; If the foreground mask is an arbitrary motion shadow region, perform connected component analysis on the foreground mask to identify independent moving objects, including: Perform connected component analysis on the adjusted foreground mask to identify independent moving objects.
[0019] In one possible implementation, detecting the parking space status in the tagged surveillance video includes: For each key image frame marked in the surveillance video, determine the average brightness of the dynamic background included therein, as well as the average brightness of other backgrounds besides the dynamic background. The average brightness of the dynamic background is compensated until it reaches the average brightness of the other backgrounds; The parking space status is detected in the surveillance video after brightness compensation.
[0020] Secondly, embodiments of this application provide a parking space status detection device, which is installed in an electronic device, the device comprising: The shadow acquisition module is used to obtain the state change of the inherent dynamic shadow corresponding to the target parking space over time; the inherent dynamic shadow is the shadow of the target parking space caused by scene factors and is unrelated to the parking of the vehicle; the scene factors include changes in lighting and movement of interfering objects; The shadow marking module is used to mark the target area in each key frame of the surveillance video of the target parking space as a dynamic background based on the state change of the inherent dynamic shadow over time; the target area is the pixel area corresponding to the inherent dynamic shadow in the current frame image. A status detection module is used to detect the parking space status in the surveillance video carrying tags.
[0021] Thirdly, embodiments of this application provide an apparatus, including: at least one processor; and at least one memory communicatively connected to the processor, wherein: the memory stores program instructions executable by the processor, and the processor can execute the method provided in the first aspect by invoking the program instructions.
[0022] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer instructions that cause the computer to perform the method provided in the first aspect.
[0023] It should be understood that the second to fourth aspects of the embodiments of this application are consistent with the technical solutions of the first aspect of the embodiments of this application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation are similar, and will not be described again. Attached Figure Description
[0024] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0025] Figure 1 This is a flowchart of the parking space status detection method proposed in the embodiments of this application; Figure 2 This is a flowchart illustrating an example of updating a Gaussian distribution according to this application; Figure 3 This is a flowchart of another parking space status detection method proposed in the embodiments of this application; Figure 4 This is a functional block diagram of the parking space status detection device proposed in the embodiments of this application; Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0026] To better understand the technical solutions in this specification, the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0027] It should be understood that the described embodiments are merely some, not all, of the embodiments in this specification. All other embodiments obtained by those skilled in the art based on the embodiments in this specification without inventive effort are within the scope of protection of this specification.
[0028] The terminology used in the embodiments of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of this specification. The singular forms “a,” “the,” and “the” used in the embodiments of this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.
[0029] The system collects surveillance video of parking spaces and analyzes the video to identify changes in shadows to determine whether a vehicle has entered or left the parking space. However, shadows caused by other factors in the video can interfere with the identification of vehicles entering and leaving the parking space.
[0030] Other factors that cause dynamic shadows in videos include: Lighting variations: As the sun's position changes throughout the day and clouds move, lighting conditions can change drastically in a short period, causing shadows to constantly change in size and shape. This can pose challenges for video-based parking space detection systems. Furthermore, changes in the sun's altitude angle across seasons also affect the length and direction of shadows; differences in shadows at the same location at different times can reduce the accuracy of detection algorithms.
[0031] Environmental dynamics: The swaying of leaves, the shadows cast by passing vehicles and pedestrians can all lead to misjudgments. Especially in windy or busy traffic conditions, dynamic shadows are more frequent, increasing the difficulty of image processing.
[0032] In view of the above problems, this application proposes a parking space status detection method, which is applied to an electronic device. The electronic device can be a smart parking lock equipped with an image acquisition device, or a computer connected to the parking lock's image acquisition device, etc.
[0033] Figure 1 This is a flowchart of the parking space status detection method proposed in the embodiments of this application, as follows: Figure 1 As shown, the parking space status detection method includes the following steps: S101: Obtain the state change of the inherent dynamic shadow corresponding to the target parking space over time.
[0034] The inherent dynamic shadow is a shadow cast on the target parking space that is unrelated to the parking of the vehicle, caused by scene factors; the scene factors include changes in lighting and movement of distracting objects.
[0035] The target parking space is the parking space currently undergoing status detection.
[0036] Disturbing objects can include: swaying leaves, flying animals, and walking pedestrians. First, the surveillance video is analyzed to identify interfering shadows that appear in the scene corresponding to the target parking space, and how these shadows change over time. Based on these changes, the interfering shadows can be separated from the video frames captured at the corresponding time points and marked as part of the dynamic background. Then, image analysis is performed on the foreground of the surveillance video to identify shadows caused by vehicles entering or leaving the target parking space, thus determining whether vehicles have entered or left the target parking space. Since no interfering shadows affect the identification of the foreground, the accuracy of parking space status detection is improved. These interfering shadows are typically caused by swaying leaves, flying animals, walking pedestrians, and changes in lighting.
[0037] The inherent dynamic shadow is a dynamically changing shadow obtained after analyzing the surveillance video in this application embodiment. This dynamically changing shadow serves as the background part of the surveillance video and enters the next step of image recognition processing to identify whether the parking space is occupied by a vehicle.
[0038] S102: Based on the state change of the inherent dynamic shadow over time, mark the target area in each key image frame of the target parking space as a dynamic background in the monitoring video of the target parking space.
[0039] The target region is the pixel region corresponding to the inherent dynamic shadow in the current frame image.
[0040] Obtaining the state changes of inherent dynamic shadows over time can be achieved not only by displaying the distribution areas of shadow portions in image frames corresponding to different times, demonstrating the manifestation of shadows cast by disturbances on parking spaces in a real-world scene, but also by locating image frames related to inherent dynamic shadow changes based on time information. This allows for the marking of relevant pixel areas within the image frames, resulting in surveillance video that clearly distinguishes between background and foreground, with the inherent dynamic shadow prominently displayed in the background. It is worth noting that for monitoring and debugging purposes, it may be necessary to display these shadow markers on the final video output or user interface.
[0041] This application also proposes a method for marking the target area in each key frame of the surveillance video of the target parking space as a dynamic background in chronological order: S1021: If the image region corresponding to the pixel is an inherent dynamic shadow, mark the image frame corresponding to the first time of acquiring the image frame corresponding to the pixel as an inherent dynamic shadow.
[0042] If the image region corresponding to the pixel is not an inherent dynamic shadow, mark the foreground dynamic region in the image region corresponding to the second time according to the second time of acquiring the image frame corresponding to the pixel.
[0043] S1022: Sort the image frames marked with inherent dynamic shadows according to their respective first time size.
[0044] S1023: In the image frames arranged according to the first time, the inherent dynamic shadow is marked as a dynamic background.
[0045] For example, the surveillance video includes image frame a, image frame b, and image frame c. The pixel set C1 is the inherent dynamic shadow, and the timestamp carried by image frame a is t1; the pixel set C2 is the inherent dynamic shadow, and the timestamp carried by image frame b is t2; the pixel set C3 is the inherent dynamic shadow, and the timestamp carried by image frame b is t3; where t2 > t1 > t3, in the order of t2 > t1 > t3, the image area formed by C2 in image frame b, the image area formed by C1 in image frame a, and the image area formed by C3 in image frame c are marked as inherent dynamic shadows, thus obtaining inherent dynamic shadows that change in the order of t2-t1-t3.
[0046] In this embodiment, detected dynamic shadows are marked in video frames so that these areas can be ignored or appropriately processed during subsequent parking space occupancy detection. Marking detected dynamic shadows in video frames ensures that these marked shadow areas are not misjudged as shadow changes caused by vehicles entering or exiting during parking space occupancy detection or other video analysis tasks, thereby improving the accuracy of parking space detection.
[0047] This application provides an example of a specific method for performing "marking the target area as a dynamic background in each key frame of the surveillance video of the target parking space": M11: Integrate shadow information and combine it with the shadow detection and illumination change analysis results from the previous steps to identify the target region in the current frame.
[0048] M12: Generate markers. Creates a marker layer the same size as the video frame to represent the target area.
[0049] M13: Fill marker layer. On the marker layer, fill the pixels corresponding to the inherent dynamic shadows in the detected target area with a specific color or marker.
[0050] S103: Detect the parking space status in the surveillance video carrying the marker.
[0051] Step S103 can be performed in the following specific manner: M14: For each key image frame marked in the surveillance video, determine the average brightness of the dynamic background contained therein, and the average brightness of other backgrounds besides the dynamic background; M15: Compensate for the average brightness of the dynamic background until it reaches the average brightness of the other backgrounds.
[0052] M16: Detect parking space status in the surveillance video after brightness compensation.
[0053] In this embodiment, considering that although the pixel region corresponding to the inherent dynamic shadow contained in each keyframe image of the surveillance video is marked as the dynamic background, the average brightness of the dynamic background may be inconsistent with the average brightness of other surrounding backgrounds. Therefore, the average brightness of the dynamic background can be compensated first until it reaches the average brightness of other backgrounds. This is equivalent to the average brightness of the background in each keyframe image being uniform, which facilitates better differentiation between the foreground and background later. For example, a brightness compensation factor can be obtained by calculating the ratio of the average brightness of other backgrounds to the average brightness of the dynamic background; then, the average brightness of the dynamic background is compensated based on this brightness compensation factor so that the average brightness of the dynamic background can reach the average brightness of other backgrounds.
[0054] Based on this, foreground is extracted from each keyframe image in the surveillance video, and then foreground features are extracted from the extracted foreground. For example, the extracted foreground features can be area, aspect ratio, height, etc., and this application does not impose any particular restrictions on this. If the extracted foreground features match the pre-stored ground lock raising features, it can be considered that there is a ground lock in the target parking space and that the ground lock is in the raised state. At this time, the user can output an alarm message, which is used to indicate that the parking space status of the target parking space is that the ground lock is raised and cannot be used.
[0055] It is worth noting that ultrasonic sensors can also be used to jointly detect the parking space status. If both the image detection result and the ultrasonic sensor detection result indicate that the target parking space has a parking lock, then it is determined that the target parking space has a parking lock; otherwise, it is considered that the target parking space does not have a parking lock.
[0056] The aforementioned parking space status detection method first identifies shadow changes caused by scene factors, including shadow changes caused by changes in lighting and shadow changes caused by the movement of interfering objects. In the monitoring video, the identified shadow changes caused by scene factors are marked as background. Then, the video with shadow changes caused by scene factors as background is analyzed, thereby eliminating the interference of shadows caused by scene factors on the image recognition of other shadows. This ensures that the video analysis technology can accurately identify shadow changes caused by vehicles entering and leaving parking spaces, thereby improving the accuracy of parking space status detection.
[0057] This application also proposes an optional method for obtaining the state change of inherent dynamic shadows over time. First, identify image regions that change between different frames in the video as motion shadow regions. Then, identify whether the motion shadow region is a shadow caused by interfering objects. If the motion shadow region is a shadow caused by interfering objects, then determine that the motion shadow region is an inherent dynamic shadow caused by scene factors and needs to be marked as the background.
[0058] S101 includes the following sub-steps: S1011: Calculate the difference region between each key image frame and the reference frame in the surveillance video to obtain at least one motion shadow region in the surveillance video that is in motion.
[0059] The reference frame extracted in this embodiment is an image frame in the surveillance video that is free from shadow interference. In other words, the reference frame can be considered a video frame captured in the target parking space scene when there are no moving objects (such as vehicles, pedestrians, etc.) and no lighting interference. Acquiring the reference frame before motion detection begins helps the system more accurately distinguish pixel changes caused by the movement of vehicles or other objects in subsequent frames. Typically, the initial frame of the video can be used as the reference frame.
[0060] Keyframes can be any frame of a surveillance video, or they can be used to analyze changes in the position of video content, such as object movement or scene transitions. When a significant event or scene change is detected, the current frame is set as the keyframe.
[0061] In one example of this application, a frame difference method is used to calculate the difference region between each key image frame and the reference frame.
[0062] The following methods can be used to execute S1011: M21: Acquire an image of the target parking space when it is unaffected by scene factors as the reference frame; M22: The frame difference algorithm is used to calculate the difference image between each key image and the reference frame in sequence; M23: When the difference between any key image and the reference frame is greater than a preset threshold, the difference image is determined as the motion shadow region.
[0063] When the difference between the key image and the reference frame is greater than a preset threshold, it can be determined that the difference between the key image and the reference frame is caused by a moving object. When the difference between the key image and the reference frame is greater than the preset threshold, the pixel area corresponding to the difference image in the key image is marked as a motion shadow area.
[0064] An example of surveillance video in this application includes image frames {a1, a2, a3, ... a...} n Extract reference frame a m-1 Calculate a i With a m-1 The difference in pixel values at the same position between two images is used to collect the pixels in the difference region to form a difference image. This yields the difference region between each key image and the reference frame. If the difference in pixel values in the difference region is greater than a preset threshold, the pixel region is determined to be a motion region. The difference image highlights all detected motion regions, resulting in a motion shadow region, where i is an integer ranging from (1 to n).
[0065] S1012: Obtain the influence factor that causes each motion shadow area.
[0066] Factors that contribute to motion shadow areas can include swaying leaves, pedestrians passing by, changes in lighting, and vehicles entering or leaving the target parking space. Therefore, by analyzing these factors, it can be determined whether to include motion shadow areas as background.
[0067] S1013: Based on the influence factor, determine whether the motion shadow region is the inherent dynamic shadow.
[0068] When any moving shadow region corresponds to an influencing factor that is the scene factor, the moving shadow region is determined to be the inherent dynamic shadow.
[0069] For example, if the influencing factors that cause the motion shadow area A are swaying leaves, passing pedestrians, changes in lighting, etc., the motion shadow area A is determined to be an inherent dynamic shadow. If the influencing factor that causes the motion shadow area B is a vehicle entering the target parking space, the motion shadow area B is determined to be the foreground.
[0070] This application also proposes a method for "obtaining the influence factor that causes each motion shadow region", which starts from the pixels of the video image, classifies the pixels, and determines the influence factor based on the pixel classification results.
[0071] The execution of S1012 can be carried out in the following ways: M31: For each key image frame of the surveillance video, classify the pixels in the image.
[0072] This application proposes an example of a method for classifying pixels by establishing a Gaussian model; M311: Gaussian distributions are set for shadows caused by changes in illumination, shadows caused by the swaying of interfering objects, and shadows caused by the movement of interfering objects, respectively, to establish a Gaussian mixture model.
[0073] For each pixel location in the video, a Gaussian distribution is set based on its value in the reference frame; in the Gaussian Mixture Model (GMM), the background of a pixel is assumed to be a mixture of multiple possible states, each of which is represented by a Gaussian distribution.
[0074] Gaussian distributions can be set for changes in lighting, swaying leaves, and passing pedestrians, respectively. Different Gaussian distributions can be used to capture different features of the pixel over time, specifically capturing pixel value changes caused by changes in lighting, camera vibration, or small movements in the environment.
[0075] For example, Gaussian distribution 1 is set based on changes in illumination, and Gaussian distribution 2 is set based on the movement of leaves. A Gaussian mixture model containing Gaussian distribution 1 and Gaussian distribution 2 is established. Image 1, which shows shadows caused by changes in illumination, and image 2, which shows shadows caused by the movement of leaves, are collected as training samples. Gaussian distribution 1 is trained to learn the different features of pixel changes over time in image 1, and Gaussian distribution 2 is trained to learn the different features of pixel changes over time in image 2, until the clustering output of the Gaussian mixture model for the input pixels matches the labeling of the samples. After training, the Gaussian mixture model can correctly classify the input pixels, identifying whether a pixel is a pixel in a shadow area caused by the movement of leaves or a pixel in a shadow area caused by changes in illumination.
[0076] Each Gaussian distribution has three parameters: Mean: Represents the center value of the color or intensity corresponding to this Gaussian distribution.
[0077] Variance: Represents the range of deviation from the mean, i.e. the width of the Gaussian distribution. A large variance indicates that the color or intensity fluctuates over a wide range.
[0078] The mean and variance represent the features of pixels that conform to a specific Gaussian distribution.
[0079] For example, Gaussian distribution 1 learns the different features of pixels in the shadow image 1 as time changes. The stable mean and variance can represent the characteristics of pixels in the shadow produced by the change of illumination. Thus, the Gaussian mixture model can classify the input pixels based on these characteristics.
[0080] Weight: Represents the relative importance of this Gaussian distribution in the pixel model, and can also be understood as the probability of this state occurring.
[0081] For example, if a pixel is set with Gaussian distribution 1 and Gaussian distribution 2, where Gaussian distribution 2 is below a set threshold, it means that the corresponding position of the pixel will not normally display the shadow caused by the swaying of leaves. Gaussian distribution 2 can be removed to reduce the amount of calculation.
[0082] M312: Input multiple pixels from each key frame image into the Gaussian mixture model, use the Gaussian mixture model to cluster the multiple pixels, and match the pixels to the set Gaussian model.
[0083] Clustering multiple pixels using the Gaussian mixture model and matching the pixels to the set Gaussian model includes: Calculate the mean and variance of different Gaussian models; Gaussian mixture models classify input pixel values into corresponding Gaussian distributions based on the degree of matching between each pixel value and its mean and variance.
[0084] Gaussian mixture models can determine whether a pixel belongs to a certain Gaussian distribution by calculating the posterior probability of a pixel with respect to a Gaussian distribution.
[0085] M32: When the classification result of the pixel is one of the following background regions, the influencing factor corresponding to the pixel is determined to be the scene factor; the background region includes shadows caused by changes in illumination, shadows caused by the swaying of interfering objects, and shadows caused by the movement of interfering objects.
[0086] For example, the background area corresponding to the classification result of the pixel includes the shadow cast by sunlight on the still objects in the target parking space. Since sunlight changes over time, the shadow cast by sunlight on the still objects in the target parking space also changes over time, which will interfere with the recognition of shadows cast by vehicle movement in the video. The background area corresponding to the classification result of the pixel also includes the shadow cast by sunlight or lamplight on dynamic interference objects, which can include swaying leaves, passing pedestrians, etc.
[0087] M33: When a pixel matches any of the following Gaussian models: shadow caused by changes in lighting, shadow caused by the movement of an object, or shadow caused by the movement of an object, the pixel is output as a classification result and is identified as a background pixel.
[0088] M34: When no Gaussian model is matched, the output pixel is the foreground pixel.
[0089] In one example of this application, the Gaussian mixture model includes Gaussian distribution 1, Gaussian distribution 2, and Gaussian distribution 3. Gaussian distribution 1 is set to correspond to changes in illumination, Gaussian distribution 2 is set to correspond to the swaying of leaves, and Gaussian distribution 3 is set to correspond to the passing of pedestrians. The pixel points {p1, p2, ..., p...} of image frame a are... n Input a Gaussian mixture model, where the Gaussian mixture model is applied to pixels {p1, p2, ..., p...} n Classify and output the results, p1 to p2. m Matched to Gaussian distribution 1, p m to p n-m Matched to Gaussian distribution 2, p n-m to p n No Gaussian distribution was matched; determine pixels p1 to p2. m p m to p n-m For background pixels, p n-m to p n Foreground pixels; it can also output result pixels p1 to p2. m and pixel p m to p n-m The influencing factors are the scenario factors.
[0090] Furthermore, if the frame difference output result shows a certain motion shadow region 'a' from pixel p1 to p... m The formation process allows us to determine that the motion shadow region 'a' is an inherent dynamic shadow. Furthermore, since image frame 'a' has a timestamp, we can obtain the pixel points p1 to p2 at the corresponding time in image frame 'a'. mThe features of the inherent dynamic shadow at the corresponding time of image frame a are obtained; correspondingly, image frame b is input into the Gaussian mixture model to obtain the classification result. By performing difference calculation on the image frame and the reference frame, the features of the inherent dynamic shadow at the corresponding time of image frame b can also be obtained. By analogy, the features of the inherent dynamic shadow at the corresponding time of multiple image frames can be obtained, and thus the state change of the inherent dynamic shadow over time can be obtained.
[0091] After executing step M34, "When no Gaussian model is matched, output the pixels as foreground pixels," the pixels that serve as foreground are obtained, and the mask of the moving objects in the foreground can be updated. All pixels identified as foreground are aggregated to create a foreground mask to highlight all moving objects, which is the foreground portion of the surveillance video.
[0092] M341: Update the foreground mask of the marked moving object based on the foreground pixels; M342: If the foreground mask is an arbitrary motion shadow region, perform connected component analysis on the foreground mask to identify independent moving objects.
[0093] In another embodiment of this application, the Gaussian distribution set in the Gaussian mixture model can be adjusted according to the matching results of the Gaussian model.
[0094] M313: Update the corresponding weights for each Gaussian model based on the actual pixels matched.
[0095] M314: Adjust the probabilities of lighting changes, object swaying, and object movement as scene factors according to the weights corresponding to each Gaussian model.
[0096] If a pixel successfully matches a Gaussian distribution, the mean and variance of that Gaussian distribution are updated based on the pixel's value. After multiple pixels have matched Gaussian distributions, the variance of all Gaussian distributions is updated. If multiple pixels do not match a Gaussian distribution, that Gaussian distribution is removed.
[0097] Figure 2 This is a flowchart of an example of updating a Gaussian distribution according to this application, such as... Figure 2 As shown, the process of updating the Gaussian distribution includes: i. Acquire new surveillance video and extract key image frames from the surveillance video. The input is based on a Gaussian mixture model, which has been set with Gaussian distributions corresponding to different shadows.
[0098] ii. Matching to an existing Gaussian distribution: For each pixel in a video frame, the algorithm attempts to match it to an existing Gaussian distribution.
[0099] iii. If a pixel successfully matches a Gaussian distribution, update that Gaussian distribution. After all pixels have been matched, the pixels that did not match a Gaussian distribution can be analyzed. If some pixels correspond to image areas that are shadows caused by other interference objects, a new Gaussian distribution can be set for those interference objects.
[0100] iv. Adjusting weights and parameters: Depending on the matching results, it may be necessary to adjust the weights and other parameters (such as mean and variance) of each Gaussian distribution.
[0101] v. Update the foreground mask: Based on the matching results, update the mask used to mark moving objects (foreground). If a pixel does not match any Gaussian distribution, it is determined that the pixel belongs to the foreground. All pixels identified as foreground are grouped together to create a foreground mask. This mask can be used to highlight all moving objects, that is, the foreground portion of the video.
[0102] vi. Remove low-weight Gaussian distributions. If the weights of a Gaussian distribution are too low, indicating that it rarely or no longer represents any state in the background, then remove it from the model.
[0103] Figure 3 This is a flowchart illustrating another parking space status detection method proposed in the embodiments of this application, such as... Figure 3 As shown, after fusing the frame difference and Gaussian model outputs to obtain the inherent dynamic shadows, we can first apply morphological processing, shadow detection and removal processing, and connected component analysis to the video marked with inherent dynamic shadows to further determine the dynamic shadows as the background, ensuring the accuracy of the dynamic shadow markings, and then perform parking space status detection on the video.
[0104] Another parking space status detection method proposed in this application includes the following steps: S1, the frame difference method is used to calculate the difference region between each key image in the monitoring video and the reference frame, so as to obtain at least one motion shadow region in the monitoring video that is in motion.
[0105] S2: Classify the pixels in each key frame image using a pre-established Gaussian mixture model, match the Gaussian distribution corresponding to the pixels, and based on the matching results, if some pixels match any Gaussian distribution, determine that some pixels belong to the background, identify the area formed by some pixels as the background shadow area, and determine that the factor causing the formation of the background shadow area is the scene factor. If other pixels do not match any Gaussian distribution, determine that other pixels belong to the foreground, and update the foreground mask.
[0106] S3: Perform a logical AND operation on the outputs of S1 and S2, fuse the foreground mask, identify whether the motion shadow area belongs to the background shadow area, and if the influencing factor of the motion shadow area output by S1 is a scene factor, determine that the motion shadow area is an inherent dynamic shadow.
[0107] S3: Apply morphological operations to the inherent dynamic shadows to eliminate noise and smooth the edges of moving areas.
[0108] The process of applying morphological operations to intrinsic dynamic shadows using S3 includes: Perform opening and closing operations on the foreground mask to adjust the foreground mask.
[0109] Opening is a process that follows erosion with a dilation operation. Erosion involves scanning the image with a structuring element. If all pixels within the structuring element are foreground pixels, those pixels are retained; otherwise, they are removed (set as background). This "shrinks" the foreground area and removes small protrusions at the edges.
[0110] The dilation operation refers to setting all background pixels within the coverage area of the structuring element as foreground pixels if the structuring element overlaps with the foreground pixels, in order to "enlarge" the foreground area. However, it mainly restores the boundary parts that were mistakenly deleted in the erosion step on the original basis.
[0111] The closing operation is a process of first dilating and then eroding. The dilating operation first "enlarges" the foreground area, which helps to connect objects that are close together; the eroding operation "shrinks" back to near the original size, but because dilution was performed first, the holes and cracks inside the objects are filled.
[0112] The typical process for performing the opening and closing operations described above is as follows: 1. Choose an appropriate structural element: This element defines the specific effect of the morphological operation. It is usually a simple geometric shape (such as a circle or square) whose size should match the amount of noise that is to be removed or filled.
[0113] 2. Perform the opening operation: If there are many small noise points in the foreground mask or if it is necessary to disconnect some objects that are in contact with each other, use the opening operation.
[0114] 3. Perform the closing operation: If the target object in the foreground mask has small holes or cracks, or if multiple closely spaced objects need to be connected, use the closing operation.
[0115] 4. Repetition and Combination: Opening and closing operations may need to be repeated multiple times or in different orders to achieve the best results. In some cases, other morphological operations may be used in combination as needed.
[0116] S4: Performs shadow detection and removal operations on the foreground, further adjusts the foreground and background, and optimizes the range of inherent dynamic shadows.
[0117] The process of performing shadow detection and removal operations on the foreground using S4 includes: The color difference is calculated by comparing the pixels in the motion shadow area with the background pixels in the key frame of the surveillance video. A texture analysis algorithm is used to compare the texture similarity between the motion shadow region and the background region in the keyframe of the monitoring video, and the similarity is calculated. When the color difference and the similarity are both within their respective reasonable ranges, and the influencing factor corresponding to any moving shadow region is the scene factor, the region of the inherent dynamic shadow is optimized according to the influencing factor.
[0118] When the color difference and the similarity are not within their respective reasonable ranges, the relevant distribution in the motion shadow region is determined as the foreground; when the color difference or the similarity is within a reasonable range, the region that meets the shadow feature threshold condition is marked as a shadow and removed from the foreground mask as an inherent dynamic shadow.
[0119] S5: Perform illumination change analysis on the image frames of the surveillance video to further optimize the range of the inherent dynamic shadow.
[0120] The process of performing illumination change analysis on image frames of surveillance video using S5 includes: Collect light intensity data of the scene corresponding to the target parking space; Calculate the trend of light intensity change over time; Compare the trend of the light intensity over time with the state change of the foreground pixels over time; If the trend of change is consistent with the state change of the foreground pixel over time, update the state change of the foreground pixel and the inherent dynamic shadow over time.
[0121] For example, if a foreground area suddenly darkens and then brightens again at time t4-t5, and the foreground area is detected to match the lighting changes at time t4-t5, it can be determined that the brightness changes of the foreground area at time t4-t5 are actually caused by the lighting. Therefore, the foreground area can be optimized into an inherent dynamic shadow.
[0122] This involves analyzing changes in ambient light intensity to distinguish between pixel changes caused by altered lighting and changes caused by actual moving objects. By analyzing lighting changes in image frames of surveillance video as described above, simple motion detection algorithms may misinterpret these changes as defects caused by moving objects under conditions of strong light or rapidly changing shadows, thus improving the accuracy of shadow recognition and consequently improving the accuracy of subsequent parking space status detection.
[0123] S5: Perform connected component analysis on the foreground mask obtained after performing morphological operations, shadow detection and removal operations, and illumination change analysis to identify independent moving objects. Also, mark the optimized intrinsic dynamic shadow obtained after performing morphological operations, shadow detection and removal operations, and illumination change analysis, and output the marked monitoring video. Detect the parking space status in the marked monitoring video.
[0124] The video frames processed as described above accurately marked dynamic shadows, further eliminating changes in lighting, optimizing the shadow portion, and eliminating interference from dynamic shadows on parking space status detection.
[0125] Figure 4 This is a functional block diagram of the parking space status detection device proposed in the embodiments of this application. The parking space status detection device is installed in an electronic device, such as... Figure 4 As shown, the device includes: The shadow acquisition module 41 is used to acquire the state change of the inherent dynamic shadow corresponding to the target parking space over time; the inherent dynamic shadow is the shadow of the target parking space caused by scene factors and is unrelated to the parking of the vehicle; the scene factors include changes in lighting and movement of interfering objects; The shadow marking module 42 is used to mark the target area in each key frame of the monitoring video of the target parking space as a dynamic background according to the state change of the inherent dynamic shadow over time; the target area is the pixel area corresponding to the inherent dynamic shadow in the current frame image. The status detection module 43 is used to detect the parking space status in the monitoring video carrying the marker.
[0126] Figure 4 The parking space status detection device provided in the illustrated embodiment can be used to execute this specification. Figures 1 to 3 The implementation principle and technical effects of the method embodiment shown can be further referred to the relevant description in the method embodiment.
[0127] Optionally, the device further includes: The first calculation module is used to calculate the difference region between each key image frame and the reference frame in the surveillance video, and to obtain at least one motion shadow region in the surveillance video that is in motion. The shadow determination module is used to obtain the influence factor that causes each moving shadow area; and to determine whether the moving shadow area is the inherent dynamic shadow based on the influence factor.
[0128] Optionally, the shadow determination module is specifically used to determine that the moving shadow area is the inherent dynamic shadow when the influencing factor corresponding to any moving shadow area is the scene factor.
[0129] Optionally, the shadow determination module includes: The classification submodule is used to classify the pixels in each key frame of the surveillance video. The influencing factor determination submodule is used to determine the influencing factor corresponding to the pixel as the scene factor when the classification result of the pixel is one of the following background regions; the background regions include shadows caused by changes in illumination, shadows caused by the swaying of interfering objects, and shadows caused by the movement of interfering objects.
[0130] Optionally, the device further includes: The time stamping module is used to mark the image frame corresponding to the first time when the image area corresponding to the pixel is an inherent dynamic shadow, according to the first time when the image frame corresponding to the pixel is acquired. The shadow acquisition module is specifically used to sort the image frames marked with inherent dynamic shadows according to their respective first time size, and obtain the state change of the inherent dynamic shadows over time. The shadow marking module is specifically used to mark the inherent dynamic shadow as a dynamic background in the image frames arranged according to the first time.
[0131] Optionally, the first computing module includes: The acquisition submodule is used to acquire an image of the target parking space when it is not affected by scene factors as the reference frame; The calculation submodule is used to calculate the difference image between each key image and the reference frame sequentially using the frame difference algorithm; The shadow region determination submodule is used to determine the difference image as the motion shadow region when the difference image between any key image and the reference frame is greater than a preset threshold.
[0132] Optionally, the classification submodule is specifically used to set Gaussian distributions for shadows caused by changes in illumination, shadows caused by the swaying of disturbances, and shadows caused by the movement of disturbances, and to establish a Gaussian mixture model. Multiple pixels in each key frame image are input into the Gaussian mixture model, and the Gaussian mixture model is used to cluster the multiple pixels and match the pixels to the set Gaussian model. When a pixel matches any of the following Gaussian models: shadows caused by changes in lighting, shadows caused by the movement of objects, and shadows caused by the movement of objects, the pixel classification result is output, and the pixel is identified as a background pixel. When no Gaussian model is matched, the output pixel is the foreground pixel.
[0133] Optionally, the classification submodule is specifically used to calculate the mean and variance of different Gaussian models; Based on the degree of matching between each pixel value and the mean and variance, the pixel values are classified into the corresponding Gaussian distribution; The device further includes: The first update module is used to update the corresponding weights of each Gaussian model based on the actual pixels matched by each Gaussian model. The first adjustment module is used to adjust the probabilities of lighting changes, object swaying, and object movement as scene factors according to the weights corresponding to each Gaussian model.
[0134] Optionally, the device further includes: The second update module is used to update the foreground mask of the marked moving object based on the foreground pixels. The foreground recognition module is used to perform connected component analysis on the foreground mask to identify independent moving objects if the foreground mask is an arbitrary motion shadow region.
[0135] Optionally, the device further includes: The first comparison module is used to compare the color of the pixels in the motion shadow area with the background pixels in the key frame of the monitoring video and calculate the color difference. The second comparison module is used to compare the texture similarity between the motion shadow area and the background area in the key frame of the monitoring video using a texture analysis algorithm, and calculate the similarity. The shadow judgment module is specifically used to optimize the region of the inherent dynamic shadow based on the influencing factor when the color difference and the similarity are both within their respective reasonable ranges, and the influencing factor corresponding to any moving shadow region is the scene factor.
[0136] Optionally, the shadow determination module is specifically used to determine the moving shadow area as the foreground when the color difference or the similarity is not within its respective reasonable value range.
[0137] Optionally, the device further includes: The acquisition module is used to acquire light intensity data of the scene corresponding to the target parking space; The second calculation module is used to calculate the trend of light intensity over time. The third comparison module is used to compare the trend of the light intensity over time with the state change of the foreground pixels over time. The third update module is used to update the state changes of the foreground pixel and the inherent dynamic shadow over time if the change trend is consistent with the state change of the foreground pixel over time.
[0138] Optionally, the device further includes: The second adjustment module is used to perform opening and closing operations on the foreground mask to adjust the foreground mask; The foreground recognition module is specifically used to perform connected component analysis on the adjusted foreground mask to identify independent moving objects.
[0139] Optionally, the status detection module 43 is specifically used for: For each key image frame marked in the surveillance video, determine the average brightness of the dynamic background included therein, as well as the average brightness of other backgrounds besides the dynamic background. The average brightness of the dynamic background is compensated until it reaches the average brightness of the other backgrounds; The parking space status is detected in the surveillance video after brightness compensation.
[0140] The apparatus provided in the above embodiments is used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effects can be further referred to the relevant descriptions in the method embodiments, and will not be repeated here.
[0141] The apparatus provided in the above embodiments may be, for example, a chip or a chip module. The apparatus provided in the above embodiments is used to execute the technical solutions of the above-described method embodiments. Its implementation principles and technical effects can be further referred to the relevant descriptions in the method embodiments, and will not be repeated here.
[0142] Regarding the modules / units included in the various devices described in the above embodiments, they can be software modules / units, hardware modules / units, or a combination of both. For example, for devices applied to or integrated into a chip, all modules / units can be implemented using hardware methods such as circuits, or at least some modules / units can be implemented using software programs running on a processor integrated within the chip, while the remaining modules / units can be implemented using hardware methods such as circuits. For devices applied to or integrated into a chip module, all modules / units can be implemented using hardware methods such as circuits. Different modules / units can be located in the same component (e.g., chip, circuit module, etc.) or different components of the chip module, or at least some modules / units can be implemented using software programs. The software program runs on the processor integrated inside the chip module, and the remaining modules / units can be implemented using hardware methods such as circuits. For each device applied to or integrated into an electronic terminal device, each of its modules / units can be implemented using hardware methods such as circuits. Different modules / units can be located in the same component (e.g., chip, circuit module, etc.) or different components within the electronic terminal device. Alternatively, at least some modules / units can be implemented using software programs that run on the processor integrated inside the electronic terminal device, and the remaining (if any) modules / units can be implemented using hardware methods such as circuits.
[0143] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device 500 includes a processor 510, a memory 511, and a computer program stored in the memory 511 and executable on the processor 510. When the processor 510 executes the program, it implements the steps in the aforementioned method embodiment. The electronic device provided in this embodiment can be used to execute the technical solution of the method embodiment shown above. Its implementation principle and technical effects can be further referred to the relevant descriptions in the method embodiment, which will not be repeated here. This application provides a computer-readable storage medium that stores computer instructions that cause the computer to execute this specification. Figures 1 to 3 The parking space status detection method provided in the illustrated embodiment. A computer-readable storage medium may refer to a non-volatile computer storage medium.
[0144] The aforementioned computer-readable storage medium may be any combination of one or more computer-readable media. A computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium may be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM) or flash memory, optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this document, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device.
[0145] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including—but not limited to—electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of transmitting, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0146] Program code contained on a computer-readable medium may be transmitted using any suitable medium, including—but not limited to—wireless, wire, optical fiber, radio frequency (RF), etc., or any suitable combination thereof.
[0147] Computer program code for performing the operations described herein can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as "C" or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0148] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0149] In the description of the embodiments in this application, the terms "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this specification. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in a suitable manner in any one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0150] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this specification, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0151] Any process or method described in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing custom logic functions or processes, and the scope of the preferred embodiments of this specification includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as will be understood by those skilled in the art to which the embodiments of this specification pertain.
[0152] Depending on the context, the word "if" as used here can be interpreted as "when," "when," "in response to determination," or "in response to detection." Similarly, depending on the context, the phrase "if determination" or "if detection (of the stated condition or event)" can be interpreted as "when determination," "in response to determination," "when detection (of the stated condition or event)," or "in response to detection (of the stated condition or event)."
[0153] It should be noted that the terminals involved in the embodiments of this application may include, but are not limited to, personal computers (PCs), personal digital assistants (PDAs), wireless handheld devices, tablet computers, mobile phones, MP3 players, MP4 players, etc.
[0154] In the several embodiments provided in this specification, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0155] Furthermore, the functional units in the various embodiments of this specification can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in a combination of hardware and software functional units.
[0156] The integrated units implemented as software functional units described above can be stored in a computer-readable storage medium. These software functional units, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of this specification. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0157] The above description is merely a preferred embodiment of this specification and is not intended to limit this specification. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of protection of this specification.
Claims
1. A method for detecting the status of a parking space, characterized in that, The method includes: The inherent dynamic shadow of the target parking space changes over time; the inherent dynamic shadow is the shadow of the target parking space caused by scene factors that are unrelated to the parking of the vehicle; the scene factors include changes in lighting and movement of interfering objects; Based on the state change of the inherent dynamic shadow over time, the target area in each key image of the target parking space is marked as a dynamic background in the monitoring video of the target parking space; the target area is the pixel area corresponding to the inherent dynamic shadow in the current frame image. The parking space status is detected in the surveillance video carrying tags.
2. The method according to claim 1, characterized in that, The method further includes: Calculate the difference region between each key image frame and the reference frame in the surveillance video to obtain at least one motion shadow region in the surveillance video that is in motion. Obtain the influencing factors that cause each motion shadow region; Based on the influence factor, determine whether the motion shadow region is the inherent dynamic shadow.
3. The method according to claim 2, characterized in that, Based on the aforementioned influence factor, determining whether the motion shadow region is the inherent dynamic shadow includes: When any moving shadow region corresponds to an influencing factor that is the scene factor, the moving shadow region is determined to be the inherent dynamic shadow.
4. The method according to claim 2, characterized in that, Obtain the influencing factors that cause each pixel region, including: For each key image frame of the surveillance video, the pixels in the image are classified. When the classification result of the pixel is one of the following background regions, the influencing factor corresponding to the pixel is determined to be the scene factor; the background region includes shadows caused by changes in illumination, shadows caused by the swaying of interfering objects, and shadows caused by the movement of interfering objects.
5. The method according to claim 4, characterized in that, The method further includes: If the image region corresponding to the pixel is an inherent dynamic shadow, mark the image frame corresponding to the first time according to the first time of acquiring the image frame corresponding to the pixel as an inherent dynamic shadow; Obtain the state changes of the inherent dynamic shadow corresponding to the target parking space over time, including: Image frames marked with inherent dynamic shadows are sorted according to their respective first time size; Based on the inherent dynamic shadow's state change over time, the target area in each key frame of the surveillance video of the target parking space is marked as a dynamic background, including: In the image frames arranged according to the first time, the inherent dynamic shadow is marked as a dynamic background.
6. The method according to claim 2, characterized in that, Calculate the difference region between each key image frame and a reference frame in the surveillance video to obtain at least one motion shadow region in the surveillance video that is in motion, including: The image of the target parking space is acquired when it is unaffected by scene factors and is used as the reference frame; The frame difference algorithm is used to calculate the difference image between each key image and the reference frame in sequence; When the difference between any key image and the reference frame is greater than a preset threshold, the difference image is determined as the motion shadow region.
7. The method according to claim 4, characterized in that, For each key frame of the surveillance video, the pixels in the image are classified, including: Gaussian distributions were set for shadows caused by changes in illumination, shadows caused by the swaying of interfering objects, and shadows caused by the movement of interfering objects, respectively, and Gaussian mixture models were established. Multiple pixels in each key frame image are input into the Gaussian mixture model, and the Gaussian mixture model is used to cluster the multiple pixels and match the pixels to the set Gaussian model. When a pixel matches any of the following Gaussian models: shadows caused by changes in lighting, shadows caused by the movement of objects, and shadows caused by the movement of objects, the pixel classification result is output, and the pixel is identified as a background pixel. When no Gaussian model is matched, the output pixel is the foreground pixel.
8. The method according to claim 7, characterized in that, Multiple pixels from each key frame image are input into the Gaussian mixture model. The Gaussian mixture model is used to cluster the multiple pixels, and the pixels are matched to the set Gaussian model, including: Calculate the mean and variance of different Gaussian models; Based on the degree of matching between each pixel value and the mean and variance, the pixel values are classified into the corresponding Gaussian distribution; The method further includes: Update the corresponding weights for each Gaussian model based on the actual pixels matched. Based on the weights corresponding to each Gaussian model, the probabilities of illumination changes, object swaying, and object movement as scene factors are adjusted.
9. The method according to claim 7, characterized in that, The method further includes: Update the foreground mask of the marked moving object based on the foreground pixels; If the foreground mask is an arbitrary motion shadow region, perform connected component analysis on the foreground mask to identify independent moving objects.
10. The method according to claim 3, characterized in that, Based on the inherent dynamic shadow's state change over time, before marking the target area in each key frame of the surveillance video of the target parking space as a dynamic background, the method further includes: The color difference is calculated by comparing the pixels in the motion shadow area with the background pixels in the key frame of the surveillance video. A texture analysis algorithm is used to compare the texture similarity between the motion shadow region and the background region in the keyframe of the monitoring video, and the similarity is calculated. Based on the aforementioned influence factor, determining whether the motion shadow region is the inherent dynamic shadow includes: When the color difference and the similarity are both within their respective reasonable ranges, and the influencing factor corresponding to any moving shadow region is the scene factor, the region of the inherent dynamic shadow is optimized according to the influencing factor.
11. The method according to claim 10, characterized in that, When the color difference or the similarity is not within its respective reasonable range, the motion shadow area is determined to be the foreground.
12. The method according to claim 7, characterized in that, The method further includes: Collect light intensity data of the scene corresponding to the target parking space; Calculate the trend of light intensity change over time; Compare the trend of the light intensity over time with the state change of the foreground pixels over time; If the trend of change is consistent with the state change of the foreground pixel over time, update the state change of the foreground pixel and the inherent dynamic shadow over time.
13. The method according to claim 9, characterized in that, Before performing connected component analysis on the foreground mask to identify individual moving objects, the method further includes: Perform opening and closing operations on the foreground mask to adjust the foreground mask; If the foreground mask is an arbitrary motion shadow region, perform connected component analysis on the foreground mask to identify independent moving objects, including: Perform connected component analysis on the adjusted foreground mask to identify independent moving objects.
14. The method according to any one of claims 1-13, characterized in that, Detecting parking space status in the tagged surveillance video includes: For each key image frame marked in the surveillance video, determine the average brightness of the dynamic background included therein, as well as the average brightness of other backgrounds besides the dynamic background. The average brightness of the dynamic background is compensated until it reaches the average brightness of the other backgrounds; The parking space status is detected in the surveillance video after brightness compensation.
15. A parking space status detection device, characterized in that, The device includes: The shadow acquisition module is used to obtain the state change of the inherent dynamic shadow corresponding to the target parking space over time; the inherent dynamic shadow is the shadow of the target parking space caused by scene factors and is unrelated to the parking of the vehicle; the scene factors include changes in lighting and movement of interfering objects; The shadow marking module is used to mark the target area in each key frame of the surveillance video of the target parking space as a dynamic background based on the state change of the inherent dynamic shadow over time; the target area is the pixel area corresponding to the inherent dynamic shadow in the current frame image. A status detection module is used to detect the parking space status in the surveillance video carrying tags.
16. An apparatus comprising: At least one processor; as well as At least one memory communicatively connected to the processor, characterized in that, The memory stores program instructions that can be executed by the processor, which can invoke the program instructions to perform the method as described in any one of claims 1 to 14.
17. A computer-readable storage medium storing computer instructions, characterized in that, The computer instructions cause the computer to perform the method as described in any one of claims 1 to 14.