Disclosure of Invention
In order to solve the problem that the existing sensor causes false detection due to electrical characteristics or product quality, the invention provides a vehicle detection method, device and medium based on a sliding pane, which can greatly improve the anti-interference performance of the sensor on vehicle detection on the basis of not increasing a circuit structure.
The invention is realized by the following technical scheme:
the first aspect of the present invention provides a vehicle detection method based on a sliding pane, comprising the steps of:
acquiring vehicle detection data of a sensor, wherein the vehicle detection data comprises N continuous detection data which are acquired at the corresponding moment of the vehicle detection data and within a period of time before the moment, N is a natural number which is more than or equal to 3, and the detection data represent that vehicles exist in the detection range of the sensor or no vehicles exist in the detection range of the sensor;
calculating the number N1 of the latest detection data in the vehicle detection data and the continuous number N2 of the detection data in the vehicle detection data, wherein the latest detection data is the detection data with the nearest sensor output time and the moment corresponding to the acquired vehicle detection data, and N1 and N2 are natural numbers larger than 0;
and when the number N1 is larger than or equal to a first preset threshold value and the number N2 is larger than or equal to a second preset threshold value, judging that the vehicle detection result is a detection data representation result with the latest detection time in the vehicle detection data, wherein the first preset threshold value and the second preset threshold value are larger than or equal to 2.
According to the scheme, the number of the latest detection data in the vehicle detection data is counted, namely the data duty ratio is calculated, and the judgment of the vehicle detection is realized by combining the continuity of the detection data, so that even if the individual false detection occurs due to the electrical characteristics of the sensor or the quality of products, the whole judgment error is not caused by the false output of the small probability of the sensor, and the anti-interference performance of the vehicle detection is improved.
In one possible design, N is 4 or more and 10 or less.
The scheme realizes the judgment of whether the vehicle exists or not based on the vehicle detection data formed by a plurality of detection data, and the more the data quantity is, the accuracy of the result judgment can be influenced. The accuracy of the result determination can be effectively improved by limiting the detection data in the vehicle detection data to the above-described range.
In one possible design, the first preset threshold is greater than or equal to 0.5×n.
In one possible design, the second preset threshold is greater than or equal to 0.5×n.
In one possible design, the method further comprises:
and responding to the condition that the order payment condition of the corresponding parking space of the sensor is paid or the state of the corresponding parking space lock is in a descending state, and shortening the detection data acquisition period of the sensor.
According to the scheme, the number N1 of the latest detection data in the vehicle detection data and the continuity of the detection data are calculated, so that whether the vehicle exists or not is judged, the sensitivity of the sensor is reduced substantially by the whole method, and the detection data has certain hysteresis. After the vehicle in the parking space pays to leave, under the condition that the detection period of the sensor is longer, misjudgment is easily caused, for example, when the vehicle leaves and enters another vehicle, the method can judge that the vehicle is always in the parking space, and misjudgment is easily caused on the order condition of the parking space. According to the scheme, the parking space order payment condition and the vehicle lock state are combined, the detection period of the sensor is shortened under the condition that the order is paid, the data acquisition frequency of the sensor is improved, and misjudgment of the parking space vehicle condition under the condition is avoided.
In one possible design, the method further comprises:
and generating at least two detection data when the sensor detects each time in response to the fact that the order payment condition of the corresponding parking space of the sensor is paid or the state of the corresponding parking space lock is a descending state.
A second aspect of the present invention provides a sliding pane-based vehicle detection apparatus comprising a data acquisition unit, a calculation unit and a determination unit connected in order by signals,
the data acquisition unit is used for acquiring vehicle detection data of a sensor, the vehicle detection data comprise N continuous detection data which are acquired at the corresponding moment of the vehicle detection data and in a period of time before the moment, N is a natural number which is more than or equal to 3, and the detection data represent that vehicles exist in the detection range of the sensor or no vehicles exist in the detection range of the sensor;
the calculating unit is used for calculating the number N1 of the detection data with the latest detection time in the vehicle detection data and the continuous number N2 of the detection data in the vehicle detection data, wherein the N1 and the N2 are natural numbers larger than 0;
the judging unit is used for judging that the vehicle detection result is the characterization result of the detection data with the latest detection time in the vehicle detection data in response to the number N1 being greater than or equal to a first preset threshold value and the number N2 being greater than or equal to a second preset threshold value, and the first preset threshold value and the second preset threshold value are greater than or equal to 2.
A third aspect of the present invention provides a sliding pane based vehicle detection apparatus comprising a memory and a controller in communication with each other in sequence, the memory having a computer program stored thereon, the controller being configured to read the computer program and perform a sliding pane based vehicle detection method as described in the first aspect and any one of the possibilities thereof.
A fourth aspect of the invention provides a computer readable storage medium having instructions stored thereon which, when executed on a computer, perform a sliding pane based vehicle detection method as described in the first aspect and any one of its possibilities.
Compared with the prior art, the invention has at least the following advantages and beneficial effects:
according to the invention, the number of the latest detection data in the vehicle detection data is counted, namely the data duty ratio is calculated, and the continuity of the detection data is combined to realize the judgment of vehicle detection, so that even if the individual false detection occurs due to the electrical characteristics of the sensor or the quality of products, the whole judgment error caused by the false output of the small probability of the sensor is avoided, and the anti-interference performance of vehicle detection is improved.
Detailed Description
The invention will be further elucidated with reference to the drawings and to specific embodiments. The present invention is not limited to these examples, although they are described in order to assist understanding of the present invention. Specific structural and functional details disclosed herein are merely representative of example embodiments of the invention. This invention may, however, be embodied in many alternate forms and should not be construed as limited to the embodiments set forth herein.
It should be understood that for the term "and/or" that may appear herein, it is merely one association relationship that describes an associated object, meaning that there may be three relationships, e.g., a and/or B, may represent: a alone, B alone, and both a and B; for the term "/and" that may appear herein, which is descriptive of another associative object relationship, it means that there may be two relationships, e.g., a/and B, it may be expressed that: a alone, a alone and B alone; in addition, for the character "/" that may appear herein, it is generally indicated that the context associated object is an "or" relationship.
It should be understood that specific details are provided in the following description to provide a thorough understanding of the example embodiments. However, it will be understood by those of ordinary skill in the art that the example embodiments may be practiced without these specific details. For example, a system may be shown in block diagrams in order to avoid obscuring the examples with unnecessary detail. In other instances, well-known processes, structures, and techniques may not be shown in unnecessary detail in order to avoid obscuring the examples.
As shown in fig. 1, the first aspect of the present invention discloses a vehicle detection method based on a sliding pane, which may be performed by, but not limited to, a vehicle detection device, which may be software, or a combination of software and hardware, and the vehicle detection device may be integrated into an intelligent device such as an intelligent mobile terminal, a tablet, a computer, or the like. Specifically, the method can be applied to the detection of the ground lock vehicle and the detection of other vehicles, such as the detection of human bodies, cargoes and the like. Specifically, the vehicle detection method includes the following steps S01 to S03.
Step S01, acquiring vehicle detection data of a sensor, wherein the vehicle detection data further comprises N continuous detection data which are acquired at the moment corresponding to the vehicle detection data and in a period of time before the moment, N is a natural number which is more than or equal to 3, and the detection data represent that vehicles exist in the detection range of the sensor or no vehicles exist in the detection range of the sensor.
The vehicle detection data of the sensor is stored in a memory, specifically in a buffer, and can be directly acquired and invoked when needed. The sensor may be an ultrasonic radar sensor, a laser sensor, a photoelectric sensor, an infrared sensor, or the like. When the sensor detects each time, the detection result is stored in the memory, and the vehicle detection process can be triggered once, and at the moment, the memory stores detection data output by N continuous sensors.
In this step, N may be a value of 3, 4, 5, 6, 7, 8, 9 or more. Preferably, N is 4 or more and 10 or less. N is controlled between 4 and 10, so that the detection period of the whole method can be reduced, the data storage quantity of the buffer memory is reduced, and the accuracy of vehicle detection is improved.
In this step, two forms including 1 and 0 are exemplified as the detection data. And if 1 represents that the vehicle exists in the detection range of the sensor, 0 represents that the vehicle does not exist in the detection range of the sensor.
Step S02, calculating the number N1 of the latest detection data in the vehicle detection data and the continuous number N2 of the detection data in the vehicle detection data, wherein the latest detection data is the detection data with the closest sensor output time and the moment corresponding to the acquired vehicle detection data, and N1 and N2 are natural numbers larger than 0.
And S03, judging that the vehicle detection result is a detection data representation result with the latest detection time in the vehicle detection data in response to the number N1 being greater than or equal to a first preset threshold value and the number N2 being greater than or equal to a second preset threshold value, wherein the first preset threshold value and the second preset threshold value are greater than or equal to 2.
Specifically, the following is illustrative: taking the example of buffering 8 detection data for illustration.
The real-time data stored in the buffer is 11111111, and it can be determined that the vehicle is actually present within the detection range of the sensor according to steps S01 to S03. At the first detection time point, the sensor output is 0, the data stored in the buffer memory is 11111110, the latest detection data is 0, the 0 output by the sensor may be true vehicle-free or false data generated by the sensor due to electrical characteristics, product quality and the like, and at the moment, since only 1 sensor is provided, the vehicle detection result is still judged to be that the vehicle exists in the parking space and the vehicle exists in the detection range of the sensor according to the steps S01 to S03.
At the second detection time point, the sensor still outputs 0, the data stored in the buffer memory is 11111100, and if the first preset threshold value is greater than 2, the vehicle detection result is still determined that the vehicle exists in the parking space.
At the third detection time point, the sensor output is 0, the data stored in the buffer memory is 11111000, and if the first preset threshold value is 3 and the second preset threshold value is 3, the vehicle detection result is determined that no vehicle exists in the parking space.
Preferably, the first preset threshold in this step is greater than or equal to 0.5×n, and the second preset threshold is greater than or equal to 0.5×n. The first preset threshold value is 5, the second preset threshold value is 5, namely, the sensor still outputs 0 at the later 4 th to 5 th detection time points, and the data stored in the buffer memory is 11100000 at the moment, so that the vehicle detection result is judged that no vehicle exists in the parking space.
By adopting the method, the reasons such as the electrical characteristics of the sensor, the product quality and the like can be avoided, and the error judgment caused by individual error detection can be avoided. For example, when the parking space is empty, the sensor outputs detection data of an existing vehicle, and the method can be used for accurately judging that the parking space is empty; or when the parking space is available, the sensor outputs detection data of no car, and the accurate judgment of the available parking space can be realized by adopting the method. The method has a certain influence on the sensitivity in the state of parking space from the vehicle to no vehicle or the state of parking space from the vehicle to the vehicle, the sensitivity is related to the detection period of the sensor data, and in order to avoid misjudgment of a parking space order under the condition that the detection period of the sensor is longer after the parking space vehicles pay to leave, for example, at the moment, the vehicles leave and drive into another vehicle, the method can judge that the vehicles are always in the parking space, and misjudgment is very easy to be caused on the order condition of the parking space. The method further comprises: and responding to the condition that the order payment condition of the corresponding parking space of the sensor is paid or the state of the corresponding parking space lock is in a descending state, and shortening the detection data acquisition period of the sensor.
That is, at any time of execution of the steps S01 to S03, if it is obtained that the order payment condition of the corresponding parking space of the sensor is paid or the corresponding parking space lock state is a lowered state, the detection data acquisition period of the sensor is shortened. For example, in order to save energy consumption in a normal state, a detection period of the sensor, that is, a data acquisition period is set to 10S, and if it is obtained that an order payment condition of a corresponding parking space of the sensor is paid or a state of a corresponding parking space lock is in a lowered state, the data acquisition period is set to 5S or less.
Or generating at least two detection data when the sensor detects each time in response to the fact that the order payment condition of the corresponding parking space of the sensor is paid or the state of the corresponding parking space lock is a descending state.
That is, at any time of execution of the steps S01 to S03, if the order payment condition of the corresponding parking space of the sensor is paid or the state of the corresponding parking space lock is in a descending state, at least two detection data are generated when the sensor detects each time, that is, the update speed of the vehicle detection data is increased.
The second aspect of the present invention discloses a sliding pane-based vehicle detection apparatus, as shown in fig. 2, comprising a data acquisition unit, a calculation unit and a determination unit connected in sequence by signals,
the data acquisition unit is used for acquiring vehicle detection data of a sensor, the vehicle detection data also comprises N continuous detection data which are acquired at the corresponding moment of the vehicle detection data and in a period of time before the moment, N is a natural number which is more than or equal to 3, and the detection data represent that vehicles exist in the detection range of the sensor or no vehicles exist in the detection range of the sensor;
the calculating unit is used for calculating the number N1 of the latest detection data in the vehicle detection data and the continuous number N2 of the detection data in the vehicle detection data, wherein the latest detection data is the detection data with the closest sensor output time and the moment corresponding to the acquired vehicle detection data, and the N1 and the N2 are natural numbers larger than 0;
the judging unit is used for judging that the vehicle detection result is the characterization result of the detection data with the latest detection time in the vehicle detection data in response to the number N1 being greater than or equal to a first preset threshold value and the number N2 being greater than or equal to a second preset threshold value, and the first preset threshold value and the second preset threshold value are greater than or equal to 2.
The third aspect of the invention discloses a vehicle detection device based on a sliding pane, which comprises a memory and a controller which are sequentially in communication connection, wherein the memory is stored with a computer program, and the controller is used for reading the computer program and executing the vehicle detection method based on the sliding pane in the first aspect and any possibility thereof. By way of specific example, the Memory may include, but is not limited to, random-Access Memory (RAM), read-Only Memory (ROM), flash Memory (Flash Memory), first-in first-out Memory (First Input First Output, FIFO), and/or first-out Memory (First Input Last Output, FILO), etc.; the processor may not be limited to use with a microprocessor of the STM32F105 family. In addition, the computer device may include, but is not limited to, a power supply unit, a display screen, and other necessary components.
A fourth aspect of the invention provides a computer readable storage medium having instructions stored thereon which, when executed on a computer, perform a sliding pane based vehicle detection method as described in the first aspect and any one of its possibilities.
The above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some of the technical features thereof can be replaced by equivalents. Such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.