Vehicle distance measurement method and device, storage medium, processor and vehicle
By deploying multiple image acquisition devices in front of the vehicle and using the principle of similar geometry to calculate the vehicle distance, the problems of slow speed and low accuracy in vehicle distance measurement are solved, and high-precision vehicle distance measurement is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA FAW CO LTD
- Filing Date
- 2023-06-27
- Publication Date
- 2026-07-24
AI Technical Summary
Existing vehicle distance measurement methods suffer from low measurement accuracy and slow measurement speed. In particular, monocular vision measurement methods have large errors in complex scenarios, while deep learning methods have high accuracy but are slow.
At least two image acquisition devices are used to acquire image data of the light-emitting device, determine the position coordinates of the center point of the light-emitting device in the image coordinate system, calculate the vehicle distance based on the principle of similar geometry, and determine the vehicle spacing through proportional relationship and included angle.
While ensuring the measurement speed, the accuracy of vehicle distance measurement has been improved, solving the problems of slow measurement speed and low accuracy.
Smart Images

Figure CN116774200B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of vehicle technology, and more specifically, to a method, apparatus, storage medium, processor, and vehicle for measuring vehicle distance. Background Technology
[0002] Currently, monocular vision measurement methods are commonly used to measure the distance between vehicles. The measurement principles are mainly divided into two types: similarity geometry and deep learning. Among them, the measurement principle based on similarity geometry has a relatively simple algorithm, so the measurement speed is faster, but the error is larger and it is not suitable for complex scenarios. The measurement principle based on deep learning has higher measurement accuracy and is applicable to more scenarios, but due to the more complex algorithm, it has the technical problem of slower measurement speed.
[0003] There is currently no effective solution to the technical problems of low accuracy and slow speed in vehicle distance measurement. Summary of the Invention
[0004] This invention provides a method, apparatus, storage medium, processor, and vehicle for measuring vehicle distance, thereby addressing at least the technical problems of low accuracy and slow measurement speed in vehicle distance measurement.
[0005] According to one aspect of the invention, a method for measuring vehicle distance is provided. The method may include: acquiring image data of a light-emitting device acquired by at least two image acquisition devices, wherein the at least two image acquisition devices are deployed in front of the current vehicle, and the light-emitting device is deployed at the rear of the vehicle in front of the current vehicle; determining the position coordinates of the center point of the light-emitting device in an image coordinate system from the image data; determining the geometric distance from the pixel point imaged by the center point in the at least two image acquisition devices to the center of the image acquisition devices based on the position coordinates; determining a proportional relationship between the geometric distance and the geometric distance between the light-emitting device and the at least two image acquisition devices; and determining the distance between the current vehicle and the vehicle in front based on the proportional relationship and the angle between the line connecting the light-emitting device and the at least two image acquisition devices.
[0006] Optionally, before determining the position coordinates of the center point of the light-emitting device in the image coordinate system, the method further includes: performing grayscale processing on the image data to obtain a grayscale image corresponding to the image data; performing adaptive threshold processing on the grayscale image to obtain a binary image, wherein the binary image includes multiple candidate regions, each of which corresponds to edge information, and the edge information includes at least the geometric length information of the candidate region, the position coordinate information of the center point of the candidate region, and the pixel information of the candidate region; and determining the edge information of the light-emitting device from the edge information corresponding to the multiple candidate regions.
[0007] Optionally, determining the edge information of the light-emitting device from the edge information corresponding to multiple candidate regions includes: selecting a target region from multiple candidate regions based on the discrimination conditions of the light-emitting device, wherein the target region is the image region corresponding to the light-emitting device in the binary image, and the discrimination conditions include at least the aspect ratio of the light-emitting device, the region width of the light-emitting device, the region height of the light-emitting device, and the numerical range corresponding to the average pixel of the light-emitting device; and determining the edge information corresponding to the target region as the edge information of the light-emitting device.
[0008] Optionally, based on the position coordinates, determining the geometric distance from the pixel point of the center point in at least two image acquisition devices to the center of the image acquisition device includes: determining the imaging distance from the pixel point of the center point of the light-emitting device in at least two image acquisition devices to the center of the imaging plane of the image acquisition device; and determining the geometric distance from the pixel point of the center point in at least two image acquisition devices to the center of the image acquisition device based on the imaging distance and the focal length of the image acquisition device.
[0009] Optionally, determining the distance between the current vehicle and the vehicle ahead based on the proportional relationship and the angle between the light-emitting device and the line connecting the light-emitting device and at least two image acquisition devices includes: determining the vertical distance between the light-emitting device and the camera plane of the at least two image acquisition devices based on the proportional relationship; and determining the distance between the current vehicle and the vehicle ahead based on the trigonometric function value of the vertical distance and the angle between the light-emitting device and the line connecting the at least two image acquisition devices.
[0010] Optionally, the method further includes: determining the position coordinates of the corner points of multiple candidate regions in the image coordinate system, and the sum of the pixels of the multiple candidate regions in the binary image; and determining the edge information corresponding to the multiple candidate regions based on the position coordinates of the corner points of the multiple candidate regions in the image coordinate system and the sum of the pixels of the multiple candidate regions in the binary image.
[0011] According to one aspect of the present invention, a vehicle distance measuring device is provided. The device may include: an acquisition unit for acquiring image data of a light-emitting device acquired by at least two image acquisition devices, wherein the at least two image acquisition devices are deployed in front of the current vehicle, and the light-emitting array is deployed at the rear of the vehicle in front of the current vehicle; a first determining unit for determining the position coordinates of the center point of the light-emitting device in an image coordinate system from the image data; a second determining unit for determining the geometric distance from the pixel point imaged by the center point in the at least two image acquisition devices to the center of the image acquisition devices based on the position coordinates; a third determining unit for determining a proportional relationship between the geometric distance and the geometric distance between the light-emitting device and the at least two image acquisition devices based on similarity geometry principles; and a fourth determining unit for determining the distance between the current vehicle and the vehicle in front based on the proportional relationship and the angle between the line connecting the light-emitting device and the at least two image acquisition devices.
[0012] According to another aspect of the present invention, a computer-readable storage medium is also provided, the computer-readable storage medium including a stored program, wherein, when the program is run by a processor, it controls the device where the storage medium is located to execute any of the methods in the embodiments of the present invention.
[0013] According to another aspect of the present invention, a processor is also provided. The processor is used to run a program, wherein the program, when running, performs the method of any one of the embodiments of the present invention.
[0014] According to another aspect of the present invention, a vehicle is also provided. This vehicle is used to perform the method of any one of the embodiments of the present invention.
[0015] In this embodiment of the invention, image data of a light-emitting device acquired by at least two image acquisition devices are obtained. The at least two image acquisition devices are deployed in front of the current vehicle, and the light-emitting device is deployed at the rear of the vehicle in front of the current vehicle. The position coordinates of the center point of the light-emitting device in the image coordinate system are determined from the image data. Based on the position coordinates, the geometric distance from the pixel of the center point imaged by the at least two image acquisition devices to the center of the image acquisition devices is determined. The proportional relationship between the geometric distance and the geometric distance between the light-emitting device and the at least two image acquisition devices is determined. Based on the proportional relationship and the angle between the line connecting the light-emitting device and the at least two image acquisition devices, the distance between the current vehicle and the vehicle in front is determined. In other words, in this embodiment of the invention, image data of the light-emitting device is acquired using at least two image acquisition devices, and the position coordinates of the center point of the light-emitting device in the image coordinate system are determined. The distance between vehicles is determined based on the position coordinates and the principle of similar geometry. Vehicle distance measurement is performed based on the principle of similar geometry. This improves measurement accuracy while ensuring measurement speed, achieving the technical effect of improving both measurement speed and accuracy, and solving the technical problems of slow vehicle distance measurement speed and low measurement accuracy. Attached Figure Description
[0016] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this invention, illustrate exemplary embodiments of the invention and are used to explain the invention, but do not constitute an undue limitation of the invention. In the drawings:
[0017] Figure 1 This is a flowchart of a method for measuring vehicle distance according to an embodiment of the present invention;
[0018] Figure 2 This is a schematic diagram of an RGB image conversion process according to an embodiment of the present invention;
[0019] Figure 3 This is a schematic diagram of an LED array according to an embodiment of the present invention;
[0020] Figure 4 This is a schematic diagram of a vehicle-to-vehicle distance measurement system according to an embodiment of the present invention;
[0021] Figure 5 This is a flowchart of a method for measuring vehicle distance according to an embodiment of the present invention;
[0022] Figure 6 This is a schematic diagram of a vehicle distance measuring device according to an embodiment of the present invention. Detailed Implementation
[0023] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0024] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0025] Example 1
[0026] According to an embodiment of the present invention, a method for measuring vehicle distance is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0027] The method for measuring vehicle distance according to an embodiment of the present invention will be described below.
[0028] Figure 1 This is a flowchart of a vehicle distance measurement method according to an embodiment of the present invention, such as... Figure 1 As shown, the method may include the following steps:
[0029] Step S101: Acquire image data of the light-emitting device acquired by at least two image acquisition devices.
[0030] In the technical solution provided in step S101 of the present invention, at least two image acquisition devices are deployed in front of the current vehicle, for example, at the position of the vehicle's headlights. These at least two image acquisition devices can be CMOS image acquisition devices. A light-emitting device is deployed at the rear of the current vehicle, for example, at the position of the vehicle's taillights. This light-emitting device can be a light-emitting diode (LED) array. This is merely an illustrative example and does not limit the type of image acquisition device or the type of light-emitting device.
[0031] In this embodiment, the light-emitting device can act as a transmitter to send light information. While transmitting the light signal, the diagonal LEDs of the light-emitting device can remain constantly lit to ensure that the edges of the light-emitting device can be detected. At least two image acquisition devices can act as receivers to acquire image data from the light-emitting device.
[0032] Optionally, an optical filter can be configured in front of the lens of the image acquisition device to form a narrowband filter camera, so that when the image acquisition device acquires image data of the light-emitting device, stray light projected onto the image sensor of the image acquisition device is eliminated.
[0033] Optionally, since the image data acquired by the image acquisition device includes not only image data of the light-emitting device but also image data of background noise, the image acquisition device can preprocess the image data after acquiring the image data of the light-emitting device. For example, the image data can be converted into a grayscale image, and adaptive thresholding can be performed on the grayscale image to obtain a binary image. Then, matrix dilation and erosion processing can be performed on the binary image to obtain multiple candidate regions. These multiple candidate regions include the image region of the light-emitting device and the image region of the background noise. Each candidate region corresponds to edge information, wherein the edge information includes at least the region width, region height, position coordinates of the center point of the candidate region, and average pixel value of the candidate region.
[0034] Optionally, after obtaining multiple candidate regions, the discrimination conditions for the light-emitting device can be further determined. The discrimination conditions are used to determine the image region corresponding to the light-emitting device among the multiple candidate regions. The discrimination conditions include at least the numerical range of parameters such as the aspect ratio of the light-emitting device, the width of the image region corresponding to the light-emitting device, the height of the image region corresponding to the light-emitting device, and the average pixel count of the image region corresponding to the light-emitting device.
[0035] For example, assuming the light-emitting device consists of a×b LEDs, and the spacing between adjacent LEDs is equal, the array shape of the light-emitting device can be a matrix with an aspect ratio of . Because LEDs produce a halo effect when emitting light, the aspect ratio of the light-emitting device can be set to [specific value]. Between. Alternatively, the range of values for the width of the light-emitting device's area can be determined by the width of the image region corresponding to the light-emitting device when the vehicle spacing is minimal, and the width of the image region corresponding to the light-emitting device when the vehicle spacing is maximum. For example, assuming the width of the image region corresponding to the light-emitting device when the vehicle spacing is minimal is W. max When the distance between vehicles is at its maximum, the width of the image area corresponding to the light-emitting device is W. min Based on this, the numerical range of the region width of the light-emitting device can be determined as [W]. min W max Additionally, let the height of the image captured by the image acquisition device be H. image Since the light-emitting device is usually positioned in the center of the image when acquiring its image data, the range of values for the ordinate of the center point of the image region corresponding to the light-emitting device can be determined as follows: Furthermore, since the diagonal LEDs of the light-emitting device are constantly lit, after matrix dilation processing, the bright spots will fill the entire image area corresponding to the light-emitting device. Therefore, the average pixel value P of the image area corresponding to the light-emitting device can be calculated. TAH The value was initially set to 255. However, during actual image acquisition, the light-emitting device may be obstructed, causing the LED at a certain point to be uncaptured. Therefore, the average pixel value P of the image area corresponding to the light-emitting device can be set to... TAH ≥200.
[0036] Optionally, after determining the discrimination criteria for the image region corresponding to the light-emitting device, the discrimination criteria can be used to determine the image region corresponding to the light-emitting device from multiple candidate regions.
[0037] For example, as described above, each candidate region corresponds to edge information. The edge information includes at least the region width, region height, position coordinates of the center point of the candidate region, and average pixel value of the candidate region. Based on this, a candidate region whose region width, center point coordinates, and average pixel value are in the discrimination criteria of the light-emitting device can be determined from multiple candidate regions, and this candidate region is determined as the image region corresponding to the light-emitting device. Since multiple candidate regions correspond to edge information, the edge information corresponding to the determined candidate region can be determined as the edge information corresponding to the light-emitting device.
[0038] Step S102: Determine the position coordinates of the center point of the light-emitting device in the image coordinate system from the image data.
[0039] In the technical solution provided by step S102 of the present invention, after determining the image region corresponding to the light-emitting device and the edge information of the light-emitting device from the image data, the position coordinates of the center point of the light-emitting device in the image coordinate system can be determined from the edge information of the light-emitting device.
[0040] For example, as described above, the edge information includes at least the region width, region height, position coordinates of the center point of the candidate region, and average pixel value of the candidate region. Based on this, after determining the image region corresponding to the light-emitting device from multiple candidate regions, the position coordinates of the center point of the region can be obtained from the edge information corresponding to that region.
[0041] Step S103: Based on the position coordinates, determine the geometric distance from the pixel point of the center point in at least two image acquisition devices to the center of the image acquisition device.
[0042] In the technical solution provided by step S103 of the present invention, after determining the position coordinates of the center point of the light-emitting device in the image coordinates, the geometric distance from the pixel point of the center point of the light-emitting device to the center of the two image acquisition devices can be determined respectively.
[0043] In this embodiment, a rectangular coordinate system can be established with the center point of the imaging plane of at least two image acquisition devices as the origin. Based on this, after determining the position coordinates of the center point of the light-emitting device, the distance from the pixel point of the light-emitting device imaged in the image acquisition device to the center point of the imaging plane of the image acquisition device can be determined by the following formula.
[0044]
[0045]
[0046] Where r1 and r2 can be used to represent the distances from the center point of the light-emitting device to the center point of the imaging plane of the image acquisition device, respectively. Ch1 Y Ch1 ) and (X Ch2 Y Ch2 These can be used to represent the position coordinates of the pixel points imaged by the center point of the light-emitting device in the two image acquisition devices.
[0047] Optionally, after determining the distance from the pixel point of the center point of the light-emitting device in the image acquisition device to the center point of the imaging plane of the image acquisition device, the geometric distance from the pixel point of the center point of the light-emitting device in the two image acquisition devices to the two image acquisition devices can be further determined by the following formula.
[0048]
[0049]
[0050] Where a and b can be used to represent the geometric distance from the pixel point of the center point of the light-emitting device in the two image acquisition devices to the center point of the camera plane of the two image acquisition devices, r1 and r2 can be used to represent the distance from the pixel point of the center point of the light-emitting device in the image acquisition device to the center point of the imaging plane of the image acquisition device, and f is the focal length of the image acquisition device.
[0051] Step S104: Determine the proportional relationship between the geometric distance and the geometric distance between at least two image acquisition devices of the light-emitting device.
[0052] In the technical solution provided by step S104 of the present invention, after determining the geometric distance from the pixel point of the center point of the light-emitting device to the two image acquisition devices, the proportional relationship between the geometric distance and the geometric distance from the light-emitting device to the two image acquisition devices can be determined based on the principle of similar geometry.
[0053] In this embodiment, the geometrical distance between the pixel point of the center point of the light-emitting device in the two image acquisition devices and the geometrical distance between the light-emitting device and the two image acquisition devices can be determined by the following formula.
[0054]
[0055]
[0056] Where h represents the vertical distance from the light-emitting device to the camera plane of the image acquisition device, f represents the focal length of the image acquisition device, d1 and d2 represent the distances between the light-emitting device and the imaging planes of the two image acquisition devices, a and b represent the geometric distances from the pixel points of the center point of the light-emitting device in the two image acquisition devices to the center points of the camera planes of the two image acquisition devices, and r1 and r2 represent the distances from the pixel points of the center point of the light-emitting device in the image acquisition devices to the center points of the imaging planes of the image acquisition devices. Figure 4 As shown, OA can be used to represent the distance between the point of the light-emitting device on the camera plane of an image acquisition device and the center point of the camera plane of an image acquisition device, which is closer to the light-emitting device. OB can be used to represent the distance between the point of the light-emitting device on the camera plane of an image acquisition device and the center point of the camera plane of an image acquisition device, which is farther from the light-emitting device.
[0057] After determining the above proportional relationship, the vertical distance h from the light-emitting device to the camera plane of the two image acquisition devices can be determined by the following formula.
[0058]
[0059] Where h can represent the vertical distance from the light-emitting device to the camera plane of the image acquisition device, D can represent the distance between two image acquisition devices, f can represent the focal length of the image acquisition device, and r1 and r2 can respectively represent the distance from the pixel point of the center point of the light-emitting device in the image acquisition device to the center point of the imaging plane of the image acquisition device.
[0060] Step S105: Based on the proportional relationship and the angle between the light-emitting device and the line connecting at least two image acquisition devices, determine the distance between the current vehicle and the vehicle in front.
[0061] In the technical solution provided by step S105 of the present invention, after determining the proportional relationship, the distance between the current vehicle and the vehicle in front can be determined based on the proportional relationship and the angle between the light-emitting device and the line connecting at least two image acquisition devices.
[0062] In this embodiment, the angle between the line connecting the light-emitting device and at least two image acquisition devices is used to indicate the angle between the line connecting the light-emitting device and the two image acquisition devices and the perpendicular line from the light-emitting device to the camera plane of the two image acquisition devices. For example, the angle can be expressed as α and β.
[0063] Alternatively, after determining the included angle, the distance from the light-emitting device to the two image acquisition devices can be determined based on the following formula.
[0064]
[0065]
[0066] Where d1 and d2 represent the distances from the light-emitting device to the imaging planes of the two image acquisition devices, respectively, and h can be used to represent the vertical distance between the light-emitting device and the camera plane of the image acquisition device.
[0067] After determining the distance from the light-emitting device to the two image acquisition devices, the distance between the current vehicle and the vehicle in front of the current vehicle can be determined using the following formula.
[0068]
[0069] Where, d AIt can be used to represent the distance between the current vehicle and the vehicle in front, d1 and d2 are used to represent the distance from the light-emitting device to the imaging plane of the two image acquisition devices, respectively, and D can be used to represent the distance between the two image acquisition devices.
[0070] In steps S101 to S105 of this invention, image data of the light-emitting device is acquired by at least two image acquisition devices, wherein the at least two image acquisition devices are deployed in front of the current vehicle, and the light-emitting device is deployed at the rear of the vehicle in front of the current vehicle. In the image data, the position coordinates of the center point of the light-emitting device in the image coordinate system are determined. Based on the position coordinates, the geometric distance from the pixel of the center point imaged by the at least two image acquisition devices to the center of the image acquisition devices is determined. The proportional relationship between the geometric distance and the geometric distance between the light-emitting device and the at least two image acquisition devices is determined. Based on the proportional relationship and the angle between the line connecting the light-emitting device and the at least two image acquisition devices, the distance between the current vehicle and the vehicle in front is determined. In other words, in this embodiment of the invention, image data of the light-emitting device is acquired by at least two image acquisition devices, and the position coordinates of the center point of the light-emitting device in the image coordinate system are determined. The distance between vehicles is determined based on the position coordinates and the principle of similar geometry. Vehicle distance measurement is performed based on the principle of similar geometry, improving measurement accuracy while ensuring measurement speed. This achieves the technical effect of improving both measurement speed and measurement accuracy, solving the technical problems of slow vehicle distance measurement speed and low measurement accuracy.
[0071] The method described in this embodiment will be further described below.
[0072] As an optional embodiment, before determining the position coordinates of the center point of the light-emitting device in the image coordinate system in step S102, the method further includes: performing grayscale processing on the image data to obtain a grayscale image corresponding to the image data; performing adaptive threshold processing on the grayscale image to obtain a binary image, wherein the binary image includes multiple candidate regions, each of which corresponds to edge information, and the edge information includes at least the geometric length information of the candidate region, the position coordinate information of the center point of the candidate region, and the pixel information of the candidate region; and determining the edge information of the light-emitting device from the edge information corresponding to the multiple candidate regions.
[0073] In this embodiment, after acquiring the image data of the light-emitting device from the two image acquisition devices, since the image data includes not only the image data of the light-emitting device but also the image data of background noise, the image data can be preprocessed to determine the edge information of the light-emitting device.
[0074] For example, image data can be processed into grayscale to obtain a grayscale image corresponding to the image data of the light-emitting device. Then, adaptive thresholding is performed on the grayscale image to obtain a binary image. The binary image includes multiple candidate regions, which include the image region corresponding to the light-emitting device and the image region corresponding to the background noise. Each candidate region has edge information, which includes at least the geometric length information of the candidate region, the position coordinate information of the center point of the candidate region, and the pixel information of the candidate region. The geometric length information of the candidate region is used to represent the region length and region width of the candidate region. The position coordinate information of the center point of the candidate region is used to represent the position coordinate of the center point of the candidate region in the image coordinate system of the binary image. The pixel information of the candidate region is used to represent the average value of the pixel values corresponding to multiple pixels in the candidate region.
[0075] Optionally, after determining multiple candidate regions, the image region of the light-emitting device can be determined from these multiple candidate regions based on the discrimination conditions corresponding to the image region of the light-emitting device.
[0076] As an optional embodiment, determining the edge information of the light-emitting device from the edge information corresponding to multiple candidate regions includes: selecting a target region from multiple candidate regions based on the discrimination conditions of the light-emitting device, wherein the target region is the image region corresponding to the light-emitting device in the binary image, and the discrimination conditions include at least the aspect ratio of the light-emitting device, the region width of the light-emitting device, the region height of the light-emitting device, and the numerical range corresponding to the average pixel of the light-emitting device; and determining the edge information corresponding to the target region as the edge information of the light-emitting device.
[0077] In this embodiment, when determining the image region corresponding to the light-emitting device from multiple candidate regions, the discrimination conditions of the image region corresponding to the light-emitting device can be determined first, and then the target region can be selected from multiple candidate regions based on the discrimination conditions. The target region is the image region corresponding to the light-emitting device in the binary image.
[0078] For example, assuming the light-emitting device consists of a×b LEDs, and the spacing between adjacent LEDs is equal, the array shape of the light-emitting device can be a matrix with an aspect ratio of . Considering that LED light emission produces a halo, the aspect ratio of the light-emitting device can be determined to be located at [location missing]. Between. Alternatively, the range of the light-emitting device's area width in the image data can be determined by the area width of the light-emitting device in the image data when the vehicle spacing is minimal, and the area width of the light-emitting device in the image data when the vehicle spacing is maximum. For example, assuming the area width of the light-emitting device in the image data when the vehicle spacing is minimal is W. maxWhen the distance between vehicles is at its maximum, the width of the area of the light-emitting device in the image data is W. min Based on this, the width of the light-emitting device can be determined to be located in [W]. min W max Between ] . Additionally, the image acquisition device can be configured to capture images at a height of H. image Since the light-emitting device is usually positioned in the center of the image when acquiring its image data, the ordinate of the center point of the image area of the light-emitting device can be located at... Between. Additionally, since the diagonal LEDs of the light-emitting device are constantly lit, after matrix dilation processing, the bright spots will fill the entire image area corresponding to the light-emitting device. Therefore, the average pixel value P of the image area corresponding to the light-emitting device can be... TAH The value was initially set at 255. However, during actual image acquisition, the light-emitting device may be obstructed, causing a certain positioning LED to fail to capture. Therefore, the average pixel value P of the image area corresponding to the light-emitting device can be set to... TAH ≥200.
[0079] After determining the numerical ranges of the aspect ratio of the light-emitting device, the numerical range of the width of the light-emitting device, the numerical range of the ordinate of the center point of the image area of the light-emitting device, and the numerical range of the average pixel value of the image area corresponding to the light-emitting device, the determined numerical ranges can be used as the discrimination criteria for the image area of the light-emitting device.
[0080] Optionally, after determining the discrimination conditions for the image region of the light-emitting device, a target region can be selected from multiple candidate regions based on the discrimination conditions, and the edge information corresponding to the target region can be determined as the edge information of the light-emitting device.
[0081] As an optional embodiment, step S103, based on the position coordinates, determines the geometric distance from the pixel point of the center point in at least two image acquisition devices to the center of the image acquisition device, including: determining the imaging distance from the pixel point of the center point of the light-emitting device in at least two image acquisition devices to the center of the imaging plane of the image acquisition device; and determining the geometric distance from the pixel point of the center point in at least two image acquisition devices to the center of the image acquisition device based on the imaging distance and the focal length of the image acquisition device.
[0082] In this embodiment, after determining the position coordinates of the pixel points imaged by the center point of the light-emitting device in at least two image acquisition devices, the imaging distance from the pixel points imaged by the center point of the light-emitting device in the image acquisition devices to the center point of the imaging plane of the image acquisition devices can be determined by the following formula.
[0083]
[0084]
[0085] Where r1 and r2 can be used to represent the distance from the center point of the light-emitting device to the center point of the imaging plane of the image acquisition device, respectively. Ch1 Y Ch1 ) and (X Ch2 Y Ch2 These can be used to represent the position coordinates of the pixel points imaged by the center point of the light-emitting device in two image acquisition devices.
[0086] As an optional embodiment, step S105, determining the distance between the current vehicle and the vehicle in front based on the proportional relationship and the angle between the light-emitting device and the line connecting the light-emitting device and at least two image acquisition devices, includes: determining the vertical distance between the light-emitting device and the camera plane of the at least two image acquisition devices based on the proportional relationship; and determining the distance between the current vehicle and the vehicle in front based on the trigonometric function value of the vertical distance and the angle between the light-emitting device and the line connecting the at least two image acquisition devices.
[0087] In this embodiment, after determining the distance from the pixel point imaged by the center point of the light-emitting device in the image acquisition device to the center point of the imaging plane of the image acquisition device, the geometric distance from the pixel point imaged by the center point of the light-emitting device in the two image acquisition devices to the two image acquisition devices can be further determined by the following formula.
[0088]
[0089]
[0090] Where a and b can be used to represent the geometric distance from the pixel point of the center point of the light-emitting device in the two image acquisition devices to the center point of the camera plane of the two image acquisition devices, r1 and r2 can be used to represent the distance from the pixel point of the center point of the light-emitting device in the image acquisition device to the center point of the imaging plane of the image acquisition device, and f can be used to represent the focal length of the image acquisition device.
[0091] After determining the geometric distance from the pixel of the center point of the light-emitting device to the two image acquisition devices, the proportional relationship between this geometric distance and the geometric distance from the light-emitting device to the two image acquisition devices can be determined based on the principle of similar geometry.
[0092] In this embodiment, the geometric distance between the pixel point of the center point of the light-emitting device in the two image acquisition devices and the geometric distance between the light-emitting device and at least two image acquisition devices can be determined by the following formula.
[0093]
[0094]
[0095] Where h represents the vertical distance from the light-emitting device to the camera plane of the image acquisition device, f is the focal length of the image acquisition device, d1 and d2 represent the distances between the light-emitting device and the imaging planes of the two image acquisition devices, a and b represent the geometric distances from the pixel points of the center point of the light-emitting device in the two image acquisition devices to the camera planes of the two image acquisition devices, and r1 and r2 represent the distances from the pixel points of the center point of the light-emitting device in the image acquisition devices to the center point of the imaging plane of the image acquisition devices, such as... Figure 4 As shown, OA can be used to represent the distance between the point corresponding to the light-emitting device on the camera plane of an image acquisition device and the camera plane of another image acquisition device, while OB can be used to represent the distance between the point corresponding to the light-emitting device on the camera plane of an image acquisition device and the camera plane of another image acquisition device, while OB can be used to represent the distance between the point corresponding to the light-emitting device on the camera plane of another ...
[0096] After determining the above proportional relationship, the vertical distance h from the light-emitting device to the camera plane of the two image acquisition devices can be determined by the following formula.
[0097]
[0098] Where h can represent the vertical distance from the light-emitting device to the camera plane of the image acquisition device, D can be used to represent the distance between two image acquisition devices, and r1 and r2 are used to represent the distance from the pixel point of the center point of the light-emitting device in the image acquisition device to the center point of the imaging plane of the image acquisition device.
[0099] Optionally, after determining the proportional relationship, the distance between the current vehicle and the vehicle in front can be determined based on the proportional relationship and the angle between the light-emitting device and the line connecting at least two image acquisition devices.
[0100] In this embodiment, the angle between the line connecting the light-emitting device and at least two image acquisition devices is used to indicate the angle between the line connecting the light-emitting device and the two image acquisition devices and the perpendicular line from the LED to the camera plane of the two image acquisition devices. For example, the angle can be expressed as α, β.
[0101] Alternatively, after determining the included angle, the distance from the light-emitting device to the two image acquisition devices can be determined based on the following formula.
[0102]
[0103]
[0104] Where d1 and d2 represent the distances from the light-emitting device to the imaging planes of the two image acquisition devices, respectively, and h can be used to represent the vertical distance between the light-emitting device and the camera plane of the image acquisition device.
[0105] After determining the distance from the light-emitting device to the two image acquisition devices, the distance between the current vehicle and the vehicle in front of the current vehicle can be determined using the following formula.
[0106]
[0107] Where, d A It can be used to represent the distance between the current vehicle and the vehicle in front, d1 and d2 are used to represent the distance from the light-emitting device to the imaging plane of the two image acquisition devices, respectively, and D can be used to represent the distance between the two image acquisition devices.
[0108] As an optional embodiment, the method further includes: determining the position coordinates of the corner points of multiple candidate regions in the image coordinate system, and the sum of the pixels of the multiple candidate regions in the binary image; and determining the edge information corresponding to the multiple candidate regions based on the position coordinates of the corner points of the multiple candidate regions in the image coordinate system and the sum of the pixels of the multiple candidate regions in the binary image.
[0109] In this embodiment, since the binary image includes multiple candidate regions, each candidate region corresponds to edge information. When determining the edge information corresponding to multiple candidate regions, the position coordinates of the corner points of each candidate region can be determined first, for example, the upper left corner and the lower right corner of the candidate region. Additionally, the pixel sum corresponding to each candidate region in the binary image can be determined, where the pixel sum represents the sum of the pixel values of each pixel point in the candidate region in the binary image. After determining the corner coordinates of the candidate regions, the region width and region height of each candidate region can be determined based on the corner coordinates, and the position coordinates of the region center point of each candidate region can be determined based on the region width and region height. Furthermore, the average pixel count of each candidate region in the binary image can be determined based on the sum of the pixel values of each candidate region.
[0110] For example, suppose the coordinates of the top-left corner points in multiple candidate regions are (X... min1 Y min1 ), (X min2 Y min2 ), ..., (X) minm Y minm The coordinates of the lower right corner point are (X... max1 Ymax1 ), (X max2 Y max2 ), ..., (X) maxm Y maxm Based on this, the width and height of each candidate region can be determined using the following formula:
[0111]
[0112] Among them, W h H can be used to represent the width of a candidate region. h This can be used to represent the height of a candidate region. After determining the width W of each candidate region... h and area height H h Then, the coordinates of the center point of each candidate region can be determined using the following formula.
[0113]
[0114] Among them, X ch The x-coordinate, Y, can be used to represent the x-coordinate of the center point of the candidate region. ch It can be used to represent the ordinate of the center point of the candidate region.
[0115] Optionally, let the sum of pixels of each candidate region in the binary image be P. T1 P T2 ... P Tm The average number of pixels in each candidate region in a binary image can be determined using the following formula.
[0116]
[0117] Among them, P TAh W can be used to represent the average number of pixels in a candidate region in a binary image. h H can be used to represent the width of a candidate region. h It can be used to represent the height of a candidate region, where h = 1, 2, 3, ..., m.
[0118] After determining the region width, region height, region center point coordinates, and average pixel count in the binary image for each candidate region, these parameters can be used as the edge information for each candidate region.
[0119] Example 2
[0120] The technical solutions of the embodiments of the present invention will be illustrated below with reference to preferred embodiments.
[0121] Currently, monocular vision measurement methods are commonly used to measure distances between vehicles. These methods are based on two principles: similarity geometry and deep learning. While similarity geometry algorithms are relatively simple and fast, they suffer from significant measurement errors and are unsuitable for complex scenarios. Deep learning-based algorithms offer higher accuracy and are applicable to a wider range of scenarios, but their complexity results in slower measurement speeds.
[0122] Therefore, to solve the above problems, the present invention provides a method for measuring vehicle distance. This method involves deploying two image acquisition devices in front of the current vehicle to collect image data during the illumination period of the vehicle's rear end. The method then determines the position coordinates of the center point of the light-emitting device in the image coordinate system based on the acquired image data. Next, based on the position coordinates of the center point of the light-emitting device, the geometric distance between the pixels imaged by the center point of the light-emitting device in the two image acquisition devices and the center of each image acquisition device is determined. Furthermore, based on the principle of similarity geometry, the proportional relationship between the geometric distance between the pixels imaged by the center point of the light-emitting device in the two image acquisition devices and the geometric distance between the light-emitting device and at least two image acquisition devices is determined. Finally, based on this proportional relationship and the angle between the lines connecting the light-emitting device and at least two image acquisition devices, the distance between the current vehicle and the vehicle in front is determined. In other words, in this embodiment of the invention, two image acquisition devices are used to acquire image data of the light-emitting device. Since the light-emitting device has the advantages of long transmission distance, large transmission range and strong anti-interference ability, it can cope with complex road scenarios. Moreover, based on binocular vision measurement, the similar geometry principle is used to calculate the vehicle distance. While retaining the measurement speed, the measurement accuracy is improved, thus achieving the technical effect of improving the measurement speed and measurement accuracy. This solves the technical problems of slow vehicle distance measurement speed and low measurement accuracy.
[0123] The method for measuring vehicle distance according to an embodiment of the present invention will be further described below.
[0124] In this embodiment of the invention, an LED array is used to transmit light signals, and a CMOS image sensor is used as a photodetector to receive the light signals to achieve distance measurement between vehicles. The LED array can be an a×b array, and it can use the 808nm light wave band. It is installed at the taillight position of the car as a transmitter. When transmitting light signals, the diagonal LEDs of the LED array can remain constantly lit to detect the edges of the LED array. The receiver uses two CMOS cameras to process the received images containing the LED array. It should be noted that since the LED array uses the 808nm light wave band, a narrowband filter camera can be formed by configuring an 808nm optical filter in front of the camera lens to eliminate stray light projected onto the image sensor.
[0125] In this embodiment, the narrowband filter camera can acquire images of the LED array and process the acquired images to obtain edge information of the LED array.
[0126] For example, Figure 2 This is a schematic diagram illustrating an RGB image conversion process according to an embodiment of the present invention, such as... Figure 2 As shown, the captured red, green, and blue (RGB) image can be converted into a grayscale image. Then, the grayscale image is binarized to obtain a binary image. Matrix collision and erosion processing are then performed on the binary image to obtain candidate regions G1, G2, G3, ... G1, G2, G3, ... G2, G3, G4, G5, G6, G7, G8, G9, G1, G1, G2, G3, ... ... m .
[0127] After obtaining multiple candidate regions, let the coordinates of the top-left corner of each candidate region be (X... min1 Y min1 ), (X min2 Y min2 ), ..., (X) minm Y minm The coordinates of the lower right corner point are (X... max1 Y max1 ), (X max2 Y max2 ), ..., (X) maxm Y maxm Then, the width and height of each candidate region can be determined using the following formula:
[0128]
[0129] Among them, W h H can be used to represent the width of a candidate region. hThis can be used to represent the height of a candidate region. After determining the width W of each candidate region... h and area height H h Then, the coordinates of the center point of each candidate region can be determined using the following formula.
[0130]
[0131] Among them, X ch The x-coordinate, Y, can be used to represent the x-coordinate of the center point of the candidate region. ch It can be used to represent the ordinate of the center point of the candidate region.
[0132] Optionally, let the sum of pixels of each candidate region in the binary image be P. T1 P T2 ... P Tm The average number of pixels in each candidate region in a binary image can be determined using the following formula.
[0133]
[0134] Among them, P TAh W can be used to represent the average number of pixels in a candidate region in a binary image. h H can be used to represent the width of a candidate region. h It can be used to represent the height of a candidate region, where h = 1, 2, 3, ..., m.
[0135] Optionally, after determining each candidate region in the binary image, the image region corresponding to the LED array can be selected from multiple candidate regions in the binary image based on the discrimination criteria of the LED array.
[0136] For example, since an LED array uses a×b LEDs with equal spacing between adjacent LEDs, the shape of the LED array should be a matrix with an aspect ratio of . Considering the halo effect produced by LED light emission, the aspect ratio of the LED array is... Should be in Between. To minimize the vehicle spacing, the area width of the LED array in the captured image is W. max The width of the area where the vehicle spacing is at its maximum is W. min The width W of the LED array region in the image can be determined. h It should be located in W min ~W max Between. Let the height of the captured image be H. image When the vehicle is driving normally, the LED array should be in the center of the image. Therefore, let the ordinate Y of the LED array be... ch It should be located in Between. Due to the constant diagonal lights in the LED array, after rectangular dilatation and erosion processing, the bright spots should fill the entire area, meaning the average pixel value should be P. TAh =255. Considering that due to occlusion, the LED at a certain point may not be captured, let P = 255. TAh ≥200. Based on the above criteria, a selection process is performed to determine the image region corresponding to the LED array within each candidate region, and the region height H of the image region corresponding to the LED array is obtained. LP and area width W LP The coordinates of the top left corner (X) LPmin Y LPmin Edge information such as )
[0137] Figure 3 This is a schematic diagram illustrating the discrimination criteria for an LED array according to an embodiment of the present invention, wherein the discrimination criteria include: the aspect ratio of the LED array. The area width of the LED array (W) h ):W min ≤W h ≤W max The area height (Y) of the LED array ch ): The average pixel count (P) of the LED array in a binary image TAh ):P TAH ≥200. Based on this discrimination condition, the image region corresponding to the LED array can be determined from multiple candidate regions.
[0138] After determining the discrimination criteria for the LED array, the image region corresponding to the LED array can be selected from multiple candidate regions contained in the binary image based on these criteria. Since each candidate region corresponds to edge information, which includes at least the region width, region height, the position coordinates of the region center point, and the average pixel count of the corresponding image region, the position coordinates (X, Y, X) of the center point of the selected image region can be determined based on the edge information of the selected region. CH1 Y Ch1 ) and (X Ch2 Y Ch2 ), and calculate the distance between vehicles based on the determined position coordinates.
[0139] Figure 4 This is a schematic diagram of a vehicle-to-vehicle distance measurement system according to an embodiment of the present invention, as shown below. Figure 4As shown, LED indicates the position of the LED array, I and J indicate the positions of the two CMOS cameras, f represents the focal length of the CMOS camera, D represents the distance between the two CMOS cameras, p1 and p2 represent the pixels of the LED array center point in the imaging planes of the two CMOS cameras, r1 and r2 represent the distances from the pixels of the LED array center point in the CMOS camera to the center point of the CMOS camera's imaging plane, a and b represent the geometric distances from the pixels of the LED array center point in the two CMOS cameras to the center points of the camera planes of the two CMOS cameras, D represents the distance between the two CMOS cameras, and d1 and d2 represent the distances from the LED array to the imaging planes of the two CMOS cameras. A The distance between the current vehicle and the vehicle in front is represented by α and β, which are the angles between the line connecting the LED array and the two CMOS cameras and the perpendicular lines from the LED array to the planes of the two CMOS cameras, respectively. h can be used to represent the vertical distance between the LED array and the camera planes of the two CMOS cameras. OA is used to represent the distance between the point on the CMOS camera plane corresponding to the LED array and the center point of the camera plane of the CMOS camera that is closer to it. OB can be used to represent the distance between the point on the CMOS camera plane corresponding to the LED array and the center point of the camera plane of the CMOS camera that is farther away from it.
[0140] As described above, the position coordinates (X, X) of the center point of the image area corresponding to the LED array are... CH1 Y Ch1 ) and (X Ch2 Y Ch2 Based on this, the imaging distance from the center point of the LED array to the center point of the imaging plane of the CMOS camera can be determined by the following formula.
[0141]
[0142]
[0143] Where r1 and r2 represent the distances from the center point of the LED array to the center point of the imaging plane of the CMOS camera, respectively.
[0144] Optionally, after determining the distance between the pixel point of the LED array imaged in the CMOS camera and the center point of the imaging plane of the CMOS camera, the geometric distance between the pixel point of the LED array imaged in the two CMOS cameras and the center point of the camera plane of the two CMOS cameras can be determined by the following formula.
[0145]
[0146]
[0147] Where a and b represent the geometric distances from the pixel points of the LED array's center point in the two CMOS cameras to the center points of the camera planes of the two CMOS cameras, respectively, and r1 and r2 represent the distances from the pixel points of the LED array's center point in the CMOS cameras to the center points of the CMOS camera's imaging planes, respectively.
[0148] After determining the geometric distance from the pixel point of the LED array's center point in the two CMOS cameras to the center point of the camera plane of the two CMOS cameras, the proportional relationship between this geometric distance and the geometric distance from the LED array to the center point of the camera plane of the two CMOS cameras can be determined based on the principle of similar geometry.
[0149] In this embodiment, the geometrical distance between the pixel point of the LED array's center point in the two CMOS cameras and the center point of the camera plane of the two CMOS cameras can be determined by the following formula, and the proportional relationship between the geometrical distance between the LED array and the center point of the camera plane of the two CMOS cameras.
[0150]
[0151]
[0152] Where h represents the vertical distance from the LED array to the camera plane of the CMOS camera, f represents the focal length of the CMOS camera, d1 and d2 represent the distances from the LED array to the imaging planes of the two CMOS cameras, a and b represent the geometric distances from the pixel points of the LED array's center point in the two CMOS cameras to the center points of the camera planes of the two CMOS cameras, and r1 and r2 represent the distances from the pixel points of the LED array's center point in the CMOS cameras to the center points of the imaging planes of the CMOS cameras. Figure 4 As shown, OA represents the distance between the point of the LED array on the CMOS camera plane and the center point of the camera plane of a CMOS camera that is closer to it, while OB can be used to represent the distance between the point of the LED array on the CMOS camera plane and the center point of the camera plane of a CMOS camera that is farther away.
[0153] After determining the above proportional relationship, the vertical distance h from the LED array to the camera plane of the two CMOS cameras can be determined by the following formula.
[0154]
[0155] Where h can represent the vertical distance from the LED array to the camera plane of the CMOS camera, D can represent the distance between two CMOS cameras, f can represent the focal length of the CMOS camera, and r1 and r2 can represent the distance from the pixel point of the LED array imaged in the CMOS camera to the center point of the CMOS camera's imaging plane, respectively.
[0156] Optionally, after determining the proportional relationship, the distance between the current vehicle and the vehicle in front can be determined based on the proportional relationship and the angle between the line connecting the LED array and at least two CMOS cameras.
[0157] In this embodiment, the angle between the line connecting the LED array and the two CMOS cameras is used to indicate the angle between the line connecting the LED array and the two CMOS cameras and the perpendicular line from the LED array to the camera plane of the two CMOS cameras. For example, the angle can be expressed as α and β.
[0158] Alternatively, after determining the included angle, the distance from the LED array to the two CMOS cameras can be determined based on the following formula.
[0159]
[0160]
[0161] Where d1 and d2 represent the distances from the LED array to the imaging planes of the two CMOS cameras, respectively, and h can be used to represent the vertical distance between the LED array and the camera planes of the two CMOS cameras.
[0162] After determining the distance between the LED array and the two CMOS cameras, the distance between the current vehicle and the vehicle in front of it can be determined using the following formula.
[0163]
[0164] Where, d A It can be used to represent the distance between the current vehicle and the vehicle in front, d1 and d2 are used to represent the distance from the LED array to the imaging plane of the two CMOS cameras respectively, and D can be used to represent the distance between the two CMOS cameras.
[0165] Figure 5 This is a flowchart of a vehicle distance measurement method according to an embodiment of the present invention, such as... Figure 5 As shown, the method includes the following steps:
[0166] Step S501: The narrowband filter camera captures an image of the LED array.
[0167] In this embodiment, two CMOS cameras can be used as image acquisition devices to capture images of the LED array. Narrowband filter cameras can be formed by configuring 808nm optical filters in front of the two CMOS cameras respectively, so as to eliminate stray light projected onto the image sensor when acquiring images of the LED array.
[0168] Step S502 involves performing grayscale processing, binarization, matrix dilation, erosion, and other operations on the image to form several candidate regions containing the LED array and other noise.
[0169] In this embodiment, after acquiring the image of the LED array, a series of processing steps can be performed on the acquired image to obtain several candidate regions containing the LED array and other noise. For example, grayscale processing, binarization, matrix dilation, erosion processing, and other operations can be performed on the image.
[0170] Step S503: Calculate the aspect ratio, width, center height, and average pixel count of each candidate region in the binary image.
[0171] In this embodiment, after obtaining several candidate regions containing LED arrays and other noise, the aspect ratio, width, center height, and average pixel count of each candidate region in the binary image can be calculated by referring to the method described above.
[0172] Step S504: Determine whether the candidate region is the image region corresponding to the LED array.
[0173] In this embodiment, after determining each candidate region in the binary image, it can be determined whether each candidate region is the image region corresponding to the LED array based on the discrimination condition of the LED array. If not, it means that the region is the region corresponding to noise, and the following step S505 is executed to remove the noise region from the binary image; if so, the following step S506 is executed.
[0174] Step S505: Remove the noisy region from the image.
[0175] In this embodiment, if a region is determined not to be the image region corresponding to the LED array based on the discrimination criteria of the LED array, it is indicated that the region is a noise region, and the region is removed from the binary image. Then, the image region of the LED array is determined from the remaining candidate regions based on the discrimination criteria of the LED array.
[0176] Step S506: Determine the edge information of the image area corresponding to the LED array, such as the area width, area height, and upper left corner coordinates.
[0177] In this embodiment, after determining the candidate region corresponding to the LED array from multiple candidate regions, the edge information such as the region width, region height, and upper left corner coordinates of the image region corresponding to the LED array can be determined based on the edge information corresponding to the determined candidate region.
[0178] Step S507: Calculate the position coordinates of the center point of the image area of the LED array obtained by the two cameras.
[0179] In this embodiment, after determining the edge information corresponding to the LED array, the position coordinates of the center point of the image region corresponding to the LED array can be obtained from the edge information.
[0180] Step S508: Calculate the distance from the pixel points of the LED array imaged by the two cameras to the center point of the imaging plane.
[0181] In this embodiment, after determining the position coordinates of the center point of the image area corresponding to the LED array, the distance from the pixel point of the LED array in the two cameras to the center point of the imaging plane can be further calculated. The specific calculation method can be referred to the description of step S103 above, and will not be repeated here.
[0182] Step S509: Calculate the distance between the camera and the imaging point of the LED array center on the imaging plane.
[0183] In this embodiment, the distance between the camera and the imaging point of the LED array center on the imaging plane can also be calculated. The specific calculation process can be referred to the description of step S103 above, and will not be repeated here.
[0184] Step S510: Calculate the distance between the LED array and the camera planes of the two cameras based on the principle of similar geometry.
[0185] In this embodiment, after determining the distance between the imaging point of the camera and the center of the LED array on the imaging plane, the distance between the LED array and the camera plane of the two cameras can also be calculated based on the principle of similar geometry. The specific calculation process can be referred to the description of the aforementioned step S104, which will not be repeated here.
[0186] Step S511: Calculate the angle between the line connecting the LED array to the two cameras and the midline of the line connecting the LED array to the two cameras.
[0187] In this embodiment, after calculating the distance between the LED array and the camera planes of the two cameras, the angle between the line connecting the LED array to the two cameras and the midline of the line connecting the LED array to the two cameras can also be calculated. The specific calculation process can be referred to the description of step S105 above, and will not be repeated here.
[0188] Step S512: Calculate the distance between the two vehicles.
[0189] In this embodiment, after determining the distance between the LED array and the camera planes of the two cameras, and the angle between the line connecting the LED array to the two cameras and the midline of the line connecting the two cameras, the distance between the two vehicles can be calculated with reference to the aforementioned step S105. This will not be repeated here.
[0190] Example 3
[0191] According to an embodiment of the present invention, a vehicle distance measuring device is provided. It should be noted that this vehicle distance measuring device can be used to perform a vehicle distance measuring method as described in Embodiment 1.
[0192] Figure 6 This is a schematic diagram of a vehicle distance measuring device according to an embodiment of the present invention. Figure 6 As shown, a vehicle distance measuring device 600 may include: an acquisition unit 601, a first determination unit 602, a second determination unit 603, a third determination unit 604, and a fourth determination unit 605.
[0193] The acquisition unit 601 is used to acquire image data of the light-emitting device acquired by at least two image acquisition devices, wherein the at least two image acquisition devices are deployed in front of the current vehicle, and the light-emitting device is deployed at the rear of the vehicle in front of the current vehicle.
[0194] The first determining unit 602 is used to determine the position coordinates of the center point of the light-emitting device in the image coordinate system in the image data.
[0195] The second determining unit 603 is used to determine the geometric distance from the center point of the pixel imaged in at least two image acquisition devices to the center of the image acquisition device based on the position coordinates.
[0196] The third determining unit 604 is used to determine the proportional relationship between the geometric distance and the geometric distance between at least two image acquisition devices of the light-emitting device;
[0197] The fourth determining unit 605 is used to determine the distance between the current vehicle and the vehicle in front based on the proportional relationship and the angle between the light-emitting device and the line connecting at least two image acquisition devices.
[0198] Optionally, the first determining unit 602 further includes: a first processing module, used to perform grayscale processing on the image data to obtain a grayscale image corresponding to the image data; a second processing module, used to perform adaptive threshold processing on the grayscale image to obtain a binary image, wherein the binary image includes multiple candidate regions, each of the multiple candidate regions corresponds to edge information, and the edge information includes at least the geometric length information of the candidate region, the position coordinate information of the center point of the candidate region, and the pixel information of the candidate region; and the first determining module, used to determine the edge information of the light-emitting device from the edge information corresponding to the multiple candidate regions.
[0199] Optionally, the first determining module further includes: a selection submodule, used to select a target region from multiple candidate regions based on the discrimination conditions of the light-emitting device, wherein the target region is the image region corresponding to the light-emitting device in the binary image, and the discrimination conditions include at least the aspect ratio of the light-emitting device, the region width of the light-emitting device, the region height of the light-emitting device, and the numerical range corresponding to the average pixels of the light-emitting device; and a determining submodule, used to determine the edge information corresponding to the target region as the edge information of the light-emitting device.
[0200] Optionally, the second determining unit 603 includes: a second determining module, configured to determine the imaging distance from the pixel point of the center point of the light-emitting device imaged in at least two image acquisition devices to the center of the imaging plane of the image acquisition device; and a third determining module, configured to determine the geometric distance from the pixel point of the center point imaged in at least two image acquisition devices to the center of the image acquisition device based on the imaging distance and the focal length of the image acquisition device.
[0201] Optionally, the fourth determining unit 605 includes: a fourth determining module, used to determine the vertical distance between the light-emitting device and the camera plane of at least two image acquisition devices based on a proportional relationship; and a fifth determining module, used to determine the distance between the current vehicle and the vehicle in front based on the trigonometric function value of the vertical distance and the angle between the line connecting the light-emitting device and the at least two image acquisition devices.
[0202] Optionally, the device 600 further includes: a fifth determining unit, configured to determine the position coordinates of the corner points of multiple candidate regions in the image coordinate system, and the sum of the pixels of the multiple candidate regions in the binary image; and a sixth determining unit, configured to determine the edge information corresponding to the multiple candidate regions based on the position coordinates of the corner points of the multiple candidate regions in the image coordinate system, and the sum of the pixels of the multiple candidate regions in the binary image.
[0203] In this embodiment, at least two image acquisition devices are used to acquire image data of the light-emitting device and determine the position coordinates of the center point of the light-emitting device in the image coordinate system. Based on the position coordinates and the principle of similar geometry, the distance between vehicles is determined. The vehicle distance is measured based on the principle of similar geometry. While ensuring the measurement speed, the measurement accuracy is improved, and the technical effects of improving the measurement speed and measurement accuracy are achieved. This solves the technical problems of slow vehicle distance measurement speed and low measurement accuracy.
[0204] Example 4
[0205] According to an embodiment of the present invention, a computer-readable storage medium is also provided, the computer-readable storage medium including a stored program, wherein, when the program is run by a processor, it controls the device where the readable storage medium is located to execute the vehicle distance measurement method of Embodiment 1.
[0206] Example 5
[0207] According to an embodiment of the present invention, a processor is also provided for running a program, wherein the program executes the vehicle distance measurement method of Embodiment 1 when it runs.
[0208] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0209] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0210] In the several embodiments provided by this invention, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed can be through some interfaces; the indirect coupling or communication connection of units or modules can be electrical or other forms.
[0211] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0212] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0213] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0214] The above are merely preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for measuring vehicle distance, characterized in that, include: Image data of the light-emitting device are acquired by at least two image acquisition devices, wherein the at least two image acquisition devices are deployed in front of the current vehicle, and the light-emitting device is deployed at the rear of the vehicle in front of the current vehicle; The image data is processed to obtain a grayscale image corresponding to the image data; An adaptive thresholding process is applied to the grayscale image to obtain a binary image. The binary image includes multiple candidate regions, each of which corresponds to edge information. The edge information includes at least the geometric length information of the candidate region, the position coordinate information of the center point of the candidate region, and the pixel information of the candidate region. Determine the position coordinates of the corner points of the multiple candidate regions in the binary image in the image coordinate system, and the sum of the pixels of the multiple candidate regions in the binary image; Based on the position coordinates of the corner points of the multiple candidate regions in the image coordinate system, and the sum of the pixels of the multiple candidate regions in the binary image, the edge information corresponding to the multiple candidate regions is determined; Based on the discrimination criteria of the light-emitting device, a target region is selected from the plurality of candidate regions, wherein the target region is the image region corresponding to the light-emitting device in the binary image, and the discrimination criteria include at least the aspect ratio of the light-emitting device, the region width of the light-emitting device, the region height of the light-emitting device, and the numerical range corresponding to the average pixel of the light-emitting device; The edge information corresponding to the target area is determined as the edge information of the light-emitting device; Based on the edge information of the light-emitting device, the position coordinates of the center point of the light-emitting device in the image coordinate system are determined in the image data; Based on the location coordinates, determine the geometric distance from the pixel point of the center point imaged in the at least two image acquisition devices to the center of the image acquisition device; Determine the proportional relationship between the geometric distance and the geometric distance from the light-emitting device to the at least two image acquisition devices; Based on the proportional relationship and the angle between the light-emitting device and the line connecting the at least two image acquisition devices, the distance between the current vehicle and the vehicle in front is determined.
2. The method according to claim 1, characterized in that, Determining the geometric distance from the pixel points imaged by the center point in the at least two image acquisition devices to the center of the image acquisition device based on the position coordinates includes: Determine the imaging distance from the pixel point of the center point of the light-emitting device to the center of the imaging plane of the at least two image acquisition devices; Based on the imaging distance and the focal length of the image acquisition device, the geometric distance from the pixel point of the center point imaged in the at least two image acquisition devices to the center of the image acquisition device is determined.
3. The method according to claim 1, characterized in that, Determining the distance between the current vehicle and the vehicle ahead based on the proportional relationship and the angle between the light-emitting device and the line connecting the at least two image acquisition devices includes: The vertical distance between the light-emitting device and the camera plane of the at least two image acquisition devices is determined based on the proportional relationship. The distance between the current vehicle and the vehicle in front is determined based on the trigonometric function value of the vertical distance and the angle between the light-emitting device and the line connecting the at least two image acquisition devices.
4. A vehicle distance measuring device, characterized in that, include: An acquisition unit is used to acquire image data of light-emitting devices acquired by at least two image acquisition devices, wherein the at least two image acquisition devices are deployed in front of the current vehicle, and the light-emitting devices are deployed at the rear of the vehicle in front of the current vehicle. The apparatus is further configured to perform grayscale processing on the image data to obtain a grayscale image corresponding to the image data; perform adaptive thresholding on the grayscale image to obtain a binary image, wherein the binary image includes multiple candidate regions, each of the multiple candidate regions corresponding to edge information, the edge information including at least the geometric length information of the candidate region, the position coordinate information of the center point of the candidate region, and the pixel information of the candidate region; determine the position coordinates of the corner points of the multiple candidate regions in the binary image in the image coordinate system, and the pixel sum of the multiple candidate regions in the binary image; based on the multiple candidate regions... The corner coordinates of the region in the image coordinate system, and the pixel sum of the multiple candidate regions in the binary image, are used to determine the edge information corresponding to the multiple candidate regions; based on the discrimination conditions of the light-emitting device, a target region is selected from the multiple candidate regions, wherein the target region is the image region corresponding to the light-emitting device in the binary image, and the discrimination conditions include at least the aspect ratio of the light-emitting device, the region width of the light-emitting device, the region height of the light-emitting device, and the numerical range corresponding to the average pixel value of the light-emitting device; the edge information corresponding to the target region is determined as the edge information of the light-emitting device; The first determining unit is used to determine the position coordinates of the center point of the light-emitting device in the image coordinate system based on the edge information of the light-emitting device in the image data; The second determining unit is used to determine the geometric distance from the center point to the center of the image acquisition device to the pixel point of the image acquisition device imaged in the at least two image acquisition devices based on the position coordinates. The third determining unit is used to determine the proportional relationship between the geometric distance and the geometric distance from the light-emitting device to the at least two image acquisition devices based on the principle of similar geometry; The fourth determining unit is used to determine the distance between the current vehicle and the vehicle in front based on the proportional relationship and the angle between the light-emitting device and the line connecting the at least two image acquisition devices.
5. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein when the program is run by a processor, it controls the device in which the storage medium is located to perform the method according to any one of claims 1 to 3.
6. A processor, characterized in that, The processor is used to run a program, wherein the program executes the method according to any one of claims 1 to 3 when it runs.
7. A vehicle, characterized in that, The vehicle is used to perform the method according to any one of claims 1 to 3.