CN108957460B - Method and device for detecting vehicle distance and computer readable storage medium - Google Patents
Method and device for detecting vehicle distance and computer readable storage medium Download PDFInfo
- Publication number
- CN108957460B CN108957460B CN201810685139.2A CN201810685139A CN108957460B CN 108957460 B CN108957460 B CN 108957460B CN 201810685139 A CN201810685139 A CN 201810685139A CN 108957460 B CN108957460 B CN 108957460B
- Authority
- CN
- China
- Prior art keywords
- vehicle
- distance
- license plate
- picture
- difference
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01S—RADIO DIRECTION-FINDING; RADIO NAVIGATION; DETERMINING DISTANCE OR VELOCITY BY USE OF RADIO WAVES; LOCATING OR PRESENCE-DETECTING BY USE OF THE REFLECTION OR RERADIATION OF RADIO WAVES; ANALOGOUS ARRANGEMENTS USING OTHER WAVES
- G01S15/00—Systems using the reflection or reradiation of acoustic waves, e.g. sonar systems
- G01S15/02—Systems using the reflection or reradiation of acoustic waves, e.g. sonar systems using reflection of acoustic waves
- G01S15/06—Systems determining the position data of a target
- G01S15/08—Systems for measuring distance only
Landscapes
- Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Radar, Positioning & Navigation (AREA)
- Remote Sensing (AREA)
- Acoustics & Sound (AREA)
- Computer Networks & Wireless Communication (AREA)
- General Physics & Mathematics (AREA)
- Traffic Control Systems (AREA)
Abstract
The invention discloses a vehicle distance detection method, equipment and a computer readable storage medium, wherein the method comprises the following steps: when a detection instruction for detecting the vehicle distance between the first vehicle and the second vehicle is detected, taking a vehicle picture of the first vehicle according to the detection instruction, wherein the first vehicle is positioned in front of the second vehicle; determining an object to be shot in a vehicle picture, and calculating the size of the object to be shot to obtain a first numerical value; extracting a license plate number from the vehicle picture, acquiring a second numerical value corresponding to the first vehicle in the database according to the license plate number, and calculating a difference value between the second numerical value and the first numerical value; and determining the distance between the first vehicle and the second vehicle according to the difference value based on a mapping relation between the preset difference value and the vehicle distance. The invention can avoid the occurrence of rear-end collision event by measuring the distance between two vehicles, thereby reducing the probability of traffic accidents.
Description
Technical Field
The present invention relates to the field of vehicle technologies, and in particular, to a method and apparatus for detecting a vehicle distance, and a computer readable storage medium.
Background
With the gradual improvement of the living standard of people, vehicles such as automobiles, electric vehicles and the like gradually enter the lives of people. With the increase of vehicles, the occurrence probability of traffic accidents is also increased. Among them, rear-end collision is one of the most frequent occurrence in traffic accidents. If the car owner visually observes whether the front car has emergency such as sudden braking, the car owner is likely to generate rear-end collision accidents due to untimely reaction caused by too close distance. Therefore, there is a need for a vehicle distance detection method to detect a distance to a preceding vehicle.
Disclosure of Invention
The invention mainly aims at providing a method, equipment and a computer readable storage medium for detecting a vehicle distance, and aims at solving the technical problem of how to detect the distance between the vehicle and a vehicle in front.
In order to achieve the above object, the present invention provides a method for detecting a vehicle distance, the method comprising:
when a detection instruction for detecting the vehicle distance between a first vehicle and a second vehicle is detected, taking a vehicle picture of the first vehicle according to the detection instruction, wherein the first vehicle is positioned in front of the second vehicle;
determining an object to be shot in the vehicle picture, and calculating the size of the object to be shot to obtain a first numerical value;
Extracting a license plate number from the vehicle picture, acquiring a second numerical value corresponding to the first vehicle in a database according to the license plate number, and calculating a difference value between the second numerical value and the first numerical value;
and determining the distance between the first vehicle and the second vehicle according to the difference value based on a mapping relation between the preset difference value and the vehicle distance.
Optionally, before the step of determining the distance between the first vehicle and the second vehicle according to the difference value based on the mapping relationship between the preset difference value and the vehicle distance, the method further includes:
transmitting a first ultrasonic signal through an ultrasonic transmitting device in the second vehicle, and receiving a second ultrasonic signal returned by the first ultrasonic information after encountering the first vehicle through an ultrasonic receiving device in the second vehicle;
determining a transmission time for transmitting the first ultrasonic signal and a reception time for receiving the second ultrasonic signal;
calculating a transmission distance of the first ultrasonic signal according to the transmitting time, the receiving time and the transmission rate of the ultrasonic signal, and recording the transmission distance as a first distance;
The step of determining the vehicle distance between the first vehicle and the second vehicle according to the difference value based on the mapping relation between the preset difference value and the vehicle distance comprises the following steps:
determining a second distance between the first vehicle and the second vehicle according to a preset mapping relation between a difference value and a vehicle distance;
a distance between the first vehicle and the second vehicle is determined based on the first distance and the second distance.
Optionally, the step of determining the distance between the first vehicle and the second vehicle according to the first distance and the second distance comprises:
calculating a distance difference value between the first distance and the second distance, and judging whether the distance difference value is smaller than or equal to a preset threshold value;
if the distance difference is smaller than or equal to the preset threshold, calculating an average value of the first distance and the second distance, and taking the average value as the distance between the first vehicle and the second vehicle;
and if the distance difference is larger than the preset threshold, taking the first distance or the second distance as the distance between the first vehicle and the second vehicle.
Optionally, after the step of calculating a distance difference between the first distance and the second distance and determining whether the distance difference is less than or equal to a preset threshold, the method further includes:
if the distance difference value is larger than the preset threshold value, acquiring current environment data;
and if the current environment is determined to be a rainy environment or a foggy environment according to the environment data, taking the first distance as the distance between the first vehicle and the second vehicle.
Optionally, after the step of determining the second distance between the first vehicle and the second vehicle according to the difference based on the mapping relationship between the preset difference and the distance between vehicles, the method further includes:
calculating a first fluctuation rate corresponding to the first distance and a second fluctuation rate corresponding to the second distance, and judging whether the first fluctuation rate is larger than the second fluctuation rate;
if the first fluctuation rate is greater than the second fluctuation rate, taking the second distance as the distance between the first vehicle and the second vehicle;
and if the first fluctuation rate is smaller than or equal to the second fluctuation rate, taking the first distance as the distance between the first vehicle and the second vehicle.
Optionally, the step of determining the object to be photographed in the vehicle picture, calculating the size of the object to be photographed, and obtaining the first value includes:
determining a license plate number picture in the vehicle picture, calculating the license plate area of the license plate number picture, and marking the license plate area as a first numerical value;
the step of extracting the license plate number from the vehicle picture, obtaining a second numerical value corresponding to the first vehicle in a database according to the license plate number, and calculating the difference between the second numerical value and the first numerical value comprises the following steps:
and extracting license plate numbers from the vehicle pictures, acquiring license plate areas corresponding to the first vehicles in a database according to the license plate numbers, marking the license plate areas acquired in the database as second numerical values, and calculating the difference between the second numerical values and the first numerical values.
Optionally, the step of determining the object to be photographed in the vehicle picture, calculating the size of the object to be photographed, and obtaining the first value includes:
determining a car body picture in the car body picture, calculating the car body volume of a corresponding car body in the car body picture, and recording the car body volume as a first numerical value;
The step of extracting the license plate number from the vehicle picture, obtaining a second numerical value corresponding to the first vehicle in a database according to the license plate number, and calculating the difference between the second numerical value and the first numerical value comprises the following steps:
and extracting a license plate number from the vehicle picture, acquiring a vehicle body volume corresponding to the first vehicle in a database according to the license plate number, marking the vehicle body volume acquired in the database as a second numerical value, and calculating a difference value between the second numerical value and the first numerical value.
Optionally, after the step of determining the distance between the first vehicle and the second vehicle according to the difference based on the mapping relationship between the preset difference and the distance between the vehicles, the method further includes:
and outputting prompt information when the distance between the first vehicle and the second vehicle is smaller than a preset distance, so as to prompt a vehicle owner of the distance between the second vehicle and the first vehicle according to the prompt information.
In addition, in order to achieve the above object, the present invention also provides a vehicle distance detecting apparatus including a memory, a processor, and a vehicle distance detecting program stored on the memory and operable on the processor, the vehicle distance detecting program implementing the steps of the vehicle distance detecting method as described above when executed by the processor.
In addition, in order to achieve the above object, the present invention also provides a computer-readable storage medium having stored thereon a vehicle distance detection program which, when executed by a processor, implements the steps of the vehicle distance detection method as described above.
According to the invention, by shooting the picture of the front vehicle, comparing the size of the object to be shot with the original size of the object to be shot in the shot picture, obtaining the difference value between the size of the object to be shot and the original size of the object to be shot in the shot picture, determining the distance between the two vehicles based on the mapping relation between the preset difference value and the vehicle distance, avoiding the occurrence of rear-end collision event caused by the too close distance between the two vehicles, and reducing the probability of traffic accidents.
Drawings
FIG. 1 is a schematic diagram of a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a flowchart of a first embodiment of a method for detecting a vehicle distance according to the present invention;
FIG. 3 is a flowchart of a second embodiment of a method for detecting a vehicle distance according to the present invention;
fig. 4 is a flowchart of a fourth embodiment of a method for detecting a vehicle distance according to the present invention.
The achievement of the object, functional features and advantages of the present invention will be described with reference to the embodiments with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
As shown in fig. 1, fig. 1 is a schematic structural diagram of a hardware running environment according to an embodiment of the present invention.
It should be noted that fig. 1 is a schematic structural diagram of a hardware operating environment of the vehicle distance detection device. The vehicle distance detection device in the embodiment of the invention can be a terminal device such as a PC (personal computer).
As shown in fig. 1, the vehicle distance detection apparatus may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, a communication bus 1002. Wherein the communication bus 1002 is used to enable connected communication between these components. The user interface 1003 may include a Display, an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may further include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also optionally be a storage device separate from the processor 1001 described above.
It will be appreciated by those skilled in the art that the vehicle distance detection device structure shown in fig. 1 does not constitute a limitation of the vehicle distance detection device, and may include more or fewer components than shown, or may combine certain components, or may be arranged in different components.
As shown in fig. 1, an operating system, a network communication module, a user interface module, and a vehicle distance detection program may be included in a memory 1005 as one type of computer storage medium. The operating system is a program for managing and controlling hardware and software resources of the detection device for vehicle distance, and supports the running of the detection program for vehicle distance and other software or programs.
In the vehicle distance detection apparatus shown in fig. 1, the user interface 1003 is mainly used for acquiring a detection instruction, outputting prompt information, and the like; the network interface 1004 is mainly used for connecting a background server and carrying out data communication with the background server; and the processor 1001 may be configured to call a detection program of the vehicle distance stored in the memory 1005 and perform the following operations:
when a detection instruction for detecting the vehicle distance between a first vehicle and a second vehicle is detected, taking a vehicle picture of the first vehicle according to the detection instruction, wherein the first vehicle is positioned in front of the second vehicle;
Determining an object to be shot in the vehicle picture, and calculating the size of the object to be shot to obtain a first numerical value;
extracting a license plate number from the vehicle picture, acquiring a second numerical value corresponding to the first vehicle in a database according to the license plate number, and calculating a difference value between the second numerical value and the first numerical value;
and determining the distance between the first vehicle and the second vehicle according to the difference value based on a mapping relation between the preset difference value and the vehicle distance.
Further, before the step of determining the distance between the first vehicle and the second vehicle according to the preset difference and the vehicle distance, the processor 1001 is further configured to invoke a vehicle distance detection program stored in the memory 1005, and perform the following operations:
transmitting a first ultrasonic signal through an ultrasonic transmitting device in the second vehicle, and receiving a second ultrasonic signal returned by the first ultrasonic information after encountering the first vehicle through an ultrasonic receiving device in the second vehicle;
determining a transmission time for transmitting the first ultrasonic signal and a reception time for receiving the second ultrasonic signal;
Calculating a transmission distance of the first ultrasonic signal according to the transmitting time, the receiving time and the transmission rate of the ultrasonic signal, and recording the transmission distance as a first distance;
the step of determining the vehicle distance between the first vehicle and the second vehicle according to the difference value based on the mapping relation between the preset difference value and the vehicle distance comprises the following steps:
determining a second distance between the first vehicle and the second vehicle according to a preset mapping relation between a difference value and a vehicle distance;
a distance between the first vehicle and the second vehicle is determined based on the first distance and the second distance.
Further, the step of determining the distance between the first vehicle and the second vehicle from the first distance and the second distance includes:
calculating a distance difference value between the first distance and the second distance, and judging whether the distance difference value is smaller than or equal to a preset threshold value;
if the distance difference is smaller than or equal to the preset threshold, calculating an average value of the first distance and the second distance, and taking the average value as the distance between the first vehicle and the second vehicle;
And if the distance difference is larger than the preset threshold, taking the first distance or the second distance as the distance between the first vehicle and the second vehicle.
Further, after the step of calculating the distance difference between the first distance and the second distance and determining whether the distance difference is less than or equal to a preset threshold, the processor 1001 is further configured to invoke a detection program of the vehicle distance stored in the memory 1005, and perform the following operations:
if the distance difference value is larger than the preset threshold value, acquiring current environment data;
and if the current environment is determined to be a rainy environment or a foggy environment according to the environment data, taking the first distance as the distance between the first vehicle and the second vehicle.
Further, after the step of determining the second distance between the first vehicle and the second vehicle according to the preset mapping relationship between the difference and the distance between the vehicles, the processor 1001 is further configured to invoke a vehicle distance detection program stored in the memory 1005, and perform the following operations:
calculating a first fluctuation rate corresponding to the first distance and a second fluctuation rate corresponding to the second distance, and judging whether the first fluctuation rate is larger than the second fluctuation rate;
If the first fluctuation rate is greater than the second fluctuation rate, taking the second distance as the distance between the first vehicle and the second vehicle;
and if the first fluctuation rate is smaller than or equal to the second fluctuation rate, taking the first distance as the distance between the first vehicle and the second vehicle.
Further, the step of determining the object to be photographed in the vehicle picture, calculating the size of the object to be photographed, and obtaining the first value includes:
determining a license plate number picture in the vehicle picture, calculating the license plate area of the license plate number picture, and marking the license plate area as a first numerical value;
the step of extracting the license plate number from the vehicle picture, obtaining a second numerical value corresponding to the first vehicle in a database according to the license plate number, and calculating the difference between the second numerical value and the first numerical value comprises the following steps:
and extracting license plate numbers from the vehicle pictures, acquiring license plate areas corresponding to the first vehicles in a database according to the license plate numbers, marking the license plate areas acquired in the database as second numerical values, and calculating the difference between the second numerical values and the first numerical values.
Further, the step of determining the object to be photographed in the vehicle picture, calculating the size of the object to be photographed, and obtaining the first value includes:
determining a car body picture in the car body picture, calculating the car body volume of a corresponding car body in the car body picture, and recording the car body volume as a first numerical value;
the step of extracting the license plate number from the vehicle picture, obtaining a second numerical value corresponding to the first vehicle in a database according to the license plate number, and calculating the difference between the second numerical value and the first numerical value comprises the following steps:
and extracting a license plate number from the vehicle picture, acquiring a vehicle body volume corresponding to the first vehicle in a database according to the license plate number, marking the vehicle body volume acquired in the database as a second numerical value, and calculating a difference value between the second numerical value and the first numerical value.
Further, after the step of determining the distance between the first vehicle and the second vehicle according to the preset difference and the vehicle distance based on the mapping relationship between the preset difference and the vehicle distance, the processor 1001 is further configured to invoke a vehicle distance detection program stored in the memory 1005, and perform the following operations:
And outputting prompt information when the distance between the first vehicle and the second vehicle is smaller than a preset distance, so as to prompt a vehicle owner of the distance between the second vehicle and the first vehicle according to the prompt information.
Based on the above-described structure, various embodiments of the vehicle distance detection method of the present invention are presented.
The invention provides a vehicle distance detection method.
Referring to fig. 3, fig. 3 is a flowchart illustrating a first embodiment of a method for detecting a vehicle distance according to the present invention.
In the present embodiment, an embodiment of a method of detecting a vehicle distance is provided, and it is to be noted that although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in an order different from that here.
In this embodiment, the method for detecting the vehicle distance includes:
step S10, after a detection instruction for detecting the vehicle distance between a first vehicle and a second vehicle is detected, a vehicle picture of the first vehicle is shot according to the detection instruction, wherein the first vehicle is positioned in front of the second vehicle.
When the second vehicle detects a detection instruction for detecting the vehicle distance between the second vehicle and the first vehicle, the first vehicle starts a camera according to the detection instruction, and a vehicle picture of the first vehicle is shot through the camera. Wherein the first vehicle is located in front of the second vehicle. The detection instruction can be triggered by the corresponding vehicle owner of the second vehicle according to the needs, can be triggered by the corresponding vehicle owner of the second vehicle according to the set timing tasks at regular time, and the like, and the time length corresponding to the timing tasks can be set according to specific needs, such as 1 minute, 3 minutes, and the like.
Step S20, determining an object to be shot in the vehicle picture, and calculating the size of the object to be shot to obtain a first numerical value.
Step S30, a license plate number is extracted from the vehicle picture, a second numerical value corresponding to the first vehicle in a database is obtained according to the license plate number, and a difference value between the second numerical value and the first numerical value is calculated.
When the second vehicle acquires the shot vehicle picture, the second vehicle determines an object to be shot in the vehicle picture, calculates the size of the object to be shot, and marks the size of the object to be shot as a first numerical value. The object to be photographed may be a body of the first vehicle or a license plate number of the first vehicle, or the like.
When the second vehicle obtains the shot vehicle picture, the second vehicle extracts the license plate number from the vehicle picture, searches a second numerical value corresponding to the first vehicle in the database according to the extracted license plate number, and calculates the difference between the second numerical value and the first numerical value. In this embodiment, the second vehicle may extract the license plate number from the vehicle picture by OCR (Optical Character Recognition ). It should be noted that the database may be a local database of the second vehicle, or may be a cloud database or a network database. In the database, license plate number sizes and vehicle types corresponding to different license plate numbers are stored in advance, and the original size of the first vehicle body can be determined through the vehicle types. The size of the license plate number is the area of a rectangular frame body where the license plate number is positioned in the vehicle, and the size of the vehicle body is the volume of the vehicle. The area corresponding to the license plate number and the volume corresponding to the vehicle body stored in the database are the second numerical value.
Further, step S20 includes:
step a, determining a license plate number picture in the vehicle picture, calculating the license plate area of the license plate number picture, and marking the license plate area as a first numerical value.
Step S30 includes:
and b, extracting license plate numbers from the vehicle pictures, acquiring license plate areas corresponding to the first vehicles in a database according to the license plate numbers, marking the license plate areas acquired in the database as second numerical values, and calculating the difference between the second numerical values and the first numerical values.
Further, when the object to be shot is a license plate number, the second vehicle determines a license plate number picture in the shot vehicle picture, calculates the license plate area of the license plate number picture, and marks the license plate area as a first numerical value. The license plate area is the frame area of the frame where the license plate number is located, and the corresponding picture of the frame where the license plate number is located is a license plate number picture. The specific process for calculating the license plate area is as follows: and measuring the length and the width of the license plate number picture, and multiplying the measured length and width to obtain a product, wherein the product is the license plate area.
The second vehicle extracts the license plate number from the shot vehicle picture, inquires the license plate area corresponding to the first vehicle from the database according to the license plate number, acquires the license plate area corresponding to the first vehicle from the database, and marks the license plate area acquired from the database as a second numerical value. After the second vehicle obtains the first value and the second value, a difference between the second value and the first value is calculated. It can be understood that if the license plates are identical in size, the license plate areas of all vehicles in the database are the same; if the license plate sizes are inconsistent, license plate areas of the corresponding vehicles of the license plates with different sizes in the database are different.
Further, step S20 further includes:
and c, determining a car body picture in the car picture, calculating the car body volume of a corresponding car body in the car body picture, and recording the car body volume as a first numerical value.
Step S30 further includes:
and d, extracting license plate numbers from the vehicle pictures, acquiring the vehicle body volumes corresponding to the first vehicles in a database according to the license plate numbers, marking the vehicle body volumes acquired in the database as second numerical values, and calculating the difference between the second numerical values and the first numerical values.
Further, when the object to be shot is a body of the vehicle, the second vehicle determines a body picture in the vehicle picture, namely, extracts the body picture from the shot vehicle picture, calculates a body volume of a corresponding body in the body picture, and marks the body volume as a first value. The process for calculating the volume of the vehicle body is as follows: and measuring the length, the width and the height of the car body picture, and calculating the product of the length, the width and the height, wherein the product is the car body volume.
The second vehicle extracts the license plate number from the shot vehicle picture, inquires the vehicle body volume corresponding to the first vehicle from the database according to the license plate number, acquires the vehicle body volume corresponding to the first vehicle from the database, and marks the vehicle body volume acquired from the database as a second numerical value. In this embodiment, the vehicle body volume and the license plate number are stored in the database in association with each other. And when the second vehicle obtains the first value and the second value, calculating a difference value between the second value and the first value, wherein the difference value is a difference value between the body volume in the taken vehicle picture and the original body volume of the first vehicle.
Step S40, determining a distance between the first vehicle and the second vehicle according to the difference based on a mapping relationship between a preset difference and a vehicle distance.
And when the second vehicle obtains the difference value between the second value and the first value, the second vehicle obtains the preset mapping relation between the difference value and the vehicle distance, and the distance between the second vehicle and the first vehicle is determined according to the difference value. It should be noted that, in the mapping relationship, different differences are stored to correspond to different distances between vehicles, and the mapping relationship between the differences and the distances between vehicles is obtained through experiments. Therefore, when the difference is obtained, the distance between the first vehicle and the second vehicle can be determined according to the mapping relation. The mapping relationship may be set as: when the difference value between the license plate area in the shot vehicle picture and the license plate area in the database is a, the distance between the first vehicle and the second vehicle is A; when the difference value between the license plate area in the shot vehicle picture and the license plate area in the database is B, the distance between the first vehicle and the second vehicle is B; when the difference between the license plate area in the photographed vehicle picture and the license plate area in the database is C, the distance between the first vehicle and the second vehicle is C.
According to the method, the device and the system, the picture of the front vehicle is shot, the size of the object to be shot in the shot picture is compared with the original size of the object to be shot, the difference value between the size of the object to be shot in the shot picture and the original size of the object to be shot is obtained, the distance between the two vehicles is determined based on the mapping relation between the preset difference value and the vehicle distance, the situation that the rear-end collision event occurs due to the fact that the distance between the two vehicles is too close is avoided, and the probability of traffic accidents is reduced.
Further, a second embodiment of the vehicle distance detection method of the present invention is proposed. The second embodiment of the vehicle distance detection method differs from the first embodiment of the vehicle distance detection method in that, referring to fig. 3, the vehicle distance detection method further includes:
and step S50, transmitting a first ultrasonic signal through an ultrasonic transmitting device in the second vehicle, and receiving a second ultrasonic signal returned by the first ultrasonic information after encountering the first vehicle through an ultrasonic receiving device in the second vehicle.
The second vehicle transmits the first ultrasonic signal through the ultrasonic transmitting device thereof, and receives the second ultrasonic signal returned after the first ultrasonic signal encounters the first vehicle through the ultrasonic receiving device thereof. In the present embodiment, in order to save costs, an earpiece in the second vehicle may be used as the ultrasonic wave transmitting device, and a microphone in the second vehicle may be used as the ultrasonic wave receiving device. In other embodiments, an ultrasonic wave transmitting device dedicated to transmitting an ultrasonic wave signal and an ultrasonic wave receiving device dedicated to receiving an ultrasonic wave signal may be provided in the second vehicle.
In this embodiment, the second vehicle may transmit the first ultrasonic signal through the ultrasonic transmitting device thereof during the process of taking the vehicle picture of the first vehicle according to the detection instruction.
Step S60, determining a transmitting time of transmitting the first ultrasonic signal and a receiving time of receiving the second ultrasonic signal.
The second vehicle determines a transmission time of transmitting the first ultrasonic signal after receiving the second ultrasonic signal, and determines a reception time of receiving the second ultrasonic signal. When the second vehicle transmits the first ultrasonic signal through the ultrasonic transmitting device, the second vehicle records the transmitting time of transmitting the first ultrasonic signal; when the second vehicle receives the second ultrasonic signal through the ultrasonic receiving device, the second vehicle records the receiving time of the second ultrasonic signal.
And step S70, calculating the transmission distance of the first ultrasonic signal according to the transmitting time, the receiving time and the transmission rate of the ultrasonic signal, and recording the transmission distance as a first distance.
When the second vehicle determines the transmitting time and the receiving time, the second vehicle acquires the transmission rate of the pre-stored ultrasonic signal in the air, calculates the transmission distance of the first ultrasonic signal according to the transmitting time, the receiving time and the transmission rate of the ultrasonic signal in the air, and marks the transmission distance of the first ultrasonic signal as the first distance. Wherein the transmission rate of the ultrasonic signal in the air is 340m/s (meters per second). The first distance is: l=c×t/2, where T represents the time difference between the transmission time and the reception time, and C represents the transmission rate of the ultrasonic signal in air.
Step S40 includes:
step S41, determining a second distance between the first vehicle and the second vehicle according to the difference based on a mapping relationship between a preset difference and a vehicle distance.
And step S42, determining the distance between the first vehicle and the second vehicle according to the first distance and the second distance.
After the second vehicle calculates the difference between the first value and the second value, determining the distance between the first vehicle and the second vehicle according to the difference based on the mapping relation between the preset difference and the vehicle distance, and recording the distance between the first vehicle and the second vehicle determined by the mapping relation as the second distance.
When the first distance and the second distance are obtained, the second vehicle determines a distance between the first vehicle and the second vehicle according to the first distance and the second distance.
Further, the present embodiment may also directly use the first distance as the distance between the first vehicle and the second vehicle.
Further, step S42 includes:
and e, calculating a distance difference value between the first distance and the second distance, and judging whether the distance difference value is smaller than or equal to a preset threshold value.
And f, if the distance difference value is smaller than or equal to the preset threshold value, calculating an average value of the first distance and the second distance, and taking the average value as the distance between the first vehicle and the second vehicle.
Further, the second vehicle determines the distance between the first vehicle and the second vehicle based on the first distance and the second distance by: the second vehicle subtracts the second distance from the first distance, calculates a distance difference between the first distance and the second distance, and determines whether the calculated distance difference is less than or equal to a preset threshold. The preset threshold may be set according to specific needs, and the numerical value of the preset threshold is not specifically limited in this embodiment. If the distance difference is less than or equal to the preset threshold, the second vehicle calculates an average value between the first distance and the second distance, and the average value is used as the distance between the first vehicle and the second vehicle.
And g, if the distance difference value is larger than the preset threshold value, taking the first distance or the second distance as the distance between the first vehicle and the second vehicle.
If the distance difference is greater than the preset threshold, the second vehicle takes the first distance as the distance between the first vehicle and the second vehicle or takes the second distance as the distance between the first vehicle and the second vehicle.
According to the method, the first distance between the two vehicles is detected through ultrasonic waves, the second distance between the two vehicles is detected in a mode of taking the vehicle pictures, the distance between the two vehicles is determined according to the first distance and the second distance, and compared with the method that the distance between the two vehicles is detected only through ultrasonic signals, or the distance between the two vehicles is detected only through taking the vehicle pictures, the accuracy of measuring the distance between the vehicles is improved.
Further, the method for detecting the distance of the vehicle further comprises the following steps:
and h, if the distance difference value is larger than the preset threshold value, acquiring current environment data.
And i, if the current environment is determined to be a rainy day environment and/or a foggy day environment according to the environment data, taking the first distance as the distance between the first vehicle and the second vehicle.
Further, if the distance difference is determined to be greater than the preset threshold, the second vehicle acquires current environmental data. Specifically, the second vehicle detects the current air humidity through the humidity sensor and the current visibility through the visibility sensor to acquire the air humidity and the visibility of the current environment. When the second vehicle acquires the air humidity and the visibility of the current environment, the second vehicle determines whether the current environment is a rainy environment or a foggy environment according to the air humidity and the visibility. Specifically, when the air humidity is greater than or equal to the preset humidity, the second vehicle determines that the current weather is rainy weather, namely, determines that the current environment is rainy environment; when the air humidity is less than the preset humidity, the second vehicle determines that the current weather is not rainy weather. When the visibility is smaller than or equal to the preset visibility, the second vehicle determines that the current weather is foggy weather, namely, the current environment is foggy environment; and when the visibility is larger than the preset visibility, the second vehicle determines that the current weather is not foggy weather. The preset humidity and the preset visibility can be set according to specific needs, and the numerical values corresponding to the preset humidity and the preset visibility are not particularly limited in this embodiment.
When the current environment is determined to be a rainy and/or foggy environment, the second vehicle takes the first distance as the distance between the first vehicle and the second vehicle. Further, if it is determined that the current environment is not a rainy or foggy environment, the second vehicle takes the smaller of the first distance and the second distance as a distance from the first vehicle in order to minimize the probability of occurrence of a traffic accident.
According to the method, when the distance difference between the first distance and the second distance is larger than the preset threshold, the second vehicle obtains current environment data, whether the current environment is the rainy environment and/or the foggy environment or not is determined according to the environment data, if the current environment is the rainy environment and/or the foggy environment, the distance detected through the ultrasonic signals is used as the distance between the first vehicle and the second vehicle, the situation that the accuracy of detecting the distance between the first vehicle and the second vehicle through shooting vehicle pictures is not high due to the fact that the current environment is the rainy environment and/or the foggy environment is avoided, and the accuracy of measuring the distance between the vehicles is improved.
Further, a third embodiment of the vehicle distance detection method of the present invention is proposed. The third embodiment of the vehicle distance detection method differs from the second embodiment of the vehicle distance detection method in that the vehicle distance detection method further includes:
And j, calculating a first fluctuation rate corresponding to the first distance and a second fluctuation rate corresponding to the second distance, and judging whether the first fluctuation rate is larger than the second fluctuation rate.
When the second vehicle obtains the first distance and the second distance, the second vehicle calculates a first fluctuation rate corresponding to the first distance, calculates a second fluctuation rate corresponding to the second distance, and judges whether the first fluctuation rate is larger than the second fluctuation rate after calculating the first fluctuation rate and the second fluctuation rate.
The process of calculating the first fluctuation rate corresponding to the first distance by the second vehicle is as follows: the second vehicle obtains the calculated first distances in the preset time period, calculates the average value of the first distances in the preset time period, calculates the difference value between the first distances and the average value, and adds the difference value between the first distances and the average value to obtain the first fluctuation rate. The preset time length can be set according to specific needs, and in this embodiment, the numerical value of the preset time length is not specifically limited, and the preset time length is calculated from the current time point. If the second vehicle obtains 5 first distances calculated within the preset time period, which are A, B, C, D and E respectively, calculating A, B, C, D and E average values respectively, if A, B, C, D and E average values are O, calculating A, B, C, D and E and O difference values respectively, marking A and O difference values as a, B and O difference values as B, C and O difference values as C, D and O difference values as D, E and O difference values as E, and adding a, B, C, D and E to obtain the sum which is the first fluctuation rate.
It should be noted that, the process of calculating the second fluctuation rate corresponding to the second distance by the second vehicle is similar to the process of calculating the first fluctuation rate corresponding to the first distance, and detailed description thereof is omitted in this embodiment.
And step k, if the first fluctuation rate is larger than the second fluctuation rate, taking the second distance as the distance between the first vehicle and the second vehicle.
And step l, if the first fluctuation rate is smaller than or equal to the second fluctuation rate, taking the first distance as the distance between the first vehicle and the second vehicle.
If the second vehicle determines that the first rate of fluctuation is greater than the second rate of fluctuation, the second vehicle uses the second distance as the distance between the second vehicle and the first vehicle, i.e., the second distance is the distance between the first vehicle and the second vehicle. If the second vehicle determines that the first volatility is less than or equal to the second volatility, the second vehicle uses the first distance as a distance between the second vehicle and the first vehicle, i.e., the first distance is a distance between the first vehicle and the second vehicle.
The present embodiment improves the accuracy of distance measurement between vehicles by taking the distance with a small fluctuation ratio as the distance between the first vehicle and the second vehicle (the distance change of the distance between the two vehicles in a certain time is relatively small, so that when the fluctuation ratio is large, it indicates that the corresponding distance detection method is poor in stability).
Further, a fourth embodiment of the vehicle distance detection method of the present invention is proposed. The fourth embodiment of the vehicle distance detection method differs from the first, second or third embodiment of the vehicle distance detection method in that, referring to fig. 4, the vehicle distance detection method further includes:
and step S80, outputting prompt information when the distance between the first vehicle and the second vehicle is smaller than a preset distance, so as to prompt a vehicle owner of the distance between the second vehicle and the first vehicle according to the prompt information.
When the distance between the first vehicle and the vehicle is obtained, the second vehicle judges whether the distance between the second vehicle and the first vehicle is smaller than a preset distance. The preset distance may be set according to specific needs, and the numerical value corresponding to the preset distance is not specifically limited in this embodiment. If the distance between the first vehicle and the second vehicle is smaller than the preset distance, the second vehicle outputs prompt information to prompt the vehicle owner of the second vehicle to be at a distance from the first vehicle according to the prompt information, and further, the vehicle owner of the second vehicle can be prompted to be at a too close distance from the first vehicle according to the prompt information, so that the rear-end collision event is to be avoided. In this embodiment, the output mode of the prompt information is not limited, for example, the prompt information may be output in a voice form and/or a text form.
Further, the second vehicle may also directly output a prompt message to prompt its owner of the distance between the vehicle and the first vehicle after determining the distance between the vehicle and the first vehicle.
Further, if the second vehicle is an unmanned vehicle, after the second vehicle determines that the distance between the second vehicle and the first vehicle is smaller than the preset distance, the second vehicle automatically triggers a control command to control the second vehicle to run at the current running speed according to the control command, or reduce the current running speed, so as to avoid a rear-end collision event.
According to the method, when the distance between the first vehicle and the second vehicle is smaller than the preset distance, the prompting information is output to prompt the second vehicle to correspond to the current distance between the vehicle owner and the first vehicle, so that a rear-end collision event is avoided, and the probability of traffic accidents is reduced.
In addition, the embodiment of the invention also provides a computer readable storage medium.
The computer-readable storage medium stores thereon a vehicle distance detection program which, when executed by a processor, implements the steps of the vehicle distance detection method described above.
The specific embodiment of the computer readable storage medium of the present invention is substantially the same as the above embodiments of the vehicle distance detection method, and will not be described herein.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The foregoing description of the preferred embodiments of the present invention should not be taken as limiting the scope of the invention, but rather should be understood to cover all modifications, equivalents, and alternatives falling within the scope of the invention as defined by the following description and drawings, or by direct or indirect application to other relevant art(s).
Claims (8)
1. A method for detecting a vehicle distance, the method comprising the steps of:
when a detection instruction for detecting the vehicle distance between a first vehicle and a second vehicle is detected, taking a vehicle picture of the first vehicle according to the detection instruction, wherein the first vehicle is positioned in front of the second vehicle;
determining an object to be shot in the vehicle picture, and calculating the size of the object to be shot to obtain a first numerical value;
extracting a license plate number from the vehicle picture, acquiring a second numerical value corresponding to the first vehicle in a database according to the license plate number, and calculating a difference value between the second numerical value and the first numerical value;
determining the distance between the first vehicle and the second vehicle according to a preset mapping relation between the difference and the distance;
Wherein, before the step of determining the distance between the first vehicle and the second vehicle according to the difference value based on the mapping relationship between the preset difference value and the vehicle distance, the method further comprises:
transmitting a first ultrasonic signal through an ultrasonic transmitting device in the second vehicle, and receiving a second ultrasonic signal returned by the first ultrasonic signal after encountering the first vehicle through an ultrasonic receiving device in the second vehicle;
determining a transmission time for transmitting the first ultrasonic signal and a reception time for receiving the second ultrasonic signal;
calculating a transmission distance of the first ultrasonic signal according to the transmitting time, the receiving time and the transmission rate of the ultrasonic signal, and recording the transmission distance as a first distance;
the step of determining the vehicle distance between the first vehicle and the second vehicle according to the difference value based on the mapping relation between the preset difference value and the vehicle distance comprises the following steps:
determining a second distance between the first vehicle and the second vehicle according to a preset mapping relation between a difference value and a vehicle distance;
determining a distance between the first vehicle and the second vehicle based on the first distance and the second distance;
Wherein, after the step of determining the second distance between the first vehicle and the second vehicle according to the difference value based on the mapping relationship between the preset difference value and the vehicle distance, the method further comprises:
calculating a first fluctuation rate corresponding to the first distance and a second fluctuation rate corresponding to the second distance, and judging whether the first fluctuation rate is larger than the second fluctuation rate;
if the first fluctuation rate is greater than the second fluctuation rate, taking the second distance as the distance between the first vehicle and the second vehicle;
and if the first fluctuation rate is smaller than or equal to the second fluctuation rate, taking the first distance as the distance between the first vehicle and the second vehicle.
2. The method of detecting a vehicle distance according to claim 1, wherein the step of determining a distance between the first vehicle and the second vehicle from the first distance and the second distance includes:
calculating a distance difference value between the first distance and the second distance, and judging whether the distance difference value is smaller than or equal to a preset threshold value;
if the distance difference is smaller than or equal to the preset threshold, calculating an average value of the first distance and the second distance, and taking the average value as the distance between the first vehicle and the second vehicle;
And if the distance difference is larger than the preset threshold, taking the first distance or the second distance as the distance between the first vehicle and the second vehicle.
3. The method for detecting a distance of a vehicle according to claim 2, wherein after the step of calculating a distance difference between the first distance and the second distance and determining whether the distance difference is less than or equal to a preset threshold value, further comprises:
if the distance difference value is larger than the preset threshold value, acquiring current environment data;
and if the current environment is determined to be a rainy environment or a foggy environment according to the environment data, taking the first distance as the distance between the first vehicle and the second vehicle.
4. The method for detecting a distance between vehicles according to claim 1, wherein the step of determining an object to be photographed in the vehicle picture, calculating a size of the object to be photographed, and obtaining the first value includes:
determining a license plate number picture in the vehicle picture, calculating the license plate area of the license plate number picture, and marking the license plate area as a first numerical value;
the step of extracting the license plate number from the vehicle picture, obtaining a second numerical value corresponding to the first vehicle in a database according to the license plate number, and calculating the difference between the second numerical value and the first numerical value comprises the following steps:
And extracting license plate numbers from the vehicle pictures, acquiring license plate areas corresponding to the first vehicles in a database according to the license plate numbers, marking the license plate areas acquired in the database as second numerical values, and calculating the difference between the second numerical values and the first numerical values.
5. The method for detecting a distance between vehicles according to claim 1, wherein the step of determining an object to be photographed in the vehicle picture, calculating a size of the object to be photographed, and obtaining the first value includes:
determining a car body picture in the car body picture, calculating the car body volume of a corresponding car body in the car body picture, and recording the car body volume as a first numerical value;
the step of extracting the license plate number from the vehicle picture, obtaining a second numerical value corresponding to the first vehicle in a database according to the license plate number, and calculating the difference between the second numerical value and the first numerical value comprises the following steps:
and extracting a license plate number from the vehicle picture, acquiring a vehicle body volume corresponding to the first vehicle in a database according to the license plate number, marking the vehicle body volume acquired in the database as a second numerical value, and calculating a difference value between the second numerical value and the first numerical value.
6. The method according to any one of claims 1 to 5, wherein after the step of determining the distance between the first vehicle and the second vehicle from the difference based on a preset map between the difference and the distance, further comprising:
and outputting prompt information when the distance between the first vehicle and the second vehicle is smaller than a preset distance, so as to prompt a vehicle owner of the distance between the second vehicle and the first vehicle according to the prompt information.
7. A vehicle distance detection apparatus, characterized in that it comprises a memory, a processor and a vehicle distance detection program stored on the memory and executable on the processor, which when executed by the processor realizes the steps of the vehicle distance detection method according to any one of claims 1 to 6.
8. A computer-readable storage medium, wherein a vehicle distance detection program is stored on the computer-readable storage medium, which when executed by a processor, implements the steps of the vehicle distance detection method according to any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810685139.2A CN108957460B (en) | 2018-06-27 | 2018-06-27 | Method and device for detecting vehicle distance and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810685139.2A CN108957460B (en) | 2018-06-27 | 2018-06-27 | Method and device for detecting vehicle distance and computer readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108957460A CN108957460A (en) | 2018-12-07 |
CN108957460B true CN108957460B (en) | 2023-09-05 |
Family
ID=64487312
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810685139.2A Active CN108957460B (en) | 2018-06-27 | 2018-06-27 | Method and device for detecting vehicle distance and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108957460B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110209178B (en) * | 2019-07-08 | 2020-09-15 | 陈坤燕 | Unmanned vehicle control method based on big data |
CN110542905A (en) * | 2019-07-16 | 2019-12-06 | 深圳市双盈电子科技有限公司 | ultrasonic vehicle detection method, device and storage medium |
CN111242119B (en) * | 2020-01-02 | 2022-12-16 | 腾讯科技(深圳)有限公司 | Vehicle image processing method and device, electronic equipment and computer readable medium |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH10105873A (en) * | 1996-09-30 | 1998-04-24 | Toshiba Corp | Device for recognizing number plate of vehicle |
CN101131321A (en) * | 2007-09-28 | 2008-02-27 | 深圳先进技术研究院 | Real-time safe interval measurement method and device used for vehicle anti-collision warning |
CN101750049B (en) * | 2008-12-05 | 2011-12-21 | 南京理工大学 | Monocular vision vehicle distance measuring method based on road and vehicle information |
JP6048246B2 (en) * | 2013-03-19 | 2016-12-21 | 株式会社デンソー | Inter-vehicle distance measuring device and inter-vehicle distance measuring method |
CN105405321B (en) * | 2015-12-22 | 2018-04-20 | 清华大学 | Safe early warning method and system in vehicle on expressway traveling |
-
2018
- 2018-06-27 CN CN201810685139.2A patent/CN108957460B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN108957460A (en) | 2018-12-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11568496B1 (en) | Risk behavior detection methods based on tracking handset movement within a moving vehicle | |
US20210129869A1 (en) | Intelligent driving control methods and apparatuses, vehicles, electronic devices, and storage media | |
CN108957460B (en) | Method and device for detecting vehicle distance and computer readable storage medium | |
CN106815574B (en) | Method and device for establishing detection model and detecting behavior of connecting and calling mobile phone | |
RU2016140345A (en) | SYSTEM, METHOD AND COMPUTER READED MEMORY CARRIERS FOR PERFORMANCE-BASED PERFORMANCE ASSESSMENT AND LEARNING | |
CN107705576B (en) | Vehicle fake plate detection method, server and storage medium | |
CN110930765B (en) | Early warning priority determination method, device, storage medium and device | |
US10671861B2 (en) | Image recording system, image recording method and image recording program | |
CN111081059A (en) | Parking management method, device and equipment based on TOF and readable storage medium | |
US20200234063A1 (en) | Lane recognition device and method thereof | |
CN106297407A (en) | Driving safety prompt method and device based on intelligent terminal | |
US20230049840A1 (en) | Prediction method and apparatus for autonomous driving manual takeover, and system | |
CN113386784A (en) | Vehicle speed monitoring method, device, equipment and computer readable storage medium | |
CN114677848B (en) | Perception early warning system, method, device and computer program product | |
CN116170755A (en) | Reminding method and device for parking duration, terminal equipment and storage medium | |
CN112086098A (en) | Driver and passenger analysis method and device and computer readable storage medium | |
CN108639056B (en) | Driving state detection method and device and mobile terminal | |
CN113352989B (en) | Intelligent driving safety auxiliary method, product, equipment and medium | |
CN114103944A (en) | Workshop time distance adjusting method, device and equipment | |
CN110188645B (en) | Face detection method and device for vehicle-mounted scene, vehicle and storage medium | |
JP7136538B2 (en) | electronic device | |
CN111861051A (en) | Method and device for handling traffic accidents | |
CN115465285A (en) | Vehicle voice control method based on driving process and related device | |
CN109064722A (en) | arrival reminding method and device | |
TW201542409A (en) | Indicating device and method for driving distance with vehicles |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |