Monocular camera distance measuring method and device, readable storage medium and vehicle

The target image is obtained through a monocular camera and benchmarked using calibration parameters and imaging pixel difference values, which solves the hardware cost and development cycle problems caused by adding cameras and deep learning algorithms in the prior art, and achieves accurate and efficient measurement Distance effect.

CN119394270APending Publication Date: 2025-02-07JIANGLING MOTORS
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411583639.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-07
Publication Date
2025-02-07

AI Technical Summary

Technical Problem

In the prior art, when achieving rapid and accurate distance measurement of obstacles in front and rear of vehicles, multiple cameras and deep learning algorithms are required to increase hardware costs and extend development cycles.

Method used

The target object image of the current position and offset position is obtained through the monocular camera, and the calibration parameters and imaging pixel difference are used for benchmarking conversion to achieve accurate distance measurement.

Benefits of technology

It realizes accurate ranging through a monocular camera without increasing hardware costs and using deep learning, which reduces complex algorithm work and computing resource requirements, shortens product development cycle and reduces overall development costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119394270A_ABST
    Figure CN119394270A_ABST
Patent Text Reader

Abstract

The invention provides a monocular camera distance measurement method and device, a readable storage medium and a vehicle, and belongs to the technical field of image distance measurement, the distance measurement method comprises the steps that calibration parameters of a monocular camera are acquired, and the calibration parameters are used for representing the relation between different calibration positions of at least one calibration tool relative to the monocular camera and corresponding imaging pixels; obtaining a first image of a target object at the current position through a monocular camera, and obtaining a first imaging pixel of the target object based on the first image; obtaining a second image of the target object at the offset position through the monocular camera, and obtaining a second imaging pixel of the target object based on the second image; and obtaining a distance value of the current position based on the calibration parameter, the first imaging pixel and the second imaging pixel. According to the method, the distance value of the current position is obtained through benchmarking conversion by using the images containing the target object at the current position and the offset position and through the imaging pixel difference value of the target object in the two images and the collected calibration parameters.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image ranging, and in particular relates to a monocular camera ranging method, a device, a readable storage medium and a vehicle. Background Art

[0002] Camera ranging technology mainly acquires images through a camera, and then uses image processing and analysis technology to calculate the distance from the object to the camera. Therefore, camera ranging technology has a wide range of applications in many fields. For example, it can be used in intelligent driving to realize the function of distance perception. It can also be used in industrial automation production lines to realize the function of measuring the size and position of parts.

[0003] At present, in vehicles equipped with cameras, in order to quickly and accurately measure the distance to obstacles in front and behind the vehicle during parking and driving, so as to make faster planning for vehicle control, multiple cameras are usually used for joint distance measurement. At the same time, deep learning algorithms are also used to analyze the image data captured by the camera, so as to learn complex image features and adapt to image analysis under various complex road environments and weather conditions, thereby achieving fast and accurate measurement of object distances.

[0004] However, increasing the number of cameras will increase the manufacturing cost of the vehicle, and the use of deep learning technology requires powerful computing resources as support. In actual development, deep learning also requires a long time and a large sample size for model training, which will not only extend the product development cycle but also increase manufacturing costs. Summary of the invention

[0005] Based on this, the embodiments of the present invention provide a monocular camera ranging method, device, readable storage medium and vehicle, aiming to achieve the purpose of accurate ranging through a monocular camera without increasing hardware costs and without using deep learning.

[0006] A first aspect of an embodiment of the present invention provides a monocular camera ranging method, the method comprising:

[0007] Acquire calibration parameters of the monocular camera, where the calibration parameters are used to characterize the relationship between different calibration positions of at least one calibration tool relative to the monocular camera and corresponding imaging pixels;

[0008] Acquire a first image of a target object at a current position through a monocular camera, and acquire a first imaging pixel of the target object based on the first image;

[0009] Acquire a second image of the target object at an offset position through a monocular camera, and acquire a second imaging pixel of the target object based on the second image;

[0010] Based on the calibration parameters, the first imaging pixels, and the second imaging pixels, a distance value of the current position is obtained.

[0011] In summary, according to the above-mentioned monocular camera ranging method, the images containing the target object at the current position and the offset position are used, and the imaging pixel difference of the target object in the two images and the collected calibration parameters are used for benchmarking and conversion to obtain the distance value of the current position. Compared with the existing technology, only a monocular camera is required at the hardware level, and deep learning is not required at the software level. It only needs to use the collected calibration parameters and the imaging pixel difference of the target object in the two images for benchmarking and conversion to obtain a more accurate distance value of the current position, which reduces complex algorithm work and reduces the requirements for computing resources. In actual project development, it can shorten the product development cycle and reduce the overall development cost.

[0012] In addition, the monocular camera ranging method according to the above embodiment of the present invention may also have the following additional technical features:

[0013] Further, obtaining the distance value of the current position based on the calibration parameter, the first imaging pixel and the second imaging pixel specifically includes the following steps:

[0014] Based on the calibration parameters, a mapping relationship between distance differences between adjacent calibration positions and imaging pixel differences corresponding to adjacent calibration positions is created;

[0015] Obtaining an offset pixel difference based on the first imaging pixel and the second imaging pixel;

[0016] Based on the offset pixel difference, selecting an imaging pixel difference value corresponding to the adjacent calibration position having the highest matching degree with the offset pixel difference from the mapping relationship as a reference offset pixel difference;

[0017] Based on the mapping relationship and the reference offset pixel difference, a distance value of the current position is obtained.

[0018] Furthermore, based on the offset pixel difference, selecting from the mapping relationship an imaging pixel difference value corresponding to the adjacent calibration position having the highest matching degree with the offset pixel difference as a reference offset pixel difference specifically comprises the following steps:

[0019] Calculating the difference between the absolute value of the offset pixel difference and the imaging pixel difference corresponding to the adjacent calibration position in the mapping relationship to obtain a first imaging pixel difference set;

[0020] sorting the imaging pixel difference values ​​in the first imaging pixel difference value set by magnitude to obtain a second imaging pixel difference value set;

[0021] An imaging pixel difference value with the smallest value is selected from the second imaging pixel difference value set as the reference offset pixel difference.

[0022] Further, obtaining the distance value of the current position based on the mapping relationship and the reference offset pixel difference specifically includes the following steps:

[0023] Selecting a calibration position with a smaller calibration distance value from two adjacent calibration positions corresponding to the reference offset pixel difference as a reference position;

[0024] Obtaining a geometric conversion factor according to the reference offset pixel difference and the offset pixel difference;

[0025] Obtaining a distance deviation according to the geometric conversion factor and the reference position;

[0026] A distance value of the current position is obtained according to the distance deviation and the reference position.

[0027] Furthermore, before acquiring the second image of the target object at the offset position through the monocular camera, the method further includes the following steps:

[0028] Acquire the moving speed and moving time of the monocular camera relative to the target object in real time;

[0029] Based on the moving speed and the moving time, obtaining a displacement offset of the monocular camera relative to the target object;

[0030] Determining whether the displacement offset is less than the preset value;

[0031] If so, a second image of the target object at the offset position is acquired through a monocular camera.

[0032] A second aspect of an embodiment of the present invention provides a monocular camera ranging device, the monocular camera ranging device comprising:

[0033] A first acquisition module is used to acquire calibration parameters of a monocular camera, wherein the calibration parameters are used to characterize the relationship between different calibration positions of at least one calibration tool relative to the monocular camera and corresponding imaging pixels;

[0034] A second acquisition module, configured to acquire a first image of a target object at a current position through a monocular camera, and acquire a first imaging pixel of the target object based on the first image;

[0035] A third acquisition module is used to acquire a second image of the target object at an offset position through a monocular camera, and acquire a second imaging pixel of the target object based on the second image;

[0036] The first calculation module is used to obtain the distance value of the current position based on the calibration parameters, the first imaging pixels and the second imaging pixels.

[0037] Furthermore, the first calculation module includes:

[0038] A creating unit, configured to create, based on the calibration parameters, a mapping relationship between distance differences between adjacent calibration positions and imaging pixel differences corresponding to adjacent calibration positions;

[0039] A first calculation unit, configured to obtain an offset pixel difference based on the first imaging pixel and the second imaging pixel;

[0040] A selection unit, configured to select, based on the offset pixel difference, an imaging pixel difference value corresponding to the adjacent calibration position having the highest matching degree with the offset pixel difference from the mapping relationship as a reference offset pixel difference;

[0041] The second calculation unit obtains the distance value of the current position based on the mapping relationship and the reference offset pixel difference.

[0042] Furthermore, the second computing unit includes:

[0043] A determination subunit, configured to select a calibration position with a smaller calibration distance value from two adjacent calibration positions corresponding to the reference offset pixel difference as a reference position;

[0044] A first calculation subunit, configured to obtain a geometric conversion factor according to the reference offset pixel difference and the offset pixel difference;

[0045] A second calculation subunit is used to obtain a distance deviation according to the geometric conversion factor and the reference position;

[0046] The third calculation subunit is used to obtain the distance value of the current position according to the distance deviation and the reference position.

[0047] A third aspect of an embodiment of the present invention provides a vehicle, the vehicle comprising a monocular vehicle-mounted camera, a processor and a memory;

[0048] The monocular vehicle-mounted camera is used to collect images containing the target object;

[0049] When the processor runs the computer program instructions stored in the memory, it executes the steps of the aforementioned monocular camera ranging method.

[0050] A fourth aspect of an embodiment of the present invention provides a readable storage medium, which stores one or more programs, and when the program is executed by a processor, the aforementioned monocular camera ranging method is implemented.

[0051] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description or will be learned through embodiments of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] Figure 1 This is a flow chart of the monocular camera ranging method proposed in Embodiment 1 of the present invention;

[0053] Figure 2 Flow chart of the monocular camera ranging method proposed in Embodiment 2 of the present invention

[0054] Figure 3 This is a schematic diagram of the structure of a monocular camera distance measurement device proposed in Embodiment 3 of the present invention;

[0055] The following specific implementation manner will further illustrate the present invention in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION

[0056] In order to facilitate the understanding of the present invention, the present invention will be described more fully below with reference to the relevant drawings. Several embodiments of the present invention are given in the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present invention more thorough and comprehensive.

[0057] It should be noted that when an element is referred to as being "fixed to" another element, it may be directly on the other element or there may be a central element. When an element is considered to be "connected to" another element, it may be directly connected to the other element or there may be a central element at the same time. The terms "vertical", "horizontal", "left", "right" and similar expressions used herein are for illustrative purposes only.

[0058] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more related listed items.

[0059] Embodiment 1

[0060] See also Figure 1 , Figure 1 A flow chart of a monocular camera ranging method provided by a first embodiment of the present invention is shown. The method specifically includes steps S10 to S40.

[0061] Step S10, obtaining calibration parameters of the monocular camera, where the calibration parameters are used to characterize the relationship between different calibration positions of at least one calibration tool relative to the monocular camera and corresponding imaging pixels;

[0062] In this step, the calibration tool can use a calibration plate of standard size, and use the calibration plate to perform imaging at the calibration position at different calibration distances, and obtain the calibration parameters of the monocular camera by obtaining an image containing the calibration plate. It should be pointed out that the calibration plate is not limited to a certain type, for example, a checkerboard calibration plate, a circular grid calibration plate, or a single specification, for example, a calibration plate of 50cm×50cm or 100cm×100cm can be used. In addition, the calibration position can be selected at multiple step distances from the monocular camera, such as 1m, 2m, 5m, etc. from the monocular camera. When multiple calibration plates are used, the obtained data can be made into a calibration parameter matrix f(D(x), Ban(y)) in the following form, where x and y are both integers greater than or equal to 1.

[0063]

[0064] Among them, starting from the second row, the "BAN+serial number" at the beginning of each row represents a calibration plate, starting from the second column, the "D+serial number" at the beginning of each column represents the calibration distance, and the "Cal+serial number" represents the number of imaging pixels at the corresponding calibration plate and calibration distance. For example, f(D(1), Ban(1)) represents the imaging pixel CalA1 of the calibration plate Ban1 at the calibration distance D1.

