Vehicle distance detection method, device, equipment, storage medium and product

By using single-camera image recognition technology to determine the position of the target vehicle and combining auxiliary images and installation spacing to calculate the vehicle distance, the problem of low computational efficiency in stereo vision systems is solved, and the speed and efficiency of vehicle distance calculation are improved.

CN116645656BActive Publication Date: 2026-03-17CHINA UNITED NETWORK COMM GRP CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-30
Publication Date
2026-03-17

AI Technical Summary

Technical Problem

Existing stereo vision systems require feature extraction and target vehicle identification from two images, resulting in low efficiency in calculating vehicle distance.

Method used

A single camera is used for image recognition to determine the position information of the target vehicle in the image to be detected. Based on this position information, the position of the target vehicle is matched in the auxiliary image, and the vehicle distance is calculated by combining the camera installation spacing.

Benefits of technology

By reducing the number of image processing steps, the efficiency of acquiring target vehicle location information is improved, and the time for calculating vehicle distance is shortened.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116645656B_ABST
    Figure CN116645656B_ABST
Patent Text Reader

Abstract

The application provides a vehicle distance detection method, device, equipment, storage medium and product. The method comprises the following steps: acquiring a to-be-detected image collected by a detection camera and an auxiliary image collected by an auxiliary camera; determining a target vehicle in the to-be-detected image by using an image recognition technology; determining first position information of the target vehicle in the to-be-detected image; determining second position information of the target vehicle in the auxiliary image according to the first position information; and calculating a distance from the target vehicle based on the first position information, the second position information and an installation interval of the detection camera and the auxiliary camera. The second position information of the target vehicle in the auxiliary image is determined according to the first position information of the target vehicle, so that the target vehicle in the image can be detected by image recognition only on one image, the occupation of operation resources is reduced, the efficiency of acquiring the position information of the target vehicle in two images is improved, and the time for calculating the distance from the target vehicle is shortened.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer vision inspection, and in particular to a vehicle distance detection method, apparatus, device, storage medium, and product. Background Technology

[0002] In the field of intelligent driving, tasks such as vehicle distance measurement, vehicle detection, and obstacle detection can be performed, which helps improve road safety and driving comfort. Among these, vehicle distance measurement can assist intelligent driving systems in making decisions such as bypassing vehicles, changing routes, and controlling speed.

[0003] Currently, vehicle distance measurement is typically achieved using single-vision or stereo vision systems. Stereo vision systems require extracting features from images captured by two cameras for classification to identify the target vehicle in each image and determine its position within each image. The distance to the target vehicle is then calculated based on its position in both images. Because feature extraction and target vehicle identification are required for both images, calculating the distance to the target vehicle is inefficient. Summary of the Invention

[0004] This application provides a vehicle distance detection method, apparatus, device, storage medium, and product to solve the problem that the efficiency of calculating the distance to the target vehicle is low because it requires feature extraction from two images and determination of the target vehicle in the two images.

[0005] Firstly, this application provides a vehicle distance detection method, including:

[0006] Acquire the image to be detected captured by the detection camera, and acquire the auxiliary image captured by the auxiliary camera;

[0007] Image recognition technology is used to determine the target vehicle in the image to be detected;

[0008] Determine the first location information of the target vehicle in the image to be detected;

[0009] Determine the second location information of the target vehicle in the auxiliary image based on the first location information;

[0010] The distance to the target vehicle is calculated based on the first location information, the second location information, and the installation spacing between the detection camera and the auxiliary camera.

[0011] Optionally, determining the target vehicle in the image to be detected using image recognition technology includes:

[0012] Edge detection technology is used to determine the horizontal and vertical edge lines of the objects to be classified in the image to be detected; a multi-level discrete wavelet transform algorithm is used to extract the classification features of the objects to be classified based on the horizontal and vertical edge lines; a vehicle classifier is used to determine whether the category of the objects to be classified is a vehicle based on the classification features; and objects to be classified as vehicles are identified as target vehicles.

[0013] Optionally, determining the first location information of the target vehicle in the image to be detected includes:

[0014] The horizontal and vertical edge lines of the target vehicle in the image to be detected are used to determine the horizontal and vertical coordinates of the target vehicle in the image to be detected, and these coordinates are used as the first position information.

[0015] Optionally, determining the second location information of the target vehicle in the auxiliary image based on the first location information includes:

[0016] Edge detection technology is used to determine the horizontal and vertical edge lines of the object to be matched in the auxiliary image. If it is determined that the vertical coordinate of the target vehicle in the first location information is included between the two horizontal edge lines of a certain object to be matched, then the object to be matched is determined as a pending object. The target vehicle is determined from the pending objects, and the horizontal and vertical edge lines of the target vehicle in the auxiliary image are used to determine the horizontal and vertical coordinates of the target vehicle in the auxiliary image, and the horizontal and vertical coordinates of the target vehicle in the auxiliary image are determined as the second location information.

[0017] Optionally, determining the target vehicle from the objects to be determined includes:

[0018] If there is only one object to be identified, then that object is identified as the target vehicle in the auxiliary image; if there are multiple objects to be identified, then the object whose vertical and horizontal edge lengths match the target vehicle in the image to be detected is identified as the target vehicle.

