Parking space violation detection method and system based on machine vision
By morphological analysis and shadow feature processing of historical parking image data, a violation prediction model is constructed, which solves the problem of unclear vehicle profile caused by obstacles in underground parking lots, and achieves efficient and accurate detection and management of parking space violations.
Patent Information
- Application Number
- CN202510551138.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-29
- Publication Date
- 2025-08-12
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art is difficult to avoid obstacles when detecting underground parking lots, resulting in unclear vehicle profiles, and it is difficult to capture vehicle profile features in complex parking lot layouts, affecting the effect of violation detection.
The parking space violation detection method based on machine vision is used to perform morphological analysis of historical parking image data, shadow feature data is extracted, statistical data is calculated, baseline range of normal parking behavior is established, violation prediction model is constructed, real-time shadow feature data is matched, and monitoring strategies are dynamically adjusted.
It realizes accurate capture of illegal vehicle profiles in complex parking lots, improves detection accuracy, reduces false alarm rates, dynamically adjusts patrol frequency, improves management efficiency and reduces costs, and adapts to changes in different environments and layouts.
Smart Images

Figure CN120472401A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of vehicle detection technology, and in particular to a parking violation detection method and system based on machine vision. Background Art
[0002] With the acceleration of urbanization, parking resources are becoming increasingly scarce, and parking space management has become a critical component in improving parking lot operational efficiency. Traditional parking space management methods, such as manual inspections or the use of fixed sensors, are inefficient, costly, and susceptible to environmental interference. In complex parking lots, the presence of three-dimensional obstacles such as columns and low barriers makes it difficult for traditional 3D detection technologies to accurately capture parking space status, leading to blind spots in monitoring.
[0003] Currently, the Chinese invention patent application number CN202310870570.5 discloses a parking detection method, device, computer equipment and storage medium. The method is implemented as follows: when a target vehicle enters a target parking space, video data of the target vehicle is collected; based on the video data, a vehicle detection frame of the target vehicle is obtained; based on the vehicle detection frame and the preset parking space frame information, it is determined whether the target vehicle is illegally parked; if so, an early warning message is output, and / or an illegal parking notification message is sent to the parking lot management personnel. In this application, a vehicle detection frame is obtained through video analysis technology to determine whether the vehicle is illegally parked. When illegal parking occurs, an early warning message is sent to the management and / or the owner of the vehicle so that the parking position of the vehicle can be adjusted in time to avoid occupying other parking spaces, causing waste of resources, and also to avoid affecting the entry and exit of adjacent vehicles.
[0004] The above technology is difficult to avoid directly collecting vehicle images being blocked by obstacles when detecting underground parking lots, resulting in unclear vehicle outlines. It is also difficult to capture vehicle outline features in complex parking lot layouts, affecting the violation detection effect. Summary of the Invention
[0005] The technical problem solved by the present invention is that the existing technology is difficult to avoid directly collecting vehicle images being blocked by obstacles when detecting underground parking lots, resulting in unclear vehicle outlines, and it is difficult to capture vehicle outline features in complex parking lot layouts, which affects the violation detection effect.
[0006] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0007] The parking violation detection method based on machine vision includes the following steps:
[0008] Step S1, performing morphological analysis on historical parking image data and outputting a first analysis result;
[0009] Step S2, collecting real-time parking images according to the first analysis result and extracting real-time shadow feature data;
[0010] Step S3, calculating statistical data of shadow features to establish a baseline range of normal parking behavior;
[0011] Step S4: construct a first violation prediction model, establish a mapping relationship between the prediction model and parking behavior, output a second violation prediction model, obtain real-time shadow feature data, match the corresponding second violation prediction model, and output a second analysis result;
[0012] Step S5: Select a monitoring strategy based on the second analysis result.
[0013] Preferably, step S1 includes the following sub-steps:
[0014] Step S101: Retrieving historical parking image data from an image database, wherein the historical parking image data includes vehicle shadow images under different lighting conditions and corresponding parking status labels;
[0015] Step S102 : performing morphological analysis on the vehicle shadow image and outputting a first analysis result.
[0016] Preferably, the morphological analysis calculates morphological characteristic parameters of the shadows in each historical image respectively, and the morphological characteristic parameters include:
[0017] a historical shadow area, wherein the shadow area is represented by the total number of pixels in the shadow region of the binary image;
[0018] The historical edge gradient is the average value of the edge gradient amplitude of the shadow edge calculated using the Sobel operator. The mathematical expression of the average value of the edge gradient amplitude is:
[0019]
[0020] Where G is the average value of edge gradient amplitude, i is the index variable, x is the column coordinate of edge pixel, y is the row coordinate of edge pixel, N is the total number of edge pixels, and I is the image grayscale value;
[0021] The historical geometric shape fitting degree is the similarity between the shadow outline fitted by the least squares method and the standard rectangle. The mathematical expression of the similarity is:
[0022]
[0023] Where F is the similarity, S1 is the non-overlapping area between the shaded area and the fitted rectangle, and S2 is the total shaded area;
[0024] Perform one-way ANOVA on the historical shadow area, historical edge gradient, and historical geometric shape fit to obtain the significance level value, which is output as the first analysis result.
[0025] Preferably, step S2 includes the following sub-steps:
[0026] Step S201: Analyze the first analysis result. If the significance level is greater than or equal to 0.05, it is determined that the illumination change has no significant effect on the shadow characteristics. Preset fixed thresholds and standard acquisition frequencies are used. The fixed thresholds include a shadow area threshold, an edge gradient threshold, and a shape fit threshold.
[0027] If the significance level is less than 0.05, it is determined that the illumination change has a significant impact on the shadow characteristics. The real-time image is collected and shadow feature data is extracted and output as real-time shadow feature data. The real-time shadow feature data includes real-time shadow area, real-time edge gradient, and real-time geometric shape fit.
[0028] Step S202: storing the real-time shadow feature data in a database according to the timestamp.
[0029] Preferably, step S3 includes the following sub-steps:
[0030] Step S301: If the significance level is less than 0.05, the statistics of the historical shadow features are calculated respectively, where the statistics of the historical shadow features include the mean value and the standard deviation of the feature parameters.
[0031] Step S302: Calculate the baseline range of normal parking behavior based on the mean and standard deviation. The mathematical expression of the baseline range of normal parking behavior is:
[0032] R = μ ± 3σ;
[0033] Where S is the baseline range of normal parking behavior, μ is the mean of the characteristic parameter, and σ is the standard deviation of the characteristic parameter.
[0034] Preferably, step S4 includes the following sub-steps:
[0035] Step S401: Based on the baseline range of normal parking behavior and historical shadow feature data, a local outlier factor algorithm is used to define the historical shadow feature vector and construct a first violation prediction model. Rules are established based on preset thresholds to divide the historical shadow feature data into several parking behavior labels. A mapping relationship is established between the parking behavior labels and the first violation prediction model, and the result is output as a second violation prediction model.
[0036] Step S402: Obtain a real-time shadow feature vector of the real-time shadow feature data, calculate the similarity between the real-time shadow feature vector and the second violation prediction model, select the second violation prediction model with the highest similarity as the current matching model, calculate and output the deviation time of the current matching model, and output it as the real-time deviation time;
[0037] Step S403: If the real-time deviation time is less than the preset deviation time threshold, it is marked as "normal"; if the real-time deviation time is greater than or equal to the preset deviation time threshold, it is marked as "violation risk", and "normal", "violation risk" and the corresponding parking labels are output as the second analysis result.
[0038] Preferably, the logic of the local outlier factor algorithm is:
[0039] Calculate the nearest neighbor distance of each data point, define the local density, and calculate the LOF value. If the LOF value is greater than the preset LOF threshold, it is judged as an anomaly.
[0040] Preferably, step S5 includes the following sub-steps:
[0041] Step S501: Select a monitoring strategy based on the second analysis result. The monitoring strategy is:
[0042] If marked as "Normal", the default inspection frequency is maintained;
[0043] If it is marked as "violation risk", dynamic frequency adjustment is performed and output as updated inspection frequency;
[0044] Step S502: Send the default inspection frequency and the updated inspection frequency to the camera control module.
[0045] Preferably, the logic of the dynamic frequency adjustment is:
[0046] Define the mapping relationship between the deviation time and the monitoring frequency, output the time-frequency mapping table, input the real-time deviation time into the time-frequency mapping table, and obtain the monitoring frequency.
[0047] A parking violation detection system based on machine vision, which is applied to the aforementioned parking violation detection method based on machine vision, includes a historical image analysis module, a real-time feature extraction module, a baseline range establishment module, a prediction model matching module, and a monitoring strategy selection module;
[0048] The historical image analysis module is used to perform morphological analysis on the historical parking image data and output a first analysis result;
[0049] The real-time feature extraction module is used to collect real-time parking images according to the first analysis result and extract real-time shadow feature data;
[0050] The baseline range establishment module is used to calculate statistical data of shadow features and establish a baseline range of normal parking behavior;
[0051] The prediction model matching module is used to construct a first violation prediction model, establish a mapping relationship between the prediction model and the parking behavior, output a second violation prediction model, obtain real-time shadow feature data, match the corresponding second violation prediction model, and output a second analysis result;
[0052] The monitoring strategy selection module is used to select a monitoring strategy according to the second analysis result.
[0053] The beneficial effects of the present invention are as follows: the present invention utilizes the two-dimensional characteristics of shadows to accurately capture the outlines of illegal vehicles in complex parking lots, improves detection accuracy and reduces false alarm rates, realizes real-time detection and monitoring, dynamically adjusts inspection frequency, improves management efficiency and reduces costs. At the same time, through the analysis of historical data, the detection parameters are adaptively adjusted to adapt to different environments and layout changes, thereby enhancing stability and adaptability. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 A flowchart of a method for detecting parking violations based on machine vision according to an embodiment of the present invention;
[0055] Figure 2 A schematic diagram of the basic flow of a parking violation detection system based on machine vision provided by one embodiment of the present invention. DETAILED DESCRIPTION
[0056] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings. It is obvious that the described embodiments are only part of the embodiments of the present invention, but not all of the embodiments.
[0057] Example 1, with reference to Figure 1 , provides a parking violation detection method based on machine vision, including the following steps:
[0058] Step S1: Perform morphological analysis on historical parking image data and output a first analysis result.
[0059] Step S2: collecting real-time parking images according to the first analysis result and extracting real-time shadow feature data.
[0060] Step S3: Calculate statistical data of shadow features to establish a baseline range of normal parking behavior.
[0061] Step S4: construct a first violation prediction model, establish a mapping relationship between the prediction model and parking behavior, output a second violation prediction model, obtain real-time shadow feature data, match the corresponding second violation prediction model, and output a second analysis result.
[0062] Step S5: Select a monitoring strategy based on the second analysis result.
[0063] Step S1 includes the following sub-steps:
[0064] Step S101 : Retrieving historical parking image data from an image database. The historical parking image data includes vehicle shadow images under different lighting conditions and corresponding parking status labels.
[0065] Step S101 retrieves a rich set of historical parking image data from the image database. This data includes vehicle shadow images under different lighting conditions and their corresponding parking status labels. This step provides sufficient and diverse samples for subsequent morphological analysis, helping to improve the accuracy and generalization of the analysis results.
[0066] Step S102 : performing morphological analysis on the vehicle shadow image and outputting a first analysis result.
[0067] Morphological analysis calculates the morphological characteristic parameters of the shadows in each historical image. The morphological characteristic parameters include:
[0068] Historical shadow area,The shadow area is represented by the total number of pixels in the shadow area in the,binarized image.
[0069] The historical edge gradient is the average value of the edge gradient amplitude of the shadow edge calculated using the Sobel operator. The mathematical expression of the average value of the edge gradient amplitude is:
[0070]
[0071] Among them, G is the average edge gradient amplitude, i is the index variable, x is the edge pixel column coordinate, y is the edge pixel row coordinate, N is the total number of edge pixels, and I is the image grayscale value.
[0072] Historical geometric shape fitting degree, the geometric shape fitting degree is the similarity between the shadow outline fitted by the least squares method and the standard rectangle. The mathematical expression of the similarity is:
[0073]
[0074] Where F is the similarity, S1 is the non-overlapping area between the shaded area and the fitted rectangle, and S2 is the total shaded area.
[0075] Perform one-way ANOVA on the historical shadow area, historical edge gradient, and historical geometric shape fit to obtain the significance level value, which is output as the first analysis result.
[0076] Step S102 performs a morphological analysis on the vehicle shadow images, calculating and outputting the morphological characteristic parameters of the shadows in each historical image, including historical shadow area, historical edge gradient, and historical geometric shape fit. These parameters are crucial for understanding shadow characteristics and building violation detection models. Furthermore, a one-way analysis of variance (ANOVA) was performed on these parameters to obtain significance levels. This result helps determine the impact of illumination changes on shadow characteristics and provides a basis for subsequent strategy selection.
[0077] Step S1 uses morphological analysis to extract key morphological feature parameters from historical parking image data. This analysis then performs a significance level analysis based on these parameters, providing a foundation for subsequent violation detection. This process helps us understand how shadow features vary under different lighting conditions and provides data support for subsequent model construction.
[0078] Step S2 includes the following sub-steps:
[0079] Step S201: parse the first analysis result. If the significance level is greater than or equal to 0.05, it is determined that the illumination change has no significant effect on the shadow feature. A preset fixed threshold and standard acquisition frequency are used. The fixed thresholds include a shadow area threshold, an edge gradient threshold, and a shape fit threshold.
[0080] If the significance level value is less than 0.05, it is determined that the illumination change has a significant impact on the shadow characteristics. Real-time images are collected and shadow feature data is extracted. The output is real-time shadow feature data, which includes real-time shadow area, real-time edge gradient and real-time geometric shape fitting.
[0081] Step S201 intelligently determines the impact of illumination changes on shadow features by analyzing the significance level value in the first analysis result. If the significance level value is greater than or equal to 0.05, the illumination change is deemed to have no significant impact on the shadow features. In this case, a preset fixed threshold and standard acquisition frequency are used, which helps reduce unnecessary real-time data processing and improve system efficiency. If the significance level value is less than 0.05, the illumination change is deemed to have a significant impact on the shadow features. In this case, real-time image acquisition and shadow feature data extraction are required to ensure accurate violation detection.
[0082] Step S202: storing the real-time shadow feature data in a database according to the timestamp.
[0083] Step S202 stores the real-time shadow feature data in a database with a timestamp. This step is crucial for subsequent data analysis and model updates. Recording timestamps allows tracking data trends, providing data support for understanding how shadow features change over time and under different lighting conditions. Furthermore, rich historical data also helps improve the accuracy and generalization capabilities of the violation detection model.
[0084] Step S2 intelligently determines the impact of illumination changes on shadow features based on the significance level in the first analysis results and adopts appropriate strategies accordingly. If the illumination change has no significant impact, a preset fixed threshold and standard collection frequency are used. If the illumination change has a significant impact, shadow feature data is collected and extracted in real time for subsequent violation detection. Simultaneously, this real-time shadow feature data is stored in a database with a timestamp to provide data support for subsequent analysis and model updates.
[0085] Step S3 includes the following sub-steps:
[0086] Step S301: If the significance level is less than 0.05, the statistics of the historical shadow features are calculated respectively. The statistics of the historical shadow features include the mean value and the standard deviation of the feature parameters.
[0087] Step S301 calculates the mean and standard deviation of historical shadow features, providing a data foundation for determining the baseline range of normal parking behavior. The mean reflects the central tendency of historical shadow features, while the standard deviation measures the dispersion of the data. Calculating these two statistics helps understand the distribution of shadow features in normal parking behavior, providing key information for subsequent steps.
[0088] Step S302: Calculate the baseline range of normal parking behavior based on the mean and standard deviation. The mathematical expression of the baseline range of normal parking behavior is:
[0089] R = μ ± 3σ;
[0090] Where S is the baseline range of normal parking behavior, μ is the mean of the characteristic parameter, and σ is the standard deviation of the characteristic parameter.
[0091] Step S302 further determines the baseline range for normal parking behavior based on the mean and standard deviation calculated in substep S301. This baseline range represents the expected range of shadow feature variation under normal parking behavior and provides a clear boundary for determining whether real-time shadow features deviate from normal behavior. By comparing real-time shadow features with the baseline range, potential illegal parking behaviors can be promptly detected.
[0092] If the significance level indicates that illumination changes significantly affect shadow features, step S3 further determines the baseline range of normal parking behavior by calculating historical shadow feature statistics. This step provides a key basis for building a violation prediction model and determining whether real-time shadow features deviate from normal behavior, helping to improve the accuracy and reliability of parking violation detection.
[0093] Step S4 includes the following sub-steps:
[0094] Step S401: Based on the baseline range of normal parking behavior and historical shadow feature data, a local outlier factor algorithm is used to define the historical shadow feature vector and construct a first violation prediction model. According to a preset threshold, rules are formulated to divide the historical shadow feature data into several parking behavior labels, and a mapping relationship between the parking behavior labels and the first violation prediction model is established, which is output as a second violation prediction model.
[0095] In step S401, based on the baseline range of normal parking behavior and historical shadow feature data, a local outlier factor algorithm is used to construct a first violation prediction model and convert it into a second violation prediction model. This step establishes a mapping relationship between parking behavior labels and the model by mining patterns in historical data, providing a basis for subsequent determination of whether real-time parking behavior violates regulations. Furthermore, the application of the local outlier factor algorithm enables the model to accurately identify abnormal parking behavior, improving detection accuracy.
[0096] Step S402: Obtain a real-time shadow feature vector of the real-time shadow feature data, calculate the similarity between the real-time shadow feature vector and the second violation prediction model, select the second violation prediction model with the highest similarity as the current matching model, calculate and output the deviation time of the current matching model, and output it as the real-time deviation time.
[0097] Step S402 obtains real-time shadow feature data, calculates its similarity with the second violation prediction model, selects the model with the highest similarity as the current matching model, and calculates and outputs the real-time deviation time. This step enables rapid judgment of real-time parking behavior. By comparing the similarity between the real-time shadow feature vector and the model, it can accurately determine whether the vehicle deviates from normal parking behavior. Furthermore, the calculation of the real-time deviation time provides a quantitative basis for determining whether a vehicle has violated the law.
[0098] Step S403: If the real-time deviation time is less than the preset deviation time threshold, it is marked as "normal"; if the real-time deviation time is greater than or equal to the preset deviation time threshold, it is marked as "violation risk", and "normal", "violation risk" and the corresponding parking labels are output as the second analysis result.
[0099] The logic of the local outlier factor algorithm is:
[0100] Calculate the nearest neighbor distance of each data point, define the local density, and calculate the LOF value. If the LOF value is greater than the preset LOF threshold, it is judged as an anomaly.
[0101] Step S403 compares the real-time deviation time with a preset deviation time threshold, labels the parking behavior as "normal" or "risk of violation," and outputs the second analysis result. This step is crucial for determining whether a vehicle has violated a parking violation. By setting a reasonable deviation time threshold, potential violators can be accurately identified, providing timely and effective information support for parking space management. The analysis results are also output as labels for subsequent processing and recording.
[0102] Step S4 uses a local outlier factor algorithm to construct a violation prediction model and determines whether a vehicle's parking behavior violates a parking violation based on real-time shadow feature data. By defining historical shadow feature vectors and constructing a first violation prediction model, which is then converted into a second violation prediction model, accurate prediction of vehicle parking behavior is achieved. Furthermore, by calculating the similarity between the real-time shadow feature vector and the model, as well as the real-time deviation time, it is possible to accurately determine whether a vehicle deviates from normal parking behavior, thereby promptly flagging violation risks and providing strong support for parking space management.
[0103] Step S5 includes the following sub-steps:
[0104] Step S501: Select a monitoring strategy based on the second analysis result. The monitoring strategy is:
[0105] If marked as "Normal", the default inspection frequency is maintained.
[0106] If it is marked as "violation risk", dynamic frequency adjustment is performed and output as updated inspection frequency.
[0107] The logic of dynamic frequency adjustment is:
[0108] Define the mapping relationship between the deviation time and the monitoring frequency, output the time-frequency mapping table, input the real-time deviation time into the time-frequency mapping table, and obtain the monitoring frequency.
[0109] Step S501 intelligently selects a monitoring strategy based on the flags in the second analysis result. If the flag is "normal," the default inspection frequency is maintained, which helps reduce unnecessary monitoring resource consumption and improve system efficiency. If the flag is "violation risk," a dynamic frequency adjustment is performed. Based on the real-time deviation time input into the time-frequency mapping table, an updated inspection frequency is obtained and output. This strategy ensures that when potential violations are detected, the camera monitors more frequently, thereby improving the accuracy and timeliness of violation detection.
[0110] Step S502: Send the default inspection frequency and the updated inspection frequency to the camera control module.
[0111] Step S502 sends the default and updated inspection frequencies to the camera control module, enabling real-time adjustment of the camera's monitoring frequency. This step ensures effective execution of the monitoring strategy, enabling the camera to adjust its monitoring frequency based on actual needs, improving the efficiency and accuracy of parking space management. Furthermore, real-time adjustment of the monitoring frequency optimizes camera resource utilization and avoids unnecessary waste.
[0112] The primary effect of step S5 is to intelligently adjust the camera's inspection frequency based on the second analysis results, effectively monitoring potential parking violations. By identifying the flags in the second analysis results and selecting the appropriate monitoring strategy, this ensures efficient monitoring of normal parking behavior while also increasing the monitoring frequency when potential violations are detected, ensuring timely and accurate parking space management.
[0113] This method leverages the two-dimensional extension of shadows to effectively circumvent three-dimensional obstacles, such as pillars and low barriers, even in complex parking lot layouts, accurately capturing the outline features of offending vehicles. Compared to traditional three-dimensional detection technologies, this method offers higher detection accuracy and robustness. By performing morphological analysis on historical parking image data, it establishes a baseline range for normal parking behavior and utilizes a local outlier factor algorithm to construct a violation prediction model. This data-driven approach adaptively adjusts the detection threshold, effectively reducing false alarm rates due to environmental changes or individual differences.
[0114] This method enables real-time detection and monitoring, dynamically adjusting inspection frequency based on detection results. For parking spaces marked as "risk of violation," high-frequency inspections can be immediately performed, allowing for timely identification and action, significantly improving parking management efficiency. Compared to traditional manual inspections or fixed sensor methods, this machine vision-based parking violation detection method reduces labor and maintenance costs. Furthermore, this method leverages existing camera resources, eliminating the need for additional sensors, further reducing deployment costs.
[0115] By analyzing historical data, this method can adaptively adjust detection parameters and models to accommodate varying lighting conditions and parking lot layouts. This adaptability enables the method to maintain stable detection performance across diverse environments.
[0116] Example 2, reference Figure 2 , provides a parking violation detection system based on machine vision, including a historical image analysis module, a real-time feature extraction module, a baseline range establishment module, a prediction model matching module and a monitoring strategy selection module.
[0117] The historical image analysis module is used to perform morphological analysis on historical parking image data and output a first analysis result.
[0118] The real-time feature extraction module is used to collect real-time parking images according to the first analysis result and extract real-time shadow feature data.
[0119] The baseline range establishment module is used to calculate the statistical data of shadow features and establish the baseline range of normal parking behavior.
[0120] The prediction model matching module is used to construct a first violation prediction model, establish a mapping relationship between the prediction model and parking behavior, output a second violation prediction model, obtain real-time shadow feature data, match the corresponding second violation prediction model, and output a second analysis result.
[0121] The monitoring strategy selection module is used to select a monitoring strategy according to the second analysis result.
[0122] Through the historical image analysis module and the real-time feature extraction module, this system can efficiently and accurately capture the vehicle shadow features and realize real-time monitoring and analysis of parking behavior. The baseline range establishment module uses statistical methods to calculate the mean and standard deviation of the shadow features, setting a clear baseline range for normal parking behavior, and providing a reliable basis for subsequent violation prediction. The prediction model matching module not only constructs the first violation prediction model, but also establishes the second violation prediction model through mapping relationships, thereby improving the accuracy and prediction ability of violation detection. The monitoring strategy selection module can intelligently adjust the monitoring strategy according to the second analysis results, such as maintaining the default inspection frequency or performing dynamic frequency adjustment, thereby achieving rapid response and effective management of parking violations. By intelligently judging vehicle parking behavior, unnecessary monitoring resource consumption is reduced, resource utilization efficiency is improved, and the cost of parking space management is also reduced.
[0123] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a fully hardware embodiment, a fully software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program code. The storage medium may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0124] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A parking violation detection method based on machine vision, characterized in that: The steps include: Step S1, performing morphological analysis on historical parking image data and outputting a first analysis result; Step S2, collecting real-time parking images according to the first analysis result and extracting real-time shadow feature data; Step S3, calculating statistical data of shadow features to establish a baseline range of normal parking behavior; Step S4: construct a first violation prediction model, establish a mapping relationship between the prediction model and parking behavior, output a second violation prediction model, obtain real-time shadow feature data, match the corresponding second violation prediction model, and output a second analysis result; Step S5: Select a monitoring strategy based on the second analysis result.
2. The parking violation detection method based on machine vision according to claim 1, characterized in that: The step S1 includes the following sub-steps: Step S101: Retrieving historical parking image data from an image database, wherein the historical parking image data includes vehicle shadow images under different lighting conditions and corresponding parking status labels; Step S102 : performing morphological analysis on the vehicle shadow image and outputting a first analysis result.
3. The parking violation detection method based on machine vision according to claim 2, characterized in that: The morphological analysis calculates the morphological characteristic parameters of the shadows in each historical image respectively, and the morphological characteristic parameters include: a historical shadow area, wherein the shadow area is represented by the total number of pixels in the shadow region of the binary image; The historical edge gradient is the average value of the edge gradient amplitude of the shadow edge calculated using the Sobel operator. The mathematical expression of the average value of the edge gradient amplitude is: Where G is the average value of edge gradient amplitude, i is the index variable, x is the column coordinate of edge pixel, y is the row coordinate of edge pixel, N is the total number of edge pixels, and I is the image grayscale value; The historical geometric shape fitting degree is the similarity between the shadow outline fitted by the least squares method and the standard rectangle. The mathematical expression of the similarity is: Where F is the similarity, S1 is the non-overlapping area between the shaded area and the fitted rectangle, and S2 is the total shaded area; Perform one-way ANOVA on the historical shadow area, historical edge gradient, and historical geometric shape fit to obtain the significance level value, which is output as the first analysis result.
4. The parking violation detection method based on machine vision according to claim 3, characterized in that: The step S2 includes the following sub-steps: Step S201: Analyze the first analysis result. If the significance level is greater than or equal to 0.05, it is determined that the illumination change has no significant effect on the shadow characteristics. Preset fixed thresholds and standard acquisition frequencies are used. The fixed thresholds include a shadow area threshold, an edge gradient threshold, and a shape fit threshold. If the significance level is less than 0.05, it is determined that the illumination change has a significant impact on the shadow characteristics. The real-time image is collected and shadow feature data is extracted and output as real-time shadow feature data. The real-time shadow feature data includes real-time shadow area, real-time edge gradient, and real-time geometric shape fit. Step S202: storing the real-time shadow feature data in a database according to the timestamp.
5. The parking violation detection method based on machine vision according to claim 4, characterized in that: The step S3 includes the following sub-steps: Step S301: If the significance level is less than 0.05, the statistics of the historical shadow features are calculated respectively, where the statistics of the historical shadow features include the mean value and the standard deviation of the feature parameters. Step S302: Calculate the baseline range of normal parking behavior based on the mean and standard deviation. The mathematical expression of the baseline range of normal parking behavior is: R = μ ± 3σ; Where R is the baseline range of normal parking behavior, μ is the mean of the characteristic parameter, and σ is the standard deviation of the characteristic parameter.
6. The parking violation detection method based on machine vision according to claim 5, characterized in that: The step S4 includes the following sub-steps: Step S401: Based on the baseline range of normal parking behavior and historical shadow feature data, a local outlier factor algorithm is used to define the historical shadow feature vector and construct a first violation prediction model. Rules are established based on preset thresholds to divide the historical shadow feature data into several parking behavior labels. A mapping relationship is established between the parking behavior labels and the first violation prediction model, and the result is output as a second violation prediction model. Step S402: Obtain a real-time shadow feature vector of the real-time shadow feature data, calculate the similarity between the real-time shadow feature vector and the second violation prediction model, select the second violation prediction model with the highest similarity as the current matching model, calculate and output the deviation time of the current matching model, and output it as the real-time deviation time; In step S403, if the real-time deviation time is less than the preset deviation time threshold, it is marked as "normal"; if the real-time deviation time is greater than or equal to the preset deviation time threshold, it is marked as "violation risk", and "normal", "violation risk" and the corresponding parking labels are output as the second analysis result.
7. The parking violation detection method based on machine vision according to claim 6, characterized in that: The logic of the local outlier factor algorithm is: Calculate the nearest neighbor distance of each data point, define the local density, and calculate the LOF value. If the LOF value is greater than the preset LOF threshold, it is judged as an anomaly.
8. The parking violation detection method based on machine vision according to claim 7, characterized in that: The step S5 includes the following sub-steps: Step S501: Select a monitoring strategy based on the second analysis result. The monitoring strategy is: If marked as "Normal", the default inspection frequency will be maintained; If it is marked as "violation risk", dynamic frequency adjustment is performed and output as updated inspection frequency; Step S502: Send the default inspection frequency and the updated inspection frequency to the camera control module.
9. The parking violation detection method based on machine vision according to claim 8, characterized in that: The logic of the dynamic frequency adjustment is: Define the mapping relationship between the deviation time and the monitoring frequency, output the time-frequency mapping table, input the real-time deviation time into the time-frequency mapping table, and obtain the monitoring frequency.
10. A parking violation detection system based on machine vision, which is applied to the parking violation detection method based on machine vision according to any one of claims 1 to 9, characterized in that: It includes historical image analysis module, real-time feature extraction module, baseline range establishment module, prediction model matching module and monitoring strategy selection module; The historical image analysis module is used to perform morphological analysis on the historical parking image data and output a first analysis result; The real-time feature extraction module is used to collect real-time parking images according to the first analysis result and extract real-time shadow feature data; The baseline range establishment module is used to calculate statistical data of shadow features and establish a baseline range of normal parking behavior; The prediction model matching module is used to construct a first violation prediction model, establish a mapping relationship between the prediction model and the parking behavior, output a second violation prediction model, obtain real-time shadow feature data, match the corresponding second violation prediction model, and output a second analysis result; The monitoring strategy selection module is used to select a monitoring strategy according to the second analysis result.
Citation Information
Patent Citations
Parking detection method and device, computer equipment and storage medium
CN116884229A