[0065] It should also be noted that pixel is the basic unit of image, which represents a point or a color sample in the image. The imaging pixel of a monocular camera refers to the number of pixels contained in the image that can be captured on the image sensor of the monocular camera. For example, for a monocular camera with a resolution of 1920×1080, it means that its image sensor can capture 1920 pixels in the horizontal direction and 1080 pixels in the vertical direction.

[0066] Step S20, acquiring a first image of the target object at the current position through a monocular camera, and acquiring a first imaging pixel of the target object based on the first image;

[0067] In this step, firstly, an image containing the target object at the current position is obtained through a monocular camera, and then the image containing the target object is processed using an image detection algorithm to obtain the number of pixels contained in the target object in the image. For example, target detection algorithms such as YOLO (You Only Look Once), SSD (Single Shot MultiBox Detector), and FasterR-CNN (Faster Region-based Convolutional Neural Networks) can be used to identify the target object in the image and determine the position of the target object in the image. Specifically, this can be achieved through the bounding box output by the algorithm. The bounding box contains the position information of the target object, and then the number of pixels of the target object is obtained by calculating the number of pixels in the bounding box.

[0068] Step S30, acquiring a second image of the target object at the offset position through a monocular camera, and acquiring a second imaging pixel of the target object based on the second image;

[0069] In this step, firstly, an image containing the target object at the offset position is obtained by a monocular camera. It should be noted that the offset position here refers to the relative position between the monocular camera and the target object after the monocular camera moves a certain distance relative to the current position mentioned above. Then, the image containing the target object is processed using an image detection algorithm to obtain the number of pixels contained in the target object in the image. For example, target detection algorithms such as YOLO (You Only Look Once), SSD (Single Shot MultiBox Detector), and Faster R-CNN (Faster Region-based Convolutional Neural Networks) can be used to identify the target object in the image and determine the position of the target object in the image. Specifically, this can be achieved through the bounding box output by the algorithm. The bounding box contains the position information of the target object, and then the number of pixels of the target object is obtained by calculating the number of pixels in the bounding box.

[0070] Step S40: obtaining a distance value of the current position based on the calibration parameters, the first imaging pixel and the second imaging pixel.

[0071] Specifically, step S40 includes steps S401 to S404:

[0072] Step S401: creating a mapping relationship between distance differences between adjacent calibration positions and imaging pixel differences corresponding to adjacent calibration positions based on calibration parameters;

[0073] In the calibration parameter matrix f(D(x), Ban(y)), the distance difference between adjacent calibration positions and the imaging pixel difference corresponding to the two adjacent calibration positions are correspondingly associated together. It should be noted that adjacent calibration positions refer to adjacent calibration positions corresponding to the calibration distances obtained by sorting by size. For example, in the order relationship of calibration positions arranged from small to large according to the calibration distance in f(D(1), Ban(1)), D1 and D2 are adjacent calibration positions, and similarly D2 and D3 are also adjacent calibration positions. In addition, for a specific type of calibration plate, these associated data can also be made into a conversion matrix f(△D(x), △Cal(y)) (x, y are both integers greater than or equal to 1) in the following form, and other specific types of calibration plates are processed in the same way.

[0074]

[0075] Among them, starting from the second row, the "△Cal+serial number" at the beginning of each row represents the imaging pixel difference of a certain type of calibration plate at adjacent calibration positions, and starting from the second column, the non-"NA" value of each column represents the distance difference (absolute value) between adjacent calibration positions. For example, f(△D1, △CalA1) represents the imaging pixel difference of calibration plate A at calibration distance D1 and calibration distance D2. It should be pointed out that in this step, the imaging pixel difference represented by "△Cal+serial number" is an absolute value.

[0076] It can be understood that the higher the calibration accuracy of the calibration plate, the more accurate the data in f(△D(x), △Cal(y)), and the finer the granularity of the calibration distance, the richer the data in f(△D(x), △Cal(y)).

[0077] Step S402: based on the first imaging pixel and the second imaging pixel, obtain the offset pixel difference ΔCal(R), that is, calculate the difference in the number of pixels in the monocular camera imaging of the target object at the current position and the offset position.