[0019] Optionally, after determining the target vehicle in the image to be detected using image recognition technology, the process includes: controlling the detection camera to focus on the target vehicle and acquire the image to be detected, and obtaining an updated image to be detected; acquiring the auxiliary image acquired by the auxiliary camera includes: controlling the auxiliary camera to acquire the auxiliary image at the focal length after the detection camera has focused, and obtaining the auxiliary image acquired by the auxiliary camera.

[0020] The detection camera is mounted parallel to the left of the auxiliary camera. The calculation of the distance to the target vehicle based on the first position information, the second position information, and the installation distance between the detection camera and the auxiliary camera includes:

[0021] Based on the first location information, the distance P1 between the target vehicle in the image to be detected and the right edge of the image to be detected is determined, and based on the second location information, the distance P2 between the target vehicle in the auxiliary image and the left edge of the auxiliary image is determined. P1, P2, and the installation spacing between the detection camera and the auxiliary camera are then substituted into the following vehicle distance calculation formula to calculate the distance to the target vehicle. The vehicle distance calculation formula is as follows:

[0022]

[0023] Where ω1 represents the angle of the detection camera's view, ω2 represents the angle of the auxiliary camera's view, H1 represents the horizontal dimension of the image to be detected, H2 represents the horizontal dimension of the auxiliary image, β1 represents the angle adjacent to the detection camera's view, β2 represents the angle of the angle adjacent to the detection camera's view, and A represents the installation distance between the detection camera and the auxiliary camera.

[0024] Optionally, before substituting the installation spacing of P1, P2, and the detection camera and auxiliary camera into the following vehicle distance calculation formula to calculate the distance to the target vehicle, the following steps are included:

[0025] Acquire a first calibration image and a second calibration image captured by the detection camera and the auxiliary camera at the corrected focal length; determine the image width of the overlapping portion of the first calibration image and the second calibration image; calculate the installation distance between the detection camera and the auxiliary camera based on the angle of view of the detection camera and the auxiliary camera, the corrected focal length, and the image width of the overlapping portion.

[0026] Secondly, this application provides a vehicle distance detection device, comprising:

[0027] The acquisition module is used to acquire the image to be detected captured by the detection camera and the auxiliary image captured by the auxiliary camera;

[0028] The identification module is used to determine the target vehicle in the image to be detected using image recognition technology;

[0029] The determination module is used to determine the first position information of the target vehicle in the image to be detected;

[0030] The matching module is used to determine the second location information of the target vehicle in the auxiliary image based on the first location information;

[0031] The calculation module is used to calculate the distance to the target vehicle based on the first location information, the second location information, and the installation spacing between the detection camera and the auxiliary camera.

[0032] Thirdly, this application provides an electronic device, including: a processor, and a memory and a transceiver communicatively connected to the processor;

[0033] The memory stores computer-executed instructions; the transceiver is used for sending and receiving data.

[0034] The processor executes computer execution instructions stored in the memory to implement the vehicle distance detection method described in any of the above aspects.

[0035] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the vehicle distance detection method described in any of the above aspects.

[0036] Fifthly, this application provides a computer program product, including computer execution instructions, which, when executed by a processor, implement the vehicle distance detection method described in any of the above aspects.

[0037] The vehicle distance detection method, apparatus, equipment, storage medium, and product provided in this application acquire a target image captured by a detection camera and an auxiliary image captured by an auxiliary camera; determine the target vehicle in the target image using image recognition technology; determine the first position information of the target vehicle in the target image; determine the second position information of the target vehicle in the auxiliary image based on the first position information; and calculate the distance to the target vehicle based on the first position information, the second position information, and the installation distance between the detection camera and the auxiliary camera. By detecting the target vehicle in the target image and determining the second position information of the target vehicle in the auxiliary image using the first position information of the target vehicle, the target vehicle can be detected by image recognition in only one image, reducing the consumption of computing resources and improving the efficiency of obtaining the position information of the target vehicle in two images, thereby shortening the time for calculating the distance to the target vehicle. Attached Figure Description

[0038] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0039] Figure 1 This is a schematic diagram illustrating an application scenario provided in the embodiments of this application;

[0040] Figure 2 This is a flowchart of the vehicle distance detection method provided in the embodiments of this application;

[0041] Figure 3 This is a schematic diagram illustrating the vehicle distance calculation formula in the embodiments of this application;

[0042] Figure 4 This is a schematic diagram of the vehicle distance detection device provided in the embodiments of this application;

[0043] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

[0044] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0045] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0046] The terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. In the following descriptions of embodiments, "a plurality of" means two or more, unless otherwise explicitly defined.

[0047] First, the prior art involved in this invention will be described and analyzed in detail.

[0048] Stereo vision systems require extracting features from images captured by two cameras for classification to identify the target vehicle in each image and determine its position within both images. Due to the complexity of driving environments, identifying the target vehicle from images is challenging. Currently, the system requires detecting the target vehicle from both images and obtaining its position, making the calculation of the target vehicle's distance inefficient.

