METHOD AND SYSTEM FOR CALCULATING A FOCUSING PARAMETER OF A BINOCULAR STEREO CAMERA, AND INTELLIGENT TERMINAL
20230037072 · 2023-02-02
Inventors
Cpc classification
H04N13/239
ELECTRICITY
H04N23/959
ELECTRICITY
H04N23/67
ELECTRICITY
International classification
Abstract
A method and a system for calculating a focusing parameter of a binocular stereo camera, and an intelligent terminal are provided. The method includes: calculating a lower limit value and an upper limit value of a distance measurement range; acquiring a depth-of-field range in accordance with the lower limit value and the upper limit value; calculating a maximum value and a minimum value of an image distance gain corresponding to a real object distance within the depth-of-field range, and calculating an optimal image distance gain in accordance with the maximum value and the minimum value; acquiring an optimal object distance of a focused target in accordance with the optimal image distance gain; and calculating an optimal size of the focused target in accordance with the optimal object distance.
Claims
1. A method for calculating a focusing parameter of a binocular stereo camera, comprising: calculating a lower limit value and an upper limit value of a distance measurement range; acquiring a depth-of-field range in accordance with the lower limit value and the upper limit value; calculating a maximum value and a minimum value of an image distance gain corresponding to a real object distance within the depth-of-field range, and calculating an optimal image distance gain in accordance with the maximum value and the minimum value; acquiring an optimal object distance of a focused target in accordance with the optimal image distance gain; and calculating an optimal size of the focused target in accordance with the optimal object distance.
2. The method according to claim 1, wherein the calculating the lower limit value and the upper limit value of the distance measurement range comprises: calculating the lower limit value of the distance measurement range through U.sub.min=f×B/d.sub.max; and calculating the upper limit value of the distance measurement range through U.sub.max=f×B/d.sub.min where f represents a focal length of the binocular stereo camera, U.sub.min represents the lower limit value of the distance measurement range, U.sub.max represents the upper limit value of the distance measurement range, d.sub.max represents a maximum disparity value of an object, d.sub.min represents a minimum disparity value of the object, and B represents a baseline distance of the binocular stereo camera.
3. The method according to claim 2, wherein the calculating the maximum value and the minimum value of the image distance gain corresponding to the real object distance within the depth-of-field range comprises calculating the image distance gain through ΔV=V.sub.real−f=f.sup.2/U.sub.real, where U.sub.real represents the real object distance of the object, V.sub.real represents an image distance corresponding to the object, f represents a focal length, and ΔV represents the image distance gain.
4. The method according to claim 3, wherein the calculating the optimal image distance gain in accordance with the maximum value and the minimum value of the image distance gain corresponding to the real object distance comprises calculating the optimal image distance gain through ΔV.sub.best=(ΔV.sub.max−ΔV.sub.min)/2+ΔV.sub.min, where ΔV.sub.best represents the optimal image distance gain, ΔV.sub.max represents a maximum value of the image distance gain, and ΔV.sub.min represents the minimum value of the image distance gain.
5. The method according to claim 4, wherein the acquiring the optimal object distance of the focused target in accordance with the optimal image distance gain comprises calculating the optimal object distance of the focused target through U.sub.best=f.sup.2/ΔV.sub.best, where U.sub.best represents the optimal object distance of the focused target, ΔV.sub.best represents the optimal image distance gain, and f represents a focal length of the binocular stereo camera.
6. The method according to claim 5, wherein the calculating the optimal size of the focused target in accordance with the optimal object distance comprises: determining a profile of the focused target, and calculating an image size of a line pair and a size of the target; and calculating the quantity of line pairs and a width of a line pair in accordance with the image size of the line pair and the size of the target.
7. The method according to claim 6, wherein the calculating the image size of the line pair comprises calculating the image size of the line pair through Wid.sub.lp=Num.sub.pixel×Wid.sub.sensor, where Num.sub.pixel represents the quantity of pixels corresponding to one line pair, Wid.sub.sensor represents a size of a photosensitive unit in a pixel, and Wid.sub.lp represents the image size of one line pair.
8. The method according to claim 7, wherein the calculating the size of the target, the quantity of line pairs and the width of the line pair comprises: calculating the size of the target through
9. A system for calculating a focusing parameter of a binocular stereo camera, comprising: a distance calculation unit configured to calculate a lower limit value and an upper limit value of a distance measurement range; a depth-of-field calculation unit configured to acquire a depth-of-field range in accordance with the lower limit value and the upper limit value; an image distance gain calculation unit configured to calculate a maximum value and a minimum value of an image distance gain corresponding to a real object distance within the depth-of-field range, and calculate an optimal image distance gain in accordance with the maximum value and the minimum value; a target position calculation unit configured to acquire an optimal object distance of a focused target in accordance with the optimal image distance gain; and a target size calculation unit configured to calculate an optimal size of the focused target in accordance with the optimal object distance.
10. An intelligent terminal, comprising a data collection unit, a processor and a memory, wherein the data collection unit is configured to collected data, the memory is configured to store therein one or more program instructions, and the processor is configured to execute the one or more program instructions to implement the method according to claim 1.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to illustrate the technical solutions of the present disclosure or the related art in a clearer manner, the drawings desired for the present disclosure or the related art will be described hereinafter briefly. Obviously, the following drawings merely relate to some embodiments of the present disclosure, and based on these drawings, a person skilled in the art may obtain the other drawings without any creative effort.
[0018] The structure, scale and size shown in the drawings are merely provided to facilitate the understanding of the contents disclosed in the description but shall not be construed as limiting the scope of the present disclosure, so they has not substantial meanings technically. Any modification on the structure, any change to the scale or any adjustment on the size shall also fall within the scope of the present disclosure in the case of not influencing the effects and the purposes of the present disclosure.
[0019]
[0020]
DETAILED DESCRIPTION
[0021] In order to illustrate the technical solutions of the present disclosure or the related art in a clearer manner, the drawings desired for the present disclosure or the related art will be described hereinafter briefly. Obviously, the following drawings merely relate to some embodiments of the present disclosure, and based on these drawings, a person skilled in the art may obtain the other drawings without any creative effort.
[0022] As shown in
[0023] The calculating the lower limit value and the upper limit value of the distance measurement range includes: calculating the lower limit value of the distance measurement range through U.sub.min=f×B/d.sub.max; and calculating the upper limit value of the distance measurement range through U.sub.max=f×B/d.sub.min, where f represents a focal length of the binocular stereo camera, U.sub.min represents the lower limit value of the distance measurement range, U.sub.max represents the upper limit value of the distance measurement range, d.sub.max represents a maximum disparity value of an object, d.sub.min represents a minimum disparity value of the object, and B represents a baseline distance of the binocular stereo camera.
[0024] To be specific, in S1, when calculating the lower limit value of the distance measurement range, a relationship among the focal length of the binocular stereo camera, an object distance, the baseline distance and a disparity value is expressed through the following equation
where f represents the focal length of the binocular stereo camera, U represents the object distance (i.e., a distance between the object and an optical center of a lens), d represents the disparity value of the object, and B represents the baseline distance of the binocular stereo camera. Based on the equation (1), the following equation U=f×B/d (2) is acquired.
[0025] Based on the equation (2), when an active disparity value is maximum, the object distance U is minimum, i.e., the lower limit value U.sub.min of the distance measurement range of the binocular stereo camera. The maximum active disparity value equals to a search range of a disparity matching algorithm. When a real disparity value of a certain point is greater than this value, it is impossible to acquire an active disparity result for this point, and at this time, this point is set as an invalid point. For example, in a specific application scenario, the baseline distance of the binocular stereo camera is 120 mm, the focal length of the lens is 8 mm, the search range of the disparity matching algorithm is 80 pixels, and a size of a photosensitive unit in each pixel is 4.25 nm*4.25 nm, the lower limit value of the distance measurement range may be calculated through the above equation (2), i.e., U.sub.min=120 mm×8 mm/(80×0.0042 mm)≈2857 mm.
[0026] During the calculation of the upper limit value of the distance measurement range, based on equation (2), when the active disparity value is minimum, the object distance U is maximum, i.e., the upper limit value U.sub.max of the distance measurement range of the binocular stereo camera. Generally, in the case of ensuring the distance measurement accuracy, a minimum active disparity value is usually 1 to 5 pixels. When the minimum active disparity value is 2 pixels, in the above scenario, the upper limit value is calculated as U.sub.max=120 mm×8 mm/(2×0.0042 mm)≈114285 mm.
[0027] In S2, the depth-of-field range is just the distance measurement range. After the focusing, it is necessary to ensure that a clear image of the object within the distance measurement range is acquired on a sensor. In the above application scenario, the depth-of-field may be 2.8 m to 114 m.
[0028] Further, in S3, the calculating the maximum value and the minimum value of the image distance gain corresponding to the real object distance within the depth-of-field range specifically includes calculating the image distance gain through ΔV=V.sub.real−f=f.sup.2/U.sub.real, where U.sub.real represents the real object distance of the object, V.sub.real represents an image distance corresponding to the object, f represents the focal length, and ΔV represents the image distance gain.
[0029] To be specific, when the object distance U is infinitely great (i.e., the object is located at a point at infinity), the corresponding image distance V is minimum, and at this time, V equals to the focal length f. When U has a certain value U.sub.real, the corresponding image distance is V.sub.real and at this time, the image distance gain may be defined as ΔV=V.sub.real−f=f.sup.2/U.sub.real (3), where U.sub.real represents the real object distance of the object, V.sub.real represents the image distance corresponding to the object, f represents the focal length, and ΔV may be understood as an increment of the real image distance corresponding to the object relative to the focal length.
[0030] Still in the above application scenario, based on equation (3), the maximum value and the minimum value of the image distance gain corresponding to the real image distance within the depth-of-field range may be calculated as ΔV.sub.max=8 mm×8 mm/2800 mm≈0.022857 mm and ΔV.sub.min=8 mm×8 mm/114000 mm≈0.000561 mm.
[0031] Further, in S3, the calculating the optimal image distance gain in accordance with the maximum value and the minimum value of the image distance gain corresponding to the real object distance specifically includes calculating the optimal image distance gain through ΔV.sub.best=(ΔV.sub.max−ΔV.sub.min)/2+ΔV.sub.min, where ΔV.sub.best represents the optimal image distance gain, ΔV.sub.max represents a maximum value of the image distance gain, and ΔV.sub.min represents the minimum value of the image distance gain.
[0032] To be specific, during the calculation of the optimal image distance gain corresponding to the focused target, when the image distance is f+ΔV.sub.max, it is able to acquire a clear image of the object at a point having the lower limit value of the depth-of-field range, and when the image distance is f+ΔV.sub.min, it is able to acquire a clear image of the object at a point having the upper limit value of the depth-of-field range. In order to take the clarity of the images of all objects within the depth-of-field range into consideration, i.e., in order to provide the images of the object at a point having the lower limit value and the object at a point having the upper limit value with a same confusion level, a position of an ideal image distance of the focused target may be a middle point between the maximum value and the minimum value of the image distance gain, i.e., the optimal image distance gain ΔV.sub.best may be calculated through ΔV.sub.best (ΔV.sub.max−ΔV.sub.min)/2+ΔV.sub.min (4).
[0033] In the above application scenario, the optimal image distance gain is ΔV.sub.best=(22.857 nm−0.561 nm)/2+0.561 nm≈11.709 nm.
[0034] In S4, the acquiring the optimal object distance of the focused target in accordance with the optimal image distance gain includes calculating the optimal object distance of the focused target through U.sub.best=f.sup.2/ΔV.sub.best, where U.sub.best represents the optimal object distance of the focused target, ΔV.sub.best represents the optimal image distance gain, and f represents the focal length of the binocular stereo camera.
[0035] To be specific, based on the above equation (3), U.sub.real=f.sup.2/ΔV (5). The optimal image distance gain may be substituted into equation (5), so as to acquire the optimal object distance of the focused target. In the above application scenario, the optimal object distance of the focused target is U.sub.best=8.sup.2/11.709×10.sup.−3=5.466 m.
[0036] During the implementation, the calculating the optimal size of the focused target in accordance with the optimal object distance includes: determining a profile of the focused target, and calculating an image size of a line pair and a size of the target; and calculating the quantity of line pairs and a width of a line pair in accordance with the image size of the line pair and the size of the target.
[0037] In order to evaluate a change in the clarity during the focusing as well as a change in a transfer function of an imaging system in a better manner, the focused target includes black and white stripes parallel to each other and arranged alternately, or black and white concentric circles arranged alternately. Usually, the black and white regions have a same width (or different widths). The widths of the black and white regions are arranged in such a manner to provide a corresponding image width of 1 to 5 pixels, and here the image width having two pixels is taken as an example.
[0038] To be specific, the image size of one line pair is calculated through Wid.sub.lp=Num.sub.pixel×Wid.sub.sensor, where Num.sub.pixel represents the quantity of pixels corresponding to one line pair, Wid.sub.sensor represents a size of a photosensitive unit in a pixel, and Wid.sub.lp represents the image size of one line pair. The size of the target is calculated through
where Wid.sub.Obj represents a real width of the target, Wid.sub.Img represents a width of the target when it is imaged in a sensor, U.sub.best represents the optimal object distance of the target, and V.sub.best represents the optimal image distance gain. The quantity of line pairs is calculated through Num.sub.lp=Wid.sub.Img/Wid.sub.lp, where Wid.sub.Obj represents the real width of the target, Wid.sub.Img represents the width of the target when it is imaged in a sensor, U.sub.best represents the optimal object distance of the target, and V.sub.best represents the optimal image distance gain. The width of the line pair is calculated through Wid.sub.reallp=Wid.sub.Obj/Num.sub.lp, where Wid.sub.reallp represents a width of the line pair on the target, Wid.sub.Obj represents the size of the target, and Num.sub.lp represents the quantity of line pairs of the target.
[0039] During the calculation of the image size of one line pair, one line pair consists of one black stripe and one white stripe. When an image width corresponding to the width of the black or white region includes 2 pixels, the image width of one line pair includes 4 pixels. The image size of one line pair is calculated through Wid.sub.lp=Num.sub.pixel×Wid.sub.sensor (6), where Num.sub.pixel represents the quantity of pixels corresponding to one line pair, Wid.sub.sensor represents the size of one photosensitive unit in a pixel, and Wid.sub.lp represents the image size of one line pair.
[0040] In the above application scenario, the image size of one line pair is 4 pixel*4.25 nm/pixel=17 nm, and the size of the target is calculated through
where Wid.sub.Obj represents the real width of the target, Wid.sub.Img represents the width of the image of the target when it is imaged in the sensor, U.sub.best represents the optimal object distance of the target, and V.sub.best represents an optimal image plane position (i.e., an optimal focusing result). V.sub.best=ΔV.sub.best+f (8), i.e., the optimal image plane position is a sum of the focal length and the optimal image distance gain.
[0041] In the above application scenario, when the width of the image of the target in the sensor has a width of Wid.sub.Img=2 mm (not a unique value), V.sub.best=8 mm+11.709 nm≈8.012 mm and U.sub.best=5.466 m=5466 mm, the size of the target is Wid.sub.Obj=5466 mm×2 mm/8.012 mm≈1364 mm.
[0042] When calculating the quantity of line pairs and the width of the line pair, in the above application scenario, the width of the image of the target in the sensor is Wid.sub.Img=2 mm, and the image size of one line pair is 17 nm, so the quantity of line pairs is calculated through Num.sub.lp=Wid.sub.Img/Wid.sub.lp (9), where Num.sub.lp represents the quantity of line pairs of the target, Wid.sub.Img represents the width of the image of the target in the sensor, and Wid.sub.lp represents the width of one line pair when it is imaged in the sensor.
[0043] In the above application scenario, Num.sub.lp=2 mm/17 nm≈117 line pairs.
[0044] The width of the line pair on the target is calculated through Wid.sub.reallp=Wid.sub.Obj/Num.sub.lp (10), where Wid.sub.reallp represents the width of the lien pair on the target, Wid.sub.Obj represents the size of the target, and Num.sub.lp represents the quantity of line pairs of the target. In the above application scenario, Wid.sub.reallp=1364 mm/117≈11.6 mm.
[0045] According to the method for calculating the focusing parameter of the binocular stereo camera in the embodiments of the present disclosure, the lower limit value and the upper limit value of the distance measurement range are calculated, the depth-of-field range is acquired in accordance with the lower limit value and the upper limit value, the maximum value and the minimum value of the image distance gain corresponding to the real object distance within the depth-of-field range are calculated, the optimal image distance gain is calculated in accordance with the maximum value and the minimum value, the optimal object distance of the focused target is acquired in accordance with the optimal image distance gain, and the optimal size of the focused target is calculated in accordance with the optimal object distance. As a result, it is able to accurately calculate such focusing parameters as a focusing position and a target size in accordance with a specific parameter of an application scenario, thereby to solve the problem in the related art where the focusing accuracy is insufficient.
[0046] The present disclosure further provides in some embodiments a system for calculating a focusing parameter of a binocular stereo camera for implementing the above-mentioned method. As shown in
[0047] The distance calculation unit 100 is specifically configured to: calculate the lower limit value of the distance measurement range through U.sub.min=f×B/d.sub.max; and calculate the upper limit value of the distance measurement range through U.sub.max=f×B/d.sub.min, where f represents a focal length of the binocular stereo camera, U.sub.min represents the lower limit value of the distance measurement range, U.sub.max represents the upper limit value of the distance measurement range, d.sub.max represents a maximum disparity value of an object, d.sub.min represents a minimum disparity value of the object, and B represents a baseline distance of the binocular stereo camera.
[0048] The depth-of-field calculation unit 200 is specifically configured to calculate the image distance gain through ΔV=V.sub.real−f=f.sup.2/U.sub.real, where U.sub.real represents the real object distance of the object, V.sub.real represents an image distance corresponding to the object, f represents a focal length, and ΔV represents the image distance gain.
[0049] The image distance gain calculation unit 300 is specifically configured to calculate the optimal image distance gain through ΔV.sub.best=(ΔV.sub.max−ΔV.sub.min)/2+ΔV.sub.min, where ΔV.sub.best represents the optimal image distance gain, ΔV.sub.max represents a maximum value of the image distance gain, and ΔV.sub.min represents the minimum value of the image distance gain.
[0050] The target position calculation unit 400 is specifically configured to calculate the optimal object distance of the focused target through U.sub.best=f.sup.2/ΔV.sub.best, where U.sub.best represents the optimal object distance of the focused target, ΔB.sub.best best represents the optimal image distance gain, and f represents a focal length of the binocular stereo camera.
[0051] The target size calculation unit 500 is specifically configured to: determine a profile of the focused target, and calculate an image size of a line pair and a size of the target; and calculate the quantity of line pairs and a width of a line pair in accordance with the image size of the line pair and the size of the target.
[0052] To be specific, the target size calculation unit 500 is configured to calculate the image size of the line pair through Wid.sub.lp=Num.sub.pixel×Wid.sub.sensor, where Num.sub.pixel represents the quantity of pixels corresponding to one line pair, Wid.sub.sensord, represents a size of a photosensitive unit in a pixel, and Wid.sub.lp represents the image size of one line pair.
[0053] To be specific, the target size calculation unit 500 is configured to: calculate the size of the target through
calculate the quantity of line pairs through Num.sub.lp=Wid.sub.Img/Wid.sub.lp; and calculate the width of the line pair through Wid.sub.reallp=Wid.sub.Obj/Num.sub.lp, where Wid.sub.Obj represents a real width of the target, Wid.sub.Img represents a width of the target when it is imaged in a sensor, U.sub.best represents the optimal object distance of the target, V.sub.best represents the optimal image distance gain, Num.sub.lp represents the quantity of line pairs of the target, Wid.sub.lp represents a width of one line pair when it is imaged in the sensor, Wid.sub.reallp represents a width of the line pair on the target, and Wid.sub.Obj represents the size of the target.
[0054] According to the system for calculating the focusing parameter of the binocular stereo camera in the embodiments of the present disclosure, the lower limit value and the upper limit value of the distance measurement range are calculated, the depth-of-field range is acquired in accordance with the lower limit value and the upper limit value, the maximum value and the minimum value of the image distance gain corresponding to the real object distance within the depth-of-field range are calculated, the optimal image distance gain is calculated in accordance with the maximum value and the minimum value, the optimal object distance of the focused target is acquired in accordance with the optimal image distance gain, and the optimal size of the focused target is calculated in accordance with the optimal object distance. As a result, it is able to accurately calculate such focusing parameters as a focusing position and a target size in accordance with a specific parameter of an application scenario, thereby to improve an imaging effect, and solve the problem in the related art where the focusing accuracy is insufficient and an imaging effect is not good.
[0055] The present disclosure further provides in some embodiments an intelligent terminal, which includes a data collection unit, a processor and a memory. The data collection unit is configured to collected data, the memory is configured to store therein one or more program instructions, and the processor is configured to execute the one or more program instructions to implement the above-mentioned method.
[0056] The present disclosure further provides in some embodiments a computer-readable storage medium storing therein one or more program instructions. The one or more program instructions is executed by a processor so as to implement the above-mentioned method.
[0057] In the embodiments of the present disclosure, the processor may be an integrated circuit (IC) having a signal processing capability. The processor may be a general-purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or any other programmable logic element, discrete gate or transistor logic element, or a discrete hardware assembly, which may be used to implement or execute the methods, steps or logic diagrams in the embodiments of the present disclosure. The general purpose processor may be a microprocessor or any other conventional processor. The steps of the method in the embodiments of the present disclosure may be directly implemented by the processor in the form of hardware, or a combination of hardware and software modules in the processor. The software module may be located in a known storage medium such as a Random Access Memory (RAM), a flash memory, a Read-Only Memory (ROM), a Programmable ROM (PROM), an Electrically Erasable PROM (EEPROM), or a register. The processor may read information stored in the storage medium so as to implement the steps of the method in conjunction with the hardware.
[0058] The storage medium may be a memory, e.g., a volatile, a nonvolatile memory, or both.
[0059] The nonvolatile memory may be an ROM, a PROM, an EPROM, an EEPROM or a flash disk.
[0060] The volatile memory may be an RAM which serves as an external high-speed cache. Illustratively but nonrestrictively, the RAM may include Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM) or Direct Rambus RAM (DRRAM).
[0061] The storage medium in the embodiments of the present disclosure intends to include, but not limited to, the above-mentioned and any other appropriate memories.
[0062] It should be appreciated that, in one or more examples, the functions mentioned in the embodiments of the present disclosure may be achieved through hardware in conjunction with software. For the implementation, the corresponding functions may be stored in a computer-readable medium, or may be transmitted as one or more instructions on the computer-readable medium. The computer-readable medium may include a computer-readable storage medium and a communication medium. The communication medium may include any medium capable of transmitting a computer program from one place to another place. The storage medium may be any available medium capable of being accessed by a general-purpose or special-purpose computer.
[0063] The above embodiments are for illustrative purposes only, but the present disclosure is not limited thereto. Obviously, a person skilled in the art may make further modifications and improvements without departing from the spirit of the present disclosure, and these modifications and improvements shall also fall within the scope of the present disclosure.