[0078] Step S403, based on the offset pixel difference △Cal(R), select the imaging pixel difference value corresponding to the adjacent calibration position with the highest matching degree with the offset pixel difference △Cal(R) from f(△D(x), △Cal(y)) as the reference offset pixel difference △Cal(n);

[0079] Since the actually collected offset pixel difference △Cal(R) will not be completely equal to the imaging pixel difference at the adjacent calibration position in f(△D(x), △Cal(y)), in order to reduce the calculation error, it is necessary to select the imaging pixel difference with the highest matching degree from f(△D(x), △Cal(y)) as the reference offset pixel difference △Cal(n).

[0080] Specifically, step S403 includes step S4031 to step S4033:

[0081] Step S4031, calculating the difference between the offset pixel difference △Cal(R) and the imaging pixel difference corresponding to the adjacent calibration position in f(△D(x), △Cal(y)), to obtain a first imaging pixel difference set;

[0082] It should be noted that, in this step, the imaging pixel difference corresponding to the adjacent calibration positions in △Cal(y)) refers to the absolute value of the imaging pixel difference corresponding to the adjacent calibration positions in △Cal(y)).

[0083] Step S4032, sorting the imaging pixel difference values ​​in the first imaging pixel difference value set to obtain a second imaging pixel difference value set;

[0084] Step S4033: Select the imaging pixel difference corresponding to the adjacent calibration position corresponding to the imaging pixel difference with the smallest value from the second imaging pixel difference set as the reference offset pixel difference △Cal(n), that is, at this time, the difference between the absolute value of the offset pixel difference △Cal(R) and the absolute value of the reference offset pixel difference △Cal(n) is the smallest.

[0085] Step S404: Obtain the distance value of the current position based on the mapping relationship and the reference offset pixel difference ΔCal(n).

[0086] Specifically, step S404 includes the following steps S4041 to S4044:

[0087] Step S4041, selecting the calibration position with the smaller calibration distance value from two adjacent calibration positions corresponding to the reference offset pixel difference △Cal(n) as the reference position D(n);

[0088] Exemplarily, assuming that the reference offset pixel difference △Cal(n) is △CalA1 in f(△D(x), △Cal(y)), and the calibration distance D1 is smaller than the calibration distance D2, then the calibration position corresponding to the calibration distance D1 is selected as the reference position D(n).

[0089] Step S4042, obtaining a geometric conversion factor according to the reference offset pixel difference and the offset pixel difference;

[0090] Since the actually collected offset pixel difference △Cal(R) will not be completely equal to the imaging pixel difference at the adjacent calibration position in f(△D(x), △Cal(y)), therefore, in this step, it is necessary to perform geometric conversion based on the reference offset pixel difference △Cal(n) and the offset pixel difference △Cal(R). Specifically, the geometric conversion factor β is calculated using the following formula:

[0091] β=(△Cal(R)-△Cal(n)) / △Cal(n);

[0092] Step S4043, obtaining the distance deviation according to the geometric conversion factor β and the reference position D(n);

[0093] Specifically, the distance deviation d is calculated using the following formula:

[0094] d=D(n)×(△Cal(R)-△Cal(n)) / △Cal(n);

[0095] Step S4044: Obtain the distance value L of the current position according to the distance deviation d and the reference position D(n). Specifically, the distance value L of the current position is calculated using the following formula:

[0096] L = D(n) × (1 + d);

[0097] In summary, according to the above-mentioned monocular camera ranging method, by using the images containing the target object at the current position and the offset position, and then using the imaging pixel difference of the target object in the two images and the collected calibration parameters, the distance value of the current position is obtained by benchmarking and conversion. Compared with the existing technology, only a monocular camera is required at the hardware level, and deep learning is not required at the software level. It only needs to use the collected calibration parameters and the imaging pixel difference of the target object in the two images for benchmarking and conversion to obtain a more accurate distance value of the current position, which reduces complex algorithm work and reduces the requirements for computing resources. In actual project development, it can shorten the product development cycle and reduce the overall development cost.

[0098] Embodiment 2

[0099] See also Figure 2 , Figure 2 A flow chart of a monocular camera ranging method provided by the second embodiment of the present invention is shown. The method specifically includes steps S50 to S90.