[0049] The inventors discovered in their research that by performing image recognition on images captured by only one camera in a stereo vision system, detecting and locating the target vehicle in that image, the approximate location of the target vehicle in an image captured by another camera can be determined based on the target vehicle's position in that image. This allows for matching the target vehicle in the image captured by the other camera, improving the efficiency of calculating the target vehicle's distance. Therefore, this application provides a vehicle distance detection method that acquires a detection image captured by a detection camera and an auxiliary image captured by an auxiliary camera; uses image recognition technology to determine the target vehicle in the detection image; determines the first position information of the target vehicle in the detection image; determines the second position information of the target vehicle in the auxiliary image based on the first position information; and calculates the distance to the target vehicle based on the first position information, the second position information, and the installation distance between the detection camera and the auxiliary camera.

[0050] Figure 1 This is a schematic diagram of an application scenario provided in the embodiments of this application, such as... Figure 1 As shown, the target vehicle 1 can be the vehicle in front of the user vehicle 2. The user vehicle 2 is equipped with a detection camera and an auxiliary camera, which can capture images including the target vehicle. After acquiring the image to be detected and the auxiliary image, the electronic equipment on the user vehicle 2 can execute the vehicle distance detection method provided in this application, identify the target vehicle in the image to be detected and match the target vehicle in the auxiliary image, obtain the first position information and the second position information of the target vehicle, and then calculate the distance between the user vehicle and the target vehicle based on the first position information and the second position information.

[0051] The collection, storage, use, processing, transmission, provision, and disclosure of financial data or user data involved in the technical solution of this application all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0052] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.

[0053] Figure 2 This is a flowchart of a vehicle distance detection method provided in an embodiment of this application. This embodiment addresses the problem that calculating the distance to a target vehicle is inefficient because it requires feature extraction from two images and identification of the target vehicle within those images. The method in this embodiment is applied to a vehicle distance detection device, which can be located within an electronic device. This electronic device can be equipped with an intelligent driving system.

[0054] like Figure 2 As shown, the specific steps of this method are as follows:

[0055] Step S101: Obtain the image to be detected captured by the detection camera, and obtain the auxiliary image captured by the auxiliary camera.

[0056] In this embodiment, two monocular cameras can be pre-installed in parallel on the user vehicle, or a binocular camera consisting of two cameras can be installed on the user vehicle. This embodiment does not limit the choice.

[0057] Specifically, one of the two cameras installed on the user's vehicle can be designated as the detection camera, and the other camera can be designated as the auxiliary camera.

[0058] In this embodiment, the detection camera and the auxiliary camera can be controlled to acquire images synchronously, or the auxiliary camera can be controlled to acquire auxiliary images after step S102 is executed to determine that a target vehicle exists in the image to be detected.

[0059] Step S102: Use image recognition technology to determine the target vehicle in the image to be detected.

[0060] Step S103: Determine the first position information of the target vehicle in the image to be detected.

[0061] Specifically, image recognition technology can be used to determine whether a vehicle exists in the image to be detected. If a vehicle is found to exist, it can be identified as the target vehicle. After identifying the target vehicle in the image to be detected, its initial position information within the image can be determined.

[0062] The embodiments of this application do not limit the image recognition technology used. For example, feature extraction can be used to determine whether the image to be detected exists, template matching-based recognition technology can be used to determine whether the image to be detected exists, machine learning-based recognition technology can be used, etc.

[0063] Step S104: Determine the second position information of the target vehicle in the auxiliary image based on the first position information.

[0064] In this embodiment of the application, after determining the first location information of the target vehicle in the image to be detected, the area in the auxiliary image corresponding to the first location information can be determined as the area where the target vehicle is located, thereby determining the second location information of the target vehicle.

[0065] Step S105: Calculate the distance to the target vehicle based on the first location information, the second location information, and the installation spacing of the detection camera and the auxiliary camera.

[0066] In this embodiment of the application, after installing the detection camera and the auxiliary camera, the installation distance between the detection camera and the auxiliary camera can be obtained.

[0067] This application does not limit the method of calculating the distance to the target vehicle based on the first location information, the second location information, and the installation spacing of the detection camera and the auxiliary camera. For example, the distance to the target vehicle can be calculated using the principle of binocular stereo vision measurement.

[0068] In this embodiment, after determining the distance to the target vehicle, decisions can be made based on the distance, such as bypassing the vehicle, changing the route, and controlling the speed. Alternatively, the user can be prompted with the distance to the target vehicle.

[0069] The vehicle distance detection method provided in this application acquires a detection image captured by a detection camera and an auxiliary image captured by an auxiliary camera; uses image recognition technology to determine the target vehicle in the detection image; determines the first position information of the target vehicle in the detection image; determines the second position information of the target vehicle in the auxiliary image based on the first position information; and calculates the distance to the target vehicle based on the first position information, the second position information, and the installation distance between the detection camera and the auxiliary camera. By detecting the target vehicle in the detection image and determining the second position information of the target vehicle in the auxiliary image based on the first position information of the target vehicle, the target vehicle can be detected by image recognition in only one image, reducing the consumption of computing resources and improving the efficiency of acquiring the position information of the target vehicle in two images, thereby shortening the time for calculating the distance to the target vehicle.

[0070] The following example illustrates how the first and second location information of a target vehicle are determined.

[0071] Optionally, one way to implement step S104, which determines the second location information of the target vehicle in the auxiliary image based on the first location information, may include the following steps:

[0072] Step S201: Use edge detection technology to determine the horizontal and vertical edge lines of the objects to be classified in the image to be detected.