[0100] Step S50, obtaining calibration parameters of the monocular camera, where the calibration parameters are used to characterize the relationship between different calibration positions of at least one calibration tool relative to the monocular camera and corresponding imaging pixels;

[0101] Step S60, acquiring a first image of the target object at the current position through a monocular camera, and acquiring a first imaging pixel of the target object based on the first image;

[0102] Step S70, obtaining in real time the moving speed and moving time of the monocular camera relative to the target object, and obtaining the displacement offset of the monocular camera relative to the target object based on the moving speed and moving time;

[0103] Step S80, determining whether the displacement offset is less than a preset value; if so, obtaining a second image of the target object at the offset position through a monocular camera.

[0104] Step S90: obtaining a distance value of the current position based on the calibration parameters, the first imaging pixel and the second imaging pixel.

[0105] In this embodiment, since the distance measurement of the monocular camera is mainly based on the principle of pinhole imaging, that is, the farther the distance between the same object and the monocular camera, the fewer imaging pixels on the image sensor of the monocular camera, and the farther from the center point of the lens of the monocular camera, the sparser the imaging light is and the fisheye image characteristics will be presented, but the change of the imaging pixel within a small range is approximately proportional to the change of the distance. Therefore, before obtaining the second imaging pixel, it is necessary to determine whether the displacement offset exceeds the preset distance to ensure that the change of the imaging pixel is approximately proportional to the displacement offset.

[0106] In summary, according to the above-mentioned monocular camera ranging method, according to the above-mentioned monocular camera ranging method, by using the images containing the target object at the current position and the offset position, and then using the imaging pixel difference of the target object in the two images and the collected calibration parameters, the distance value of the current position is obtained by benchmarking and conversion. Compared with the existing technology, only a monocular camera is required at the hardware level, and deep learning is not required at the software level. It only needs to use the collected calibration parameters and the imaging pixel difference of the target object in the two images for benchmarking and conversion to obtain a more accurate distance value of the current position, which reduces complex algorithm work and reduces the requirements for computing resources. In actual project development, it can shorten the product development cycle and reduce the overall development cost.

[0107] Embodiment 3

[0108] Another embodiment of the present invention provides a monocular camera distance measurement device 600, see Figure 3 , the device comprises:

[0109] A first acquisition module 610 is used to acquire calibration parameters of the monocular camera, where the calibration parameters are used to characterize the relationship between different calibration positions of at least one calibration tool relative to the monocular camera and corresponding imaging pixels;

[0110] A second acquisition module 620 is used to acquire a first image of the target object at the current position through a monocular camera, and acquire a first imaging pixel of the target object based on the first image;

[0111] A third acquisition module 630 is used to acquire a second image of the target object at the offset position through a monocular camera, and acquire a second imaging pixel of the target object based on the second image;

[0112] The first calculation module 640 is used to obtain a distance value of a current position based on a calibration parameter, a first imaging pixel, and a second imaging pixel.

[0113] In some optional embodiments of the present invention, the first calculation module 640 further includes:

[0114] A creating unit, configured to create, based on the calibration parameters, a mapping relationship between distance differences between adjacent calibration positions and imaging pixel differences corresponding to adjacent calibration positions;

[0115] A first calculation unit, configured to obtain an offset pixel difference based on the first imaging pixel and the second imaging pixel;

[0116] A selection unit, configured to select, based on the offset pixel difference, an imaging pixel difference value corresponding to the adjacent calibration position having the highest matching degree with the offset pixel difference from the mapping relationship as a reference offset pixel difference;

[0117] The second calculation unit obtains the distance value of the current position based on the mapping relationship and the reference offset pixel difference.

[0118] In some optional embodiments of the present invention, the second computing unit includes:

[0119] A determination subunit, configured to select a calibration position with a smaller calibration distance value from two adjacent calibration positions corresponding to the reference offset pixel difference as a reference position;

[0120] A first calculation subunit, configured to obtain a geometric conversion factor according to the reference offset pixel difference and the offset pixel difference;

[0121] A second calculation subunit is used to obtain a distance deviation according to the geometric conversion factor and the reference position;

[0122] The third calculation subunit is used to obtain the distance value of the current position according to the distance deviation and the reference position.

[0123] In some optional embodiments of the present invention, the selection unit includes:

[0124] A fourth calculation subunit is used to calculate the difference between the offset pixel difference and the imaging pixel difference corresponding to the adjacent calibration position in the mapping relationship to obtain a first imaging pixel difference set;

[0125] A sorting subunit, used to sort the imaging pixel difference values ​​in the first imaging pixel difference value set to obtain a second imaging pixel difference value set;

[0126] The determination subunit is used to select the imaging pixel difference corresponding to the adjacent calibration position corresponding to the imaging pixel difference with the smallest value from the second imaging pixel difference set as the reference offset pixel difference.

[0127] In some optional embodiments of the present invention, the monocular camera ranging device 600 further includes:

[0128] The fourth acquisition module is used to obtain the moving speed and moving time of the monocular camera relative to the target object in real time;

[0129] The second calculation module is used to obtain the displacement offset of the monocular camera relative to the target object based on the moving speed and the moving time;

[0130] The judgment module is used to judge whether the displacement offset is less than a preset value. If so, a second image of the target object at the offset position is obtained through a monocular camera.

[0131] In summary, according to the above-mentioned monocular camera ranging device 600, by using the images containing the target object at the current position and the offset position, and then using the imaging pixel difference of the target object in the two images and the collected calibration parameters, the distance value of the current position is obtained by benchmarking and conversion. Compared with the existing technology, only a monocular camera is required at the hardware level, and deep learning is not required at the software level. It only needs to use the collected calibration parameters and the imaging pixel difference of the target object in the two images for benchmarking and conversion to obtain a more accurate distance value of the current position, which reduces complex algorithm work and reduces the requirements for computing resources. In actual project development, it can shorten the product development cycle and reduce the overall development cost.

[0132] Embodiment 4

[0133] On the other hand, the present invention further proposes a computer-readable storage medium having one or more programs stored thereon, which implement the above-mentioned monocular camera ranging method when executed by a processor.

[0134] Embodiment 5

[0135] Another aspect of the present invention further provides a vehicle, the vehicle comprising a monocular vehicle-mounted camera, a processor and a memory;

[0136] The monocular vehicle-mounted camera is used to collect images containing the target object;

[0137] When the processor runs the computer program instructions stored in the memory, it executes the steps of the aforementioned monocular camera ranging method.

[0138] Those skilled in the art will appreciate that the logic and / or steps represented in the flowchart or otherwise described herein, for example, may be considered as an ordered list of executable instructions for implementing logical functions, and may be specifically implemented in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a system based on a computer, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For purposes of this specification, "computer-readable medium" may be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.

[0139] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.

[0140] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or a combination thereof: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0141] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0142] The above-mentioned embodiments only express several implementation modes of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the protection scope of the present invention. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the attached claims.

Claims

1. A monocular camera distance measurement method, characterized in that: The method comprises: Acquire calibration parameters of the monocular camera, where the calibration parameters are used to characterize the relationship between different calibration positions of at least one calibration tool relative to the monocular camera and corresponding imaging pixels; Acquire a first image of a target object at a current position through a monocular camera, and acquire a first imaging pixel of the target object based on the first image; Acquire a second image of the target object at an offset position through a monocular camera, and acquire a second imaging pixel of the target object based on the second image; Based on the calibration parameters, the first imaging pixels, and the second imaging pixels, a distance value of the current position is obtained.

2. The monocular camera ranging method according to claim 1, characterized in that: The step of obtaining the distance value of the current position based on the calibration parameter, the first imaging pixel, and the second imaging pixel specifically comprises the following steps: Based on the calibration parameters, a mapping relationship between distance differences between adjacent calibration positions and imaging pixel differences corresponding to adjacent calibration positions is created; Obtaining an offset pixel difference based on the first imaging pixel and the second imaging pixel; Based on the offset pixel difference, selecting an imaging pixel difference value corresponding to the adjacent calibration position having the highest matching degree with the offset pixel difference from the mapping relationship as a reference offset pixel difference; Based on the mapping relationship and the reference offset pixel difference, a distance value of the current position is obtained.