[0073] Step S202: Use a multi-level discrete wavelet transform algorithm to extract the classification features of the object to be classified based on the horizontal and vertical edge lines of the object to be classified.

[0074] Step S203: Use a vehicle classifier to determine whether the category of the object to be classified is a vehicle based on classification features.

[0075] Step S204: Identify the objects to be classified as vehicles as target vehicles.

[0076] Specifically, edge detection technology is used to process the image to be detected by identifying the horizontal and vertical edges of the object to be classified in the image. The region between the two horizontal and two vertical edges is defined as the region of the object to be classified. A multi-level discrete wavelet transform algorithm is used to extract classification features from the region image of the object to be classified. The extracted classification features are then input into a vehicle classifier to determine whether the object to be classified is a vehicle.

[0077] The vehicle classifier can be a trained machine learning classifier such as AdaBoost or a Support Vector Machine (SVM) classifier; this application does not limit the vehicle classifier used. It should be understood that the classification features in this application correspond to the vehicle classifier. For example, if the vehicle classifier is a trained Haar classifier, then the Haar features of the object to be classified are extracted as the classification features of the object. Alternatively, methods other than multi-level discrete wavelet transform algorithms can be used to extract the classification features of the object to be classified.

[0078] The vehicle distance detection method provided in this application uses edge detection technology to determine the horizontal and vertical edge lines of the object to be classified in the image to be detected; it uses a multi-level discrete wavelet transform algorithm to extract the classification features of the object to be classified based on the horizontal and vertical edge lines; it uses a vehicle classifier to determine whether the category of the object to be classified is a vehicle based on the classification features; and it identifies the object to be classified as a vehicle as the target vehicle, which can improve the efficiency and accuracy of identifying the target vehicle.

[0079] Optionally, the closer the vehicle is to the user, the lower the vehicle's position is in the image to be detected. Since priority needs to be given to the vehicle closest to the user, if there are multiple objects to be classified as vehicles, the distance between the lower horizontal edge of each object to be classified as a vehicle and the lower edge of the image to be detected can be determined. The object to be classified as a vehicle with the smallest distance between its lower horizontal edge and the lower edge of the image to be detected is identified as the target vehicle.

[0080] Optionally, one way to implement step S103 of determining the first position information of the target vehicle in the image to be detected may include:

[0081] Step S205: Determine the abscissa and ordinate of the target vehicle in the image to be detected based on the horizontal and vertical edge lines of the target vehicle in the image to be detected, and determine the abscissa and ordinate of the target vehicle in the image to be detected as the first position information.

[0082] For example, one way to determine the x-coordinate and y-coordinate of a target vehicle in an image to be detected is to: obtain the x-coordinate of the vertical edge line in the coordinate system of the image to be detected, and determine the average of the x-coordinates of the two vertical edge lines as the x-coordinate of the target vehicle in the image to be detected; obtain the y-coordinate of the horizontal edge line in the coordinate system of the image to be detected, and determine the average of the y-coordinates of the two horizontal edge lines as the y-coordinate of the target vehicle in the image to be detected.

[0083] The vehicle distance detection method provided in this application determines the horizontal and vertical coordinates of the target vehicle in the image to be detected based on the horizontal and vertical edge lines of the target vehicle in the image to be detected, and determines the horizontal and vertical coordinates of the target vehicle in the image to be detected as the first position information. It does not require calculating the horizontal and vertical coordinates of the target vehicle in the image to be detected based on the specific outline of the target vehicle, which can simplify the calculation process and improve the efficiency of determining the first position information.

[0084] Optionally, one way to implement step S104, which determines the second location information of the target vehicle in the auxiliary image based on the first location information, may include the following steps:

[0085] Step S206: Use edge detection technology to determine the horizontal and vertical edge lines of the object to be matched in the auxiliary image.

[0086] Step S207: If it is determined that the vertical coordinate of the target vehicle in the first position information is included between the two horizontal edge lines of a certain object to be matched, then the object to be matched is determined as a pending object.

[0087] Step S208: Determine the target vehicle from the objects to be determined, and determine the abscissa and ordinate of the target vehicle in the auxiliary image based on the horizontal and vertical edge lines of the target vehicle in the auxiliary image, and determine the abscissa and ordinate of the target vehicle in the auxiliary image as the second position information.

[0088] In this embodiment, the coordinate system of the auxiliary image and the coordinate system of the image to be detected can be established at the center of the image, which can ensure that the vertical coordinate of the same object in the auxiliary image is the same as the vertical coordinate in the image to be detected.

[0089] Specifically, the ordinates of the two horizontal edge lines of an object to be matched can be determined. If the ordinate of the target vehicle in the first location information is less than one of the ordinates of the two horizontal edge lines of the object to be matched, but greater than the other ordinate, then the object to be matched can be determined as an object to be determined. It can be determined that the target vehicle is in the object to be determined, or that the target vehicle does not exist in the auxiliary image.

[0090] If the target vehicle can be determined from the object to be determined, then the horizontal and vertical coordinates of the target vehicle in the auxiliary image can be determined based on the horizontal and vertical edge lines of the target vehicle in the auxiliary image, and the horizontal and vertical coordinates of the target vehicle in the auxiliary image can be determined as the second position information.