3. The monocular camera ranging method according to claim 2, characterized in that: The step of selecting, based on the offset pixel difference, an imaging pixel difference value corresponding to the adjacent calibration position with the highest matching degree of the offset pixel difference from the mapping relationship as a reference offset pixel difference specifically comprises the following steps: Calculating the difference between the offset pixel difference and the imaging pixel difference corresponding to the adjacent calibration position in the mapping relationship to obtain a first imaging pixel difference set; sorting the imaging pixel difference values ​​in the first imaging pixel difference value set to obtain a second imaging pixel difference value set; The imaging pixel difference values ​​corresponding to the adjacent calibration positions corresponding to the imaging pixel difference value with the smallest value are selected from the second imaging pixel difference value set as the reference offset pixel difference.

4. The monocular camera ranging method according to claim 2 or 3, characterized in that: The step of obtaining the distance value of the current position based on the mapping relationship and the reference offset pixel difference specifically comprises the following steps: Selecting a calibration position with a smaller calibration distance value from two adjacent calibration positions corresponding to the reference offset pixel difference as a reference position; Obtaining a geometric conversion factor according to the reference offset pixel difference and the offset pixel difference; Obtaining a distance deviation according to the geometric conversion factor and the reference position; A distance value of the current position is obtained according to the distance deviation and the reference position.

5. The monocular camera ranging method according to claim 1, characterized in that: Before acquiring the second image of the target object at the offset position by the monocular camera, the following steps are also included: Acquire the moving speed and moving time of the monocular camera relative to the target object in real time; Based on the moving speed and the moving time, obtaining a displacement offset of the monocular camera relative to the target object; Determining whether the displacement offset is less than the preset value; If so, a second image of the target object at the offset position is acquired through a monocular camera.

6. A monocular camera distance measurement device, characterized in that: The monocular camera ranging device includes: A first acquisition module is used to acquire calibration parameters of the monocular camera, wherein the calibration parameters are used to characterize the relationship between the calibration position of the calibration tool relative to the monocular camera and the corresponding imaging pixels; A second acquisition module, configured to acquire a first image of a target object at a current position through a monocular camera, and acquire a first imaging pixel of the target object based on the first image; A third acquisition module is used to acquire a second image of the target object at an offset position through a monocular camera, and acquire a second imaging pixel of the target object based on the second image; The first calculation module is used to obtain the distance value of the current position based on the calibration parameters, the first imaging pixels and the second imaging pixels.

7. The monocular camera distance measuring device according to claim 6, characterized in that: The first calculation module includes: A creating unit, configured to create, based on the calibration parameters, a mapping relationship between distance differences between adjacent calibration positions and imaging pixel differences corresponding to adjacent calibration positions; A first calculation unit, configured to obtain an offset pixel difference based on the first imaging pixel and the second imaging pixel; A selection unit, configured to select, based on the offset pixel difference, an imaging pixel difference value corresponding to the adjacent calibration position having the highest matching degree with the offset pixel difference from the mapping relationship as a reference offset pixel difference; The second calculation unit obtains the distance value of the current position based on the mapping relationship and the reference offset pixel difference.

8. The monocular camera distance measuring device according to claim 7, characterized in that: The second computing unit comprises: A determination subunit, configured to select a calibration position with a smaller calibration distance value from two adjacent calibration positions corresponding to the reference offset pixel difference as a reference position; A first calculation subunit, configured to obtain a geometric conversion factor according to the reference offset pixel difference and the offset pixel difference; A second calculation subunit is used to obtain a distance deviation according to the geometric conversion factor and the reference position; The third calculation subunit is used to obtain the distance value of the current position according to the distance deviation and the reference position.

9. A vehicle, characterized in that: Including a monocular vehicle-mounted camera, a processor and a memory; The monocular vehicle-mounted camera is used to collect images containing the target object; When the processor runs the computer program instructions stored in the memory, the processor performs the steps of the monocular camera ranging method according to any one of claims 1 to 5.

10. A readable storage medium, characterized in that: The readable storage medium stores one or more programs, which, when executed by a processor, implement the monocular camera ranging method as described in any one of claims 1 to 5.