[0091] In this embodiment of the application, the method of determining the second location information after determining the target vehicle in the auxiliary image is similar to the method of determining the first location information after determining the target vehicle in the image to be detected, and will not be described in detail here.

[0092] The method provided in this application uses edge detection technology to determine the horizontal and vertical edge lines of objects to be matched in an auxiliary image. If it is determined that the vertical coordinate of a target vehicle in the first location information is included between the two horizontal edge lines of an object to be matched, then the object to be matched is determined as a pending object. The target vehicle is determined from the pending objects, and the horizontal and vertical coordinates of the target vehicle in the auxiliary image are determined based on the horizontal and vertical edge lines of the target vehicle in the auxiliary image. The horizontal and vertical coordinates of the target vehicle in the auxiliary image are then determined as the second location information. This method can determine pending objects that may be target vehicles based on the vertical coordinates in the first location information, reducing the number of objects to be matched that need to be compared, saving computational resources, and improving matching efficiency.

[0093] Optionally, if there is only one object to be determined, then the object to be determined is identified as the target vehicle in the auxiliary image; if there are multiple objects to be determined, then the object whose lengths of both the vertical and horizontal edge lines match those of the target vehicle in the image to be detected is identified as the target vehicle.

[0094] This application does not limit the method of determining whether the edge line lengths match. For example, the edge line length of each object to be determined can be divided by the edge line length of the target vehicle in the image to be detected. If the calculation result is within a preset threshold range, the edge length can be determined to match. If it is determined that the lengths of the vertical and horizontal edge lines of an object to be determined match the lengths of the target vehicle in the image to be detected, the object to be determined can be identified as the target vehicle.

[0095] The vehicle distance detection method provided in this application determines the target vehicle in the auxiliary image if there is only one object to be identified; if there are multiple objects to be identified, the object whose vertical and horizontal edge lengths match those of the target vehicle in the image to be detected is identified as the target vehicle. By using the already acquired vertical and horizontal edge lines to determine the target vehicle, no further image processing is required, thus improving the efficiency of identifying the target vehicle in the auxiliary image.

[0096] The following example illustrates one method for calculating the distance to a target vehicle. It should be understood that the detection camera and auxiliary camera in this example are zoom cameras. When acquiring the detection image and auxiliary image, it is necessary to focus on the target vehicle, which may include the following steps:

[0097] Step S301: Obtain the image to be detected captured by the detection camera, and use image recognition technology to determine the target vehicle in the image to be detected.

[0098] Step S302: Control the detection camera to focus on the target vehicle and acquire the image to be detected, and obtain the updated image to be detected.

[0099] Step S303: Control the auxiliary camera to acquire auxiliary images at the focal length after the detection camera has focused, and obtain the auxiliary images acquired by the auxiliary camera.

[0100] After acquiring the focused image to be detected and the auxiliary image, the first position information and the second position information can be determined, and the distance to the target vehicle can be calculated using the method provided in the embodiments of this application. The method for calculating the distance to the target vehicle specifically includes:

[0101] Step S401: Determine the distance P1 between the target vehicle in the image to be detected and the right edge of the image to be detected based on the first position information, and determine the distance P2 between the target vehicle in the auxiliary image and the left edge of the auxiliary image based on the second position information.

[0102] Step S402: Substitute the installation distances of P1, P2, the detection camera, and the auxiliary camera into the following vehicle distance calculation formula to calculate the distance to the target vehicle.

[0103] In this embodiment of the application, the vehicle distance calculation formula is as follows:

[0104]

[0105] Where ω1 represents the angle of the detection camera's viewpoint, ω2 represents the angle of the auxiliary camera's viewpoint, H1 represents the horizontal dimension of the image to be detected, H2 represents the horizontal dimension of the auxiliary image, β1 represents the angle adjacent to the detection camera's viewpoint, and β2 represents the angle of the angle adjacent to the detection camera's viewpoint. h is the distance to the target vehicle, P1 is the distance between the target vehicle in the image to be detected and the right edge of the image to be detected, and P2 is the distance between the target vehicle in the auxiliary image and the left edge of the auxiliary image.

[0106] Figure 3 This is a schematic diagram illustrating the vehicle distance calculation formula in the embodiments of this application, as shown below. Figure 3As shown, both the detection camera and the auxiliary camera are horizontally mounted with a spacing of A, and a distance h from the target vehicle. B represents the distance between the target vehicle and the detection camera, and C represents the distance between the target vehicle and the auxiliary camera. α, Let θ represent the triangular angle formed by the target vehicle and the two cameras. Since the detection camera and the auxiliary camera are already in focus, H1 and H2 represent the horizontal dimensions of the images captured by the first and second cameras, respectively, and H1 and H2 are known.

[0107] The following is the derivation process of the vehicle distance calculation formula provided in the embodiments of this application:

[0108] Formula (1) can be obtained from trigonometric functions:

[0109]

[0110] Based on the law of sinusoids, we can obtain formula (2):

[0111]

[0112] By replacing the expression for B in formula (1) with formula (2), we can obtain formula (3):

[0113]

[0114] From formula (3), it can be seen that in order to calculate the distance h, we should find the parameters A, α, in formula (3). And θ, where A is a known parameter. Based on the relationship between the angles, the following formula can be easily obtained:

[0115]

[0116]

[0117] θ=O2+β2 (6)

[0118]

[0119]

[0120] Where O1 represents the angle from the detection camera pointing to the target vehicle's position, and O2 represents the angle from the auxiliary camera pointing to the vehicle's position. We can obtain:

[0121]

[0122]

[0123] Based on formulas (3) to (10), the formula for calculating vehicle distance is:

[0124]

[0125] Specifically, after determining the first position information, the abscissa of the right edge of the image to be detected can be determined based on its position in the corresponding coordinate system within the image to be detected. Based on the abscissa of the right edge of the detected image and the abscissa in the first position information, the distance P1 between the target vehicle in the image to be detected and the right edge of the image to be detected can be calculated. Calculating the distance between the target vehicle in the auxiliary image and the left edge of the auxiliary image is similar to calculating P1. After determining P1 and P2, P1 and P2 are substituted into the vehicle distance calculation formula, and the calculation result is determined as the distance to the target vehicle. Other parameters in the vehicle distance calculation formula are known parameters or parameters that can be calculated from known parameters. For example, the horizontal dimension of the image can be obtained by calculating the focal length and the angle of the camera's viewpoint.

[0126] The vehicle distance detection method provided in this application update the image to be detected and acquire an auxiliary image after focusing on the target vehicle. It can determine the distance between the target vehicle and the right edge of the image to be detected and the distance between the target vehicle and the left edge of the auxiliary image, thereby calculating the distance to the target vehicle and improving the accuracy of the calculated distance to the target vehicle.

[0127] Optionally, embodiments of this application also provide a method for determining the installation distance between the detection camera and the auxiliary camera, specifically including the following steps:

[0128] Step S501: Acquire the first calibration image and the second calibration image captured by the detection camera and the auxiliary camera at the corrected focal length.

[0129] Step S502: Determine the image width of the overlapping portion of the first calibration image and the second calibration image.

[0130] Step S503: Calculate the installation distance between the detection camera and the auxiliary camera by detecting the angle of view of the camera and the auxiliary camera, correcting the focal length, and the image width of the overlapping part.

[0131] Specifically, after acquiring the first calibration image and the second calibration image, image recognition technology can be used to determine the overlapping part of the first calibration image and the second calibration image, thereby determining the image width of the overlapping part. The horizontal dimension of the calibration image can be calculated based on the correction focal length of the auxiliary camera and the angle of view of the camera. The calculation result of subtracting the image width of the overlapping part from the horizontal dimension of the calibration image is determined as the installation distance between the detection camera and the auxiliary camera.

[0132] This application does not limit the triggering method for detecting the installation distance between the camera and the auxiliary camera. Exemplarily, the installation distance between the camera and the auxiliary camera can be detected when the user's vehicle is started, or the user can manually trigger the detection of the installation distance between the camera and the auxiliary camera. The installation distance between the camera and the auxiliary camera can be calibrated, thereby improving the accuracy of the determined distance to the target vehicle.

[0133] Figure 4 This is a schematic diagram of the vehicle distance detection device provided in an embodiment of this application. The vehicle distance detection device provided in this embodiment can execute the processing flow provided in the vehicle distance detection method embodiment. Figure 4 As shown, the vehicle distance detection device 60 includes: an acquisition module 601, an identification module 602, a determination module 603, a matching module 604, and a calculation module 605.

[0134] Specifically, the acquisition module 601 is used to acquire the image to be detected captured by the detection camera and to acquire the auxiliary image captured by the auxiliary camera;

[0135] The recognition module 602 is used to identify the target vehicle in the image to be detected using image recognition technology.

[0136] The determination module 603 is used to determine the first position information of the target vehicle in the image to be detected.

[0137] The matching module 604 is used to determine the second position information of the target vehicle in the auxiliary image based on the first position information.

[0138] The calculation module 605 is used to calculate the distance to the target vehicle based on the first location information, the second location information, and the installation spacing between the detection camera and the auxiliary camera.

[0139] The apparatus provided in this application embodiment can be specifically used to execute the method embodiment provided in Embodiment 1 above, and the specific functions will not be repeated here.

[0140] Optionally, the identification module 602 is specifically used for:

[0141] Edge detection technology is used to determine the horizontal and vertical edge lines of the objects to be classified in the image to be detected; a multi-level discrete wavelet transform algorithm is used to extract the classification features of the objects to be classified based on the horizontal and vertical edge lines; a vehicle classifier is used to determine whether the category of the objects to be classified is a vehicle based on the classification features; and objects to be classified as vehicles are identified as target vehicles.

[0142] Optionally, the determining module 603 is specifically used to: determine the abscissa and ordinate of the target vehicle in the image to be detected based on the horizontal and vertical edge lines of the target vehicle in the image to be detected, and determine the abscissa and ordinate of the target vehicle in the image to be detected as the first position information.

[0143] Optionally, the matching module 604 is specifically used to: determine the horizontal and vertical edge lines of the object to be matched in the auxiliary image using edge detection technology; if it is determined that the vertical coordinate of the target vehicle in the first position information is included between the two horizontal edge lines of a certain object to be matched, then the object to be matched is determined as the object to be determined; determine the target vehicle from the object to be determined, and determine the horizontal and vertical coordinates of the target vehicle in the auxiliary image based on the horizontal and vertical edge lines of the target vehicle in the auxiliary image, and determine the horizontal and vertical coordinates of the target vehicle in the auxiliary image as the second position information.

[0144] Optionally, the matching module 604 is specifically used to: if it is determined that there is only one object to be determined, then the object to be determined is identified as the target vehicle in the auxiliary image; if it is determined that there are multiple objects to be determined, then the object to be determined whose lengths of both the vertical edge line and the horizontal edge line match the target vehicle in the image to be detected is identified as the target vehicle.

[0145] Optionally, the acquisition module 601 is specifically used to: control the detection camera to focus on the target vehicle and acquire the image to be detected, and acquire the updated image to be detected; control the auxiliary camera to acquire the auxiliary image according to the focal length after the detection camera is focused, and acquire the auxiliary image acquired by the auxiliary camera;

[0146] The calculation module 605 is specifically used for: determining the distance P1 between the target vehicle in the image to be detected and the right edge of the image to be detected based on the first position information, and determining the distance P2 between the target vehicle in the auxiliary image and the left edge of the auxiliary image based on the second position information; substituting P1, P2, and the installation spacing of the detection camera and the auxiliary camera into the following vehicle distance calculation formula to calculate the distance to the target vehicle, the vehicle distance calculation formula is:

[0147]

[0148] Where ω1 represents the angle of the detection camera's view, ω2 represents the angle of the auxiliary camera's view, H1 represents the horizontal dimension of the image to be detected, H2 represents the horizontal dimension of the auxiliary image, β1 represents the angle adjacent to the detection camera's view, β2 represents the angle of the angle adjacent to the detection camera's view, and A represents the installation distance between the detection camera and the auxiliary camera.

[0149] Optionally, the vehicle distance detection device 60 further includes: a distance verification module; the distance verification module is used to: acquire a first calibration image and a second calibration image captured by the detection camera and the auxiliary camera at the corrected focal length; determine the image width of the overlapping part of the first calibration image and the second calibration image; and calculate the installation distance between the detection camera and the auxiliary camera by the angle of view of the detection camera and the auxiliary camera, the corrected focal length, and the image width of the overlapping part.

[0150] The apparatus provided in this application embodiment can be specifically used to execute the above method embodiments, and its specific functions will not be described in detail here.

[0151] Figure 5 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application, such as... Figure 5 As shown, this application also provides an electronic device 70, including: a processor 701, and a memory 702 and a transceiver 703 communicatively connected to the processor 701. The memory 702 stores computer-executable instructions; the transceiver 703 is used for sending and receiving data; and the processor 701 executes the computer-executable instructions stored in the memory 702.

[0152] Specifically, the program may include program code, which includes computer-executable instructions. Memory 702 may include high-speed RAM, and may also include non-volatile memory, such as at least one disk storage device. The computer-executable instructions are stored in memory 702 and configured to be executed by processor 701 to implement the method provided in any embodiment of this application. Related descriptions can be understood by referring to the relevant descriptions and effects corresponding to the steps in the accompanying drawings, and will not be elaborated upon here.

[0153] In this embodiment, the memory 702 and the processor 701 are connected via a bus. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 5 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0154] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method provided in any embodiment of this application.

[0155] This application also provides a computer program product, including computer execution instructions, which, when executed by a processor, implement the method provided in any embodiment of this application.

[0156] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.

[0157] The modules described as separate components may or may not be physically separate. Similarly, the components shown as modules may or may not be physical modules; they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment, depending on actual needs.

[0158] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated module can be implemented in hardware or in a combination of hardware and software functional modules.

[0159] The program code used to implement the methods of this application may be written in any combination of one or more programming languages. This program code may be provided to the processor or controller of a general-purpose computer, special-purpose computer, or other programmable full-path fusion device, such that when executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0160] In the context of this application, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0161] Furthermore, although the operations are described in a specific order, this should be understood as requiring that such operations be performed in the specific order shown or in sequential order, or requiring that all illustrated operations be performed to achieve the desired result. In certain environments, multitasking and parallel processing may be advantageous. Similarly, although several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this application. Certain features described in the context of individual embodiments may also be implemented in combination in a single implementation. Conversely, various features described in the context of a single implementation may also be implemented individually or in any suitable sub-combination in multiple implementations.

[0162] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.

[0163] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.

Claims

1. A vehicle distance detection method characterized by comprising: The method comprises the following steps: acquiring a to-be-detected image collected by a detection camera and acquiring an auxiliary image collected by an auxiliary camera; determining a target vehicle in the to-be-detected image by using image recognition technology; determining the horizontal coordinate and the vertical coordinate of the target vehicle in the to-be-detected image based on the horizontal edge line and the vertical edge line of the target vehicle in the to-be-detected image, and determining the horizontal coordinate and the vertical coordinate of the target vehicle in the to-be-detected image as first position information; determining the horizontal edge line and the vertical edge line of a to-be-matched object in the auxiliary image by using edge detection technology; if it is determined that the vertical coordinate of the target vehicle in the first position information is included between two horizontal edge lines of a certain to-be-matched object, then the to-be-matched object is determined as a to-be-determined object; if it is determined that the to-be-determined object is one, then the to-be-determined object is determined as the target vehicle in the auxiliary image; if it is determined that the to-be-determined object is multiple, then the to-be-determined object matching the target vehicle in the to-be-detected image is determined as the target vehicle based on the length of the vertical edge line and the length of the horizontal edge line, and the horizontal coordinate and the vertical coordinate of the target vehicle in the auxiliary image are determined based on the horizontal edge line and the vertical edge line of the target vehicle in the auxiliary image, and the horizontal coordinate and the vertical coordinate of the target vehicle in the auxiliary image are determined as second position information; determining the distance P1 between the target vehicle and the right edge of the to-be-detected image based on the first position information, and determining the distance P2 between the target vehicle and the left edge of the auxiliary image based on the second position information, and calculating the distance to the target vehicle based on the P1, the P2 and the installation distance between the detection camera and the auxiliary camera.

2. The method of claim 1, wherein, The method of determining the target vehicle in the to-be-detected image by using image recognition technology comprises the following steps: determining the horizontal edge line and the vertical edge line of a to-be-classified object in the to-be-detected image by using edge detection technology; extracting classification features of the to-be-classified object based on the horizontal edge line and the vertical edge line of the to-be-classified object by using a multi-level discrete wavelet transform algorithm; determining whether the category of the to-be-classified object is a vehicle based on the classification features by using a vehicle classifier; determining the to-be-classified object with the category of a vehicle as the target vehicle.

3. The method according to claim 1 or 2, characterized in that, After the method of determining the target vehicle in the to-be-detected image by using image recognition technology, the method comprises the following steps: controlling the detection camera to focus on the target vehicle and collect the to-be-detected image, and acquiring an updated to-be-detected image; The method of acquiring the auxiliary image collected by the auxiliary camera comprises the following steps: controlling the auxiliary camera to collect the auxiliary image at the focal length after the detection camera focuses, and acquiring the auxiliary image collected by the auxiliary camera; The method of calculating the distance to the target vehicle based on the P1, the P2 and the installation distance between the detection camera and the auxiliary camera comprises the following steps: substituting the P1, the P2 and the installation distance between the detection camera and the auxiliary camera into the following vehicle distance calculation formula to calculate the distance to the target vehicle, the vehicle distance calculation formula is: wherein, 1 represents the angle of the detection camera view angle, 2 represents the angle of the auxiliary camera view angle, H1 represents the horizontal dimension of the image to be detected, and H2 represents the horizontal dimension of the auxiliary image, represents the angle adjacent to the detection camera view angle, represents the angle adjacent to the detection camera view angle, and A represents the installation distance of the detection camera and the auxiliary camera.

4. The method according to claim 1 or 2, characterized in that, Before the method of calculating the distance to the target vehicle based on the first position information, the second position information and the installation distance between the detection camera and the auxiliary camera, the method comprises the following steps: acquiring a first calibration image and a second calibration image collected by the detection camera and the auxiliary camera at a correction focal length; determining an image width of the overlapped part of the first calibration image and the second calibration image; calculating the installation distance of the detection camera and the auxiliary camera by detecting the angle of the view of the camera and the auxiliary camera, the corrected focal length, and the image width of the overlapped part.

5. A vehicle distance detecting device characterized by comprising: The method comprises the steps of: obtaining a detection image collected by a detection camera and an auxiliary image collected by an auxiliary camera; recognizing a target vehicle in the detection image by using image recognition technology; determining the horizontal and vertical edge lines of the target vehicle in the detection image, and determining the horizontal and vertical coordinates of the target vehicle in the detection image as first position information; determining the horizontal and vertical edge lines of the target vehicle in the auxiliary image by using edge detection technology; if the vertical coordinate of the target vehicle in the first position information is included between the two horizontal edge lines of a certain matching object, the matching object is determined as a pending object; if the pending object is one, the pending object is determined as the target vehicle in the auxiliary image; if the pending object is more than one, the pending object matching the target vehicle in the detection image is determined as the target vehicle according to the length of the horizontal and vertical edge lines; and determining the horizontal and vertical coordinates of the target vehicle in the auxiliary image based on the horizontal and vertical edge lines of the target vehicle in the auxiliary image, and determining the horizontal and vertical coordinates of the target vehicle in the auxiliary image as second position information; calculating the distance P1 between the target vehicle and the right edge of the detection image based on the first position information, and calculating the distance P2 between the target vehicle and the left edge of the auxiliary image based on the second position information, and calculating the distance to the target vehicle based on the P1, P2, and the installation distance of the detection camera and the auxiliary camera.

6. An electronic device, comprising: The method comprises the steps of: a processor, a memory, and a transceiver connected to the processor; the memory stores computer execution instructions; the transceiver is used for transmitting and receiving data; the processor executes the computer execution instructions stored in the memory to realize the method of any one of claims 1-4.

7. A computer readable storage medium characterized by The computer readable storage medium stores computer execution instructions, and the computer execution instructions are executed by the processor to realize the method of any one of claims 1-4.

Citation Information

Patent Citations

  • Vacant parking space detection method and system based on binocular stereo vision

    CN107767687A

  • Method for detecting pedestrian in front of vehicle and obtaining human vehicle distance based on binocular vision

    CN110231013A

  • Vehicle distance measurement system and method based on MobileNet-SSD

    CN111723778A