Method and apparatus for measuring distance of an object
Patent Information
- Application Number
- CN202180099316.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-05
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2041-11-05
AI Technical Summary
模糊距离与调制频率反相关,为了能够扩大可测距范围,可以降低调制频率,从而增大模糊距离,但是调制频率还与测量精度有关,降低调制频率又会增大测量误差
Smart Images

Figure CN117480408B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of three-dimensional ranging technology, and in particular to a method and apparatus for measuring the distance of an object. Background Technology
[0002] Time-of-flight (TOF) ranging methods primarily utilize the round-trip flight time of the light signal transmitted by the transmitter between the target object and the receiver to calculate the distance from the target object to the TOF ranging system. Since directly measuring the flight time of the light signal is difficult, the TOF ranging system can calculate the distance by measuring the phase delay between the transmitted and reflected signals, and use a depth map to represent the distance information corresponding to the surface of the target object.
[0003] Time-of-Flight (TOF) ranging systems can employ single-frequency ranging technology. Single-frequency ranging refers to a TOF ranging system that uses a single modulation frequency to emit a light signal and measures distance based on phase delay. The maximum distance that can be measured within one signal cycle at this modulation frequency is called the ambiguity distance. If the actual distance between the TOF ranging system and the target object exceeds this ambiguity distance, phase entanglement occurs. Phase entanglement means that the measured value of the phase delay of the reflected signal may differ from the actual value. If the actual value exceeds one signal cycle, it will be subtracted by N times 2π (N is a positive integer), thus ensuring the measured value falls within that signal cycle. Therefore, the actual value and the measured value may differ by N × 2π. For example, if the ambiguity distance is 0.5 meters, when measuring the distance to an object larger than 0.5 meters, due to phase entanglement, the TOF ranging system will calculate the distance as being within 0 to 0.5 meters, resulting in a difference between the measured distance and the true distance. Therefore, in single-frequency ranging technology, to ensure that the measured value matches the true value, it is necessary to maximize the ambiguity distance. The fuzzy distance is inversely correlated with the modulation frequency. In order to expand the measurable range, the modulation frequency can be reduced, thereby increasing the fuzzy distance. However, the modulation frequency is also related to the measurement accuracy, and reducing the modulation frequency will increase the measurement error.
[0004] In single-frequency ranging technology, how to measure the true distance without increasing the measurement error has become an urgent problem to be solved. Summary of the Invention
[0005] This application provides a TOF object ranging method. In single-frequency ranging technology, even if the position of the object being measured exceeds the fuzzy distance, the true distance of the target object can still be measured, and the measurement accuracy is guaranteed.
[0006] In a first aspect, embodiments of this application provide an object ranging method, comprising: acquiring a first image and a first phase map corresponding to the first image using a time-of-flight (TOF) sensor; identifying a target region corresponding to a target object in the first image, and a second phase map corresponding to the target region in the first phase map; obtaining an estimated distance between the target object and the TOF sensor based on the size information of the target object, wherein the size information includes the image size of the target object in the first image, or the actual physical size of the target object; calculating the unwrapping coefficient corresponding to each pixel in the target region based on the estimated distance and the second phase map; and determining a depth map of the target region based on the unwrapping coefficient and the second phase map.
[0007] The first image can be a grayscale image or a color image; the target region can be understood as a region of interest (ROI), which is used by the object ranging device to observe the phase map corresponding to the target object; the object ranging device obtains the estimated distance of the target object from the TOF sensor based on the size information of the target object, which can be understood as an approximate distance between the target object and the TOF sensor; the unwrapping coefficient is used to indicate the true signal period corresponding to each pixel in the target region; the depth map is used to visualize the true distance corresponding to each pixel in the target region. In this embodiment, it is not necessary to extend the ambiguity distance by reducing the modulation frequency, but rather to determine an estimated distance between the target object and the TOF sensor based on the size information of the object, and calculate the unwrapping coefficient corresponding to each pixel in the target region based on the estimated distance. The unwrapping coefficient can indicate the signal period corresponding to the target object. By determining the unwrapping coefficient corresponding to each pixel, the true distance corresponding to each pixel can be determined. Even if the actual distance of the target object exceeds the ambiguity distance, the actual distance of the target object can still be detected, and the measurement accuracy can be guaranteed.
[0008] In one optional implementation, the size information of the target object is the image size of the target object. Obtaining the estimated distance of the target object from the TOF sensor based on the size information of the target object includes: determining the estimated distance based on the image size of the target object and a preset relationship, wherein the preset relationship indicates that multiple first distances correspond to multiple preset image sizes, the image size of the target object is the target preset image size among the multiple preset image sizes, and the estimated distance is the first distance that corresponds to the target preset image size.
[0009] The image size is the number of pixels occupied by the target object in the first image. The object ranging device locally stores the correspondence between multiple first distances and multiple preset image sizes. These multiple first distances, multiple preset image sizes, and their correspondence are obtained based on empirical values. The object ranging device determines the number of pixels corresponding to the target area, that is, determines the image size of the target object. If the image size of the target object is the target preset image size among the multiple preset image sizes, then based on the above preset relationship, the estimated distance is determined as the first distance that has a correspondence with the target preset image size. In traditional single-frequency ranging technology, when the position of the target object exceeds the ambiguity distance, only a few possible positions of the target object can be calculated. Single-frequency ranging technology can calculate the signal periods (corresponding to possible positions) that multiple measured objects may correspond to, but it cannot determine which signal period corresponds to the true position of the measured object. The signal period corresponding to the true position of the measured object can be represented by the unwrapping coefficient. In the current technology, the unwrapping coefficient can only be calculated in multi-frequency ranging technology. That is to say, the current single-frequency ranging technology does not involve the unwrapping coefficient. However, in this embodiment, the unwrapping technology can be calculated in single-frequency ranging technology. The object ranging device can determine the approximate distance between the target object and the object ranging device based on the number of pixels occupied by the target area in the first image. Thus, it can calculate the unwrapping coefficient corresponding to each pixel in the target area based on the approximate distance and the second phase map. Moreover, compared with the traditional method where only multi-frequency ranging technology can calculate the unwrapping coefficient, the solution in this embodiment can save the power consumption of the object ranging device.
[0010] In one optional implementation, the size information of the target object is the actual physical size of the target object. The estimated distance between the target object and the TOF sensor is obtained based on the size information of the target object, including: calculating multiple second distances between the target object and the TOF sensor based on the second phase map, where each of the multiple second distances corresponds to an estimated size of the target object; matching the actual physical size of the target object with the multiple estimated sizes to determine the target estimated size that matches the actual physical size; and determining the second distance corresponding to the target estimated size as the estimated distance.
[0011] Due to phase entanglement, the object ranging device calculates multiple distances (also called "second distances") between the target object and the TOF sensor based on the second phase map. These multiple second distances represent multiple possible distances between the target object and the TOF sensor, i.e., possible locations where the target object may appear. The object ranging device can calculate an estimated size of the target object based on each of the multiple second distances, i.e., each second distance corresponds to an estimated size of the target object. The object ranging device matches the actual physical size of the target object with the multiple estimated sizes to determine the target estimated size that matches the actual physical size. The actual physical size of the target object is an empirical value. For example, if the target object is a human face, the actual width of a human face is approximately 15cm. The object ranging device determines the second distance corresponding to the estimated target size as the aforementioned estimated distance. In traditional single-frequency ranging technology, when the position of the target object exceeds the ambiguity distance, only a few possible positions of the target object can be calculated. Single-frequency ranging technology can calculate multiple possible signal periods (corresponding to possible positions) for the measured object, but it cannot determine which signal period corresponds to the true position of the measured object. The signal period corresponding to the true position of the measured object can be represented by the unwrapping coefficient. In current technology, the unwrapping coefficient can only be calculated in multi-frequency ranging technology. That is to say, the current single-frequency ranging technology does not involve the unwrapping coefficient. However, in this embodiment, the unwrapping technology can be calculated in single-frequency ranging technology. When the object ranging device can select a second distance (second distance) from multiple calculated distances (second distances) as the estimated distance based on the actual physical size of the target object, it can calculate the unwrapping coefficient corresponding to each pixel in the target area based on the estimated distance and the second phase map. Moreover, compared with the traditional method where only multi-frequency ranging technology can calculate the unwrapping coefficient, the solution in this embodiment can save the power consumption of the object ranging device.
[0012] In an optional implementation, before obtaining the estimated distance between the target object and the TOF sensor based on the size information of the target object, the method includes: determining the category of the target object; and obtaining the size information of the target object based on the category.
[0013] The object ranging device can determine the category of a target object using machine vision technology. For example, the category of the target object could be a face, a hand, a machine part, etc. The size information of the target object can be obtained by querying a database based on the category. This database includes size information for various categories of objects. In this embodiment, the object ranging device can locally store the size information of multiple categories of objects, making the above object ranging method applicable to multiple categories of objects, thus adapting the method to various application scenarios.
[0014] In one alternative implementation, the target object is classified as a human face.
[0015] In one optional implementation, the target region includes a first region and a second region; when there is no phase flip in the phase delays corresponding to multiple pixels in the target region, the unwrapping coefficients corresponding to each pixel in the target region are the same; or, when there is a phase flip in the phase delays corresponding to multiple pixels in the target region, the unwrapping coefficients include a first unwrapping coefficient and a second unwrapping coefficient, wherein phase flip means that the first phase delay and the second phase delay are not in the same signal period, the first phase delay is the phase delay corresponding to multiple pixels in the first region, and the second phase delay is the phase delay corresponding to multiple pixels in the second region; the first phase delay is related to the first unwrapping coefficient, and the second phase delay is related to the second unwrapping coefficient; the first unwrapping coefficient is used to calculate the depth map corresponding to the first region, and the second unwrapping coefficient is used to calculate the depth map corresponding to the second region.
[0016] The first and second regions are spatially continuous; phase reversal means that the first and second phase delays are not in the same signal period. For example, the first phase delay is 355 degrees and the second phase delay is 365 degrees. The first unwrapping coefficient N1 is calculated based on the first phase delay of 355 degrees, and the second unwrapping coefficient N2 is obtained based on 5 degrees (the second phase delay of 365 degrees - 360 degrees). For example, N1 = 0 indicates that the first region corresponds to the first signal period, while N2 = 1 indicates that the second region corresponds to the second signal period. N1 and N2 indicate the true positions corresponding to the first and second regions, relative to the current signal period. In previous single-frequency ranging techniques, the object ranging device could not calculate the untangling coefficient. If the phase delay corresponding to the second region was 365 degrees, it would directly convert 365 degrees to 5 degrees (365 degrees - 360 degrees) and calculate the distance according to the phase delay of 5 degrees. 5 degrees (measured value) and 365 degrees (true value) are different, which will cause the depth value of the target region to be inconsistent. In this embodiment, N1 and N2 indicate the signal period corresponding to the first region and the second region respectively. The signal period can indicate the actual distance corresponding to the first region and the second region, so that the depth of the target region is continuous and close to the estimated distance.
[0017] Secondly, embodiments of this application provide an object ranging device, comprising: an acquisition module, configured to acquire a first image and a first phase map corresponding to the first image using a time-of-flight (TOF) sensor; a processing module, configured to identify a target region corresponding to a target object in the first image, and a second phase map corresponding to the target region in the first phase map; the processing module is further configured to acquire an estimated distance between the target object and the TOF sensor based on the size information of the target object, wherein the size information includes the image size of the target object in the first image, or the actual physical size of the target object; the processing module is further configured to calculate the unwrapping coefficient corresponding to each pixel in the target region based on the estimated distance and the second phase map; and the processing module is further configured to determine a depth map of the target region based on the unwrapping coefficient and the second phase map.
[0018] In one optional implementation, the size information of the target object is the image size of the target object; the processing module is further configured to determine the estimated distance based on the image size of the target object and a preset relationship, wherein the preset relationship indicates that multiple first distances correspond to multiple preset image sizes, the image size of the target object is the target preset image size among the multiple preset image sizes, and the estimated distance is the first distance that corresponds to the target preset image size.
[0019] In an optional implementation, the processing module is further specifically used to: calculate multiple second distances between the target object and the TOF sensor based on the second phase map, each of the multiple second distances corresponding to an estimated size of the target object; match the actual physical size of the target object with the multiple estimated sizes to determine the target estimated size that matches the actual physical size; and determine the second distance corresponding to the target estimated size as the estimated distance.
[0020] In an optional implementation, the processing module is also specifically used to: determine the category of the target object; and obtain the size information of the target object based on the category.
[0021] In one alternative implementation, the target object is classified as a human face.
[0022] In one optional implementation, the target region includes a first region and a second region; when the phase delays corresponding to multiple pixels in the target region do not have phase flips, the unwrapping coefficients corresponding to each pixel in the target region are the same; or,
[0023] When phase reversal occurs in the phase delays corresponding to multiple pixels in the target region, the unwrapping coefficients include a first unwrapping coefficient and a second unwrapping coefficient. Phase reversal means that the first phase delay and the second phase delay are not in the same signal period. The first phase delay is the phase delay corresponding to multiple pixels in the first region, and the second phase delay is the phase delay corresponding to multiple pixels in the second region. The first phase delay is related to the first unwrapping coefficient, and the second phase delay is related to the second unwrapping coefficient. The first unwrapping coefficient is used to calculate the depth map corresponding to the first region, and the second unwrapping coefficient is used to calculate the depth map corresponding to the second region.
[0024] Thirdly, embodiments of this application provide an object ranging device, including a processor coupled to at least one memory, the processor being configured to read a computer program stored in the at least one memory, causing the electronic device to perform the method as described in any one of the first aspects above.
[0025] Fourthly, embodiments of this application provide a computer-readable storage medium for storing a computer program or instructions, which, when executed, cause a computer or processor to perform the method as described in any one of the first aspects above.
[0026] Fifthly, embodiments of this application provide a computer program product including instructions that, when executed by a computer or processor, cause the computer or processor to implement the method described in any one of the first aspects above. Attached Figure Description
[0027] Figure 1 This is a schematic diagram illustrating the principle of TOF ranging.
[0028] Figure 2 This is a schematic diagram of a depth map;
[0029] Figure 3a This is a schematic diagram of a scene where the measured object may appear in single-frequency ranging technology.
[0030] Figure 3b This is a schematic diagram of a scene where the measured object may appear in multi-frequency ranging technology.
[0031] Figure 4 This is a schematic diagram of the ranging system in the embodiments of this application;
[0032] Figure 5 This is a schematic diagram of the transmitted signal and the reflected signal in an embodiment of this application;
[0033] Figure 6 This is a flowchart illustrating the steps of an object ranging method in an embodiment of this application;
[0034] Figure 7 This is a schematic diagram of the target region and the corresponding second phase image in the first image of this application embodiment;
[0035] Figure 8 This is a diagram showing the relationship between the number of pixels occupied by a face at different distances in the embodiments of this application;
[0036] Figure 9 This is a schematic diagram illustrating multiple second distances and the actual physical dimensions of the face corresponding to each second distance in the embodiments of this application;
[0037] Figure 10 This is a schematic diagram of one embodiment of an object ranging device according to the present application.
[0038] Figure 11 This is a schematic diagram of the structure of one embodiment of an electronic device according to the present application. Detailed Implementation
[0039] In this application, unless otherwise specified, the same or similar parts between the various embodiments can be referred to each other. In the various embodiments of this application, and in the various implementation methods / methods / implementations within each embodiment, unless otherwise specified or logically conflicting, the terminology and / or descriptions between different embodiments and between the various implementation methods / methods / implementations within each embodiment are consistent and can be mutually referenced. The technical features in different embodiments and the various implementation methods / methods / implementations within each embodiment can be combined according to their inherent logical relationships to form new embodiments, implementation methods, methods, or implementation approaches. The following embodiments of this application do not constitute a limitation on the scope of protection of this application.
[0040] It is understood that some optional features in the embodiments of this application can be implemented independently in certain scenarios without relying on other features, such as the current solution on which they are based, to solve the corresponding technical problems and achieve the corresponding effects. Alternatively, they can be combined with other features as needed in certain scenarios. Correspondingly, the apparatus given in the embodiments of this application can also implement these features or functions, which will not be elaborated here.
[0041] In the description of this application, unless otherwise stated, "multiple" means two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or multiple items. For example, at least one of a, b, or c can mean: a, b, c, a and b, a and c, b and c, or a and b and c, where a, b, and c can be single or multiple.
[0042] Furthermore, to facilitate a clear description of the technical solutions in the embodiments of this application, the terms "first" and "second" are used in the embodiments of this application to distinguish identical or similar items with substantially the same function and effect. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and that "first" and "second" are not necessarily different. Meanwhile, in the embodiments of this application, words such as "exemplary" or "for example" are used to indicate that something is being used as an example, illustration, or description. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of this application should not be construed as being better or more advantageous than other embodiments or design schemes. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete manner for ease of understanding.
[0043] Exemplary explanation of TOF ranging principle: Please refer to Figure 1 To understand this, when measuring the distance to an object, a high-frequency infrared modulated signal is emitted from a modulated light source to illuminate the target object. When this modulated signal reflects back to the sensor surface of the Time-of-Flight (TOF) ranging system, a distance-related phase delay is generated. The TOF sensor receives and demodulates the phase delay caused during flight, and then calculates the distance between the sensor and the target object based on known quantities such as the speed of light and the modulation frequency. To obtain complete three-dimensional information of the target object and reconstruct its surface shape using a two-dimensional TOF sensor array, each pixel unit in the TOF sensor array must be able to independently receive and demodulate the distance information to corresponding points on the object's surface, thus obtaining a depth map of the target object. A depth map, also known as a range image, is an image that uses the distance (depth) of each point on the measured object as pixel values. The depth map directly reflects the geometry of the visible surface of the measured object. Please refer to [link to relevant documentation]. Figure 2 As shown, the visualized depth map is as follows: Figure 2 As shown, different depth values are mapped to different colors, thus visualizing the depth map as a color image.
[0044] TOF ranging includes single-frequency ranging technology and multi-frequency ranging technology. Traditional single-frequency ranging technology has a limited ranging range. Under a single-frequency modulation frequency, it can only measure the distance to objects located within the ambiguity distance (as shown in equation (1)). The distance is measured according to equation (2). If the position of the measured object exceeds the ambiguity distance, phase entanglement will occur. Please refer to... Figure 3aTo understand this, single-frequency ranging technology can calculate the possible locations of multiple objects, but it cannot determine which signal period corresponds to the true location of the object. The signal period corresponding to the true location of the object can be represented by the unwrapping coefficient. Current technologies either reduce the modulation frequency in single-frequency ranging to expand the ambiguity range, allowing the true distance of the object to fall within the ambiguity range and thus accurately measure the object, but this reduces measurement accuracy; or they use multi-frequency ranging technology, which adds one or more modulation frequencies to sequentially measure the distance of the object. Please refer to [link to relevant documentation]. Figure 3b As shown, each modulation frequency corresponds to an ambiguity distance. The true distance is the value measured by the modulated waves of multiple modulation frequencies. This true location corresponds to the modulation frequency, which is the greatest common divisor of the multiple frequencies, called the beat frequency. The beat frequency is generally lower, thus allowing for a longer measurement distance. For example, if the modulation frequency a = 100MHz, the ambiguity distance U corresponding to modulation frequency a is... 100MHz =1.5m, modulation frequency b = 80MHz, the corresponding ambiguity distance U of modulation frequency b 80MHz =1.875m. After dual-frequency measurement, the ambiguity distance of the entire system is extended to 7.5m. Although multi-frequency ranging technology can accurately measure the true distance of the object being measured, it increases the power consumption of the ranging system, reduces the frame rate, and limits the application scenarios of the ranging system.
[0045]
[0046] Where c is the speed of light and F is the modulation frequency.
[0047]
[0048] Where c is the speed of light. F is the phase delay, and F is the modulation frequency.
[0049] In view of the above problems, this application proposes an object ranging method, which is applied to an object ranging system. Please refer to [link to relevant documentation]. Figure 4 As shown, Figure 4 This is a schematic diagram of an object ranging system. The ranging system includes a Time-of-Flight (TOF) module 40 and a processing module 41. The TOF module 40 includes a TOF chip 403, a laser 402, and a lens 404 (containing a filter). The TOF chip 403 includes a TOF sensor 4033, a controller 4031, and an analog-to-digital converter (ADC) 4032. The controller 4031 is used to generate a transmitted signal at a specific modulation frequency. The measurement of signal waveform changes is usually expressed in degrees (angles). Please refer to [link to relevant documentation]. Figure 5 As shown, the emitted infrared continuous light signal (i.e. the emitted signal) is a modulated cosine signal s(t), which can be represented by the following equation (3).
[0050] s(t)=cos(ωt), Equation (3).
[0051] Where t represents time, ω represents angular velocity, and ωt represents angle.
[0052] The controller 4031 sends electrical signals to the laser driver 401 and the TOF sensor 4033 respectively. The laser driver 401 drives the laser 402 according to the change of the electrical signal, and the laser 402 emits the corresponding light wave signal s(t). The light wave signal is reflected by the object being measured, and the lens 404 receives the reflected signal and sends it to the TOF sensor. The TOF sensor 4033 receives the reflected signal g(t), which contains a phase-delayed modulated cosine signal. The reflected signal g(t) can be represented by the following equation (4).
[0053]
[0054] Where A represents amplitude, t represents time, and ω represents angular velocity. Indicates phase delay, phase delay This represents the propagation delay of light waves during their flight.
[0055] The TOF sensor 4033 is also used to perform frequency mixing and integration of s(t) and g(t) (as shown in Equation 5 below) to obtain the integral value. The integral value is output to the processing module 41 through the ADC 4032. The processing module 41 is used to perform phase calculation and intensity calculation on the integral value to obtain the grayscale image and phase image of the measured object.
[0056]
[0057] Where s(t) represents the transmitted signal and g(t) represents the reflected signal. Indicates mutual correlation.
[0058] The controller 4031 can select four different τ values: τ0 = 0°, τ1 = 90°, τ2 = 180° and τ3 = 270°. Substituting these four different τ values into equation (5) above yields the four-phase integral value (also known as the four-phase raw data). The ADC 4032 outputs the four-phase integral value to the processing module 41. The processing module 41 is used to perform phase calculations (as shown in equation (6) below) and intensity calculations (as shown in equations (7) and (8) below) based on the four-phase raw data. The phase delay in equation (6) below... The intensity B in the following formula (7) can be used to obtain the grayscale image of the object being measured in order to obtain the phase image of the object being measured.
[0059]
[0060]
[0061] B=c(τ)+c(τ+180°), formula (8).
[0062] In equation (8) above, τ can be 0° or 90°.
[0063] The processing module 41 is used to identify the target region corresponding to the target object in the grayscale image and the phase map corresponding to the target region. The processing module 41 can obtain the estimated distance of the target object from the TOF sensor 4033 based on the size information of the target object, calculate the unwrapping coefficient corresponding to each pixel in the target region based on the estimated distance and the phase map, determine the unwrapping coefficient, that is, determine the signal period corresponding to each pixel in the target region, and then determine the depth map of the target region based on the unwrapping coefficient and the phase map corresponding to the target region. In this embodiment, in the single-frequency ranging technology, it is not necessary to extend the ambiguity distance by reducing the modulation frequency as in the current technology. Instead, an estimated distance of the target object from the TOF sensor is determined by the size information of the object. Based on the estimated distance, the unwrapping coefficient corresponding to each pixel in the target region is calculated. By determining the unwrapping coefficient corresponding to each pixel, the true distance corresponding to each pixel can be determined. Even if the actual distance of the target object exceeds the ambiguity distance, the actual distance of the target object can still be detected, and the measurement accuracy can be guaranteed.
[0064] The technical solution of this application will be executively described below through specific embodiments. This application provides an object ranging method, the execution subject of which can be an object ranging device. In one implementation, the structure of the object ranging device is as described above. Figure 4The structure shown depicts an object ranging device comprising a Time-of-Flight (TOF) module and a processing module. In one example, the TOF module and processing module are integrated into the same device. For instance, the object ranging device can be a dedicated ranging device, or it can be a terminal. Terminals include, but are not limited to, mobile phones, computers, tablets, in-vehicle terminals, smart home devices (such as smart TVs), gaming devices, robots, etc. In another implementation, the TOF module and processing module can be housed in separate devices. For example, the TOF module is located in a TOF camera, and the processing module is located in the object ranging device. The TOF camera and the object ranging device are communicatively connected. This object ranging device can be a terminal, or it can be a processor within a terminal. Terminals include, but are not limited to, mobile phones, computers, tablets, in-vehicle terminals, smart home devices (such as smart motors), gaming devices, robots, etc. Please refer to [link to relevant documentation]. Figure 6 As shown, the object ranging device performs the following steps 601 to 605.
[0065] Step 601: The object ranging device uses a TOF sensor to acquire a first image and a first phase image corresponding to the first image.
[0066] The object ranging device uses a TOF sensor to acquire a first image. In one optional case, the first image is a grayscale image of the scene being photographed, obtained using equation (7) or equation (8) above. Optionally, if the object ranging device also includes a color image sensor, the first image can also be an RGB (red, green, blue) image. For example, if the object ranging device is a mobile phone, the mobile phone includes a color image sensor, and the first image is an RGB image acquired by the mobile phone through the color image sensor.
[0067] The object ranging device uses a Time-of-Flight (TOF) sensor to acquire raw data (or raw data), and calculates the grayscale value corresponding to each pixel in the first image and the phase delay corresponding to the time of flight of light waves based on the raw data, thereby obtaining the first phase map corresponding to the first image. Based on the TOF ranging principle, when ranging a target object, a high-frequency infrared modulation signal is emitted by a modulated light source to illuminate the target object. When the modulation signal is reflected back to the surface of the TOF sensor, a distance-related phase delay is generated. Each pixel in the first image corresponds to a phase delay in the first phase map, and the first phase map can indicate the distance information between the target object and the object ranging device (see equation (2) above for understanding).
[0068] Step 602: The object ranging device identifies the target area corresponding to the target object in the first image, and the second phase image corresponding to the target area in the first phase image.
[0069] Please see Figure 7 As shown, Figure 7This is a schematic diagram of the target region in the first image and the corresponding second phase image. The object ranging device identifies the target region in the first image, which is the location of the target object in the first image. The object ranging device confirms the target region in the first image and determines the corresponding second phase image in the first phase image based on the location of the target region.
[0070] The method by which an object ranging device identifies a target region is not limited. For example, in one possible implementation, the object ranging device has a built-in object recognition model, such as a neural network model. The object ranging device uses this model to identify the target object and mark its location. In another possible implementation, the target region can be the focus area of a Time-of-Flight (TOF) sensor. For example, the TOF sensor receives light waves reflected from the target object for autofocus. For instance, in the first image, the target object can be defined by a bounding box, which serves as the focus area. This target region can be understood as a region of interest (ROI), which is an image region selected from the image and is the focus area for image analysis.
[0071] Step 603: The object ranging device obtains the estimated distance between the target object and the TOF sensor based on the size information of the target object, wherein the size information includes the image size of the target object in the first image, or the actual physical size of the target object.
[0072] In method A, the size information of the target object is the image size of the target object.
[0073] In this application's embodiments, the category of the target object is not limited. For example, a human face is used as an example to illustrate the category of the target object. Please refer to... Figure 8 As shown, Figure 8 This is a schematic diagram showing the relationship between the number of pixels occupied by a face at different distances (first distance). Figure 8 This provides the number of pixels occupied by a human face in photos taken at different distances (the first distance) from a camera with all parameters fixed, for both adults and children. The first distance is... Figure 8 The multiple distances shown on the horizontal axis represent multiple preset image sizes. Figure 8 The vertical axis shows multiple dimensions. The number of pixels occupied by the face represents the image size of the face. As the first distance increases, the number of pixels occupied by the face decreases; conversely, as the first distance decreases, the number of pixels occupied by the face increases. Therefore, the approximate location of the face can be roughly determined by the number of pixels it occupies.
[0074] The object ranging device determines an estimated distance based on the image size of the target object and a preset relationship. This estimated distance can be understood as a rough distance. The object ranging device pre-stores size information, including multiple first distances and multiple preset image sizes, as well as a one-to-one correspondence between the multiple first distances and the multiple preset image sizes. The image size of the target object is the target preset image size among the multiple preset image sizes, and the estimated distance is the first distance that has a corresponding relationship with the target preset image size.
[0075] For example, please refer to the above. Figure 8 To understand this, image size = horizontal (H) pixels × vertical (V) pixels. Taking a child's face as an example, if the image size is 100 pixels, the first distance corresponding to 100 pixels is 0.6m. That is, when the image size of the target object is 100 pixels, the estimated distance can be obtained as 0.6m according to the preset relationship.
[0076] In this implementation, the object ranging device can determine an approximate distance (estimated distance) between the face and the ranging device based on the number of pixels occupied by the face in the first image.
[0077] In implementation B, the size information of the target object is its actual physical size. The category of the target object is illustrated using a human face as an example.
[0078] The object ranging device calculates multiple distances (also known as "second distances") between the target object and the TOF sensor based on the second phase map. Each of the multiple second distances corresponds to an estimated size of the target object.
[0079] The object ranging device calculates distances based on the second phase map. Due to potential phase entanglement, meaning it cannot determine which signal period corresponds to the actual distance to the target object, multiple different distances are calculated for different signal periods. For example, the object ranging device reconstructs the second phase map to calculate three distances, which correspond to the possible locations where a face might appear. Please refer to [link / reference]. Figure 9 To understand this, a face can appear at distances of 25cm, 75cm, and 125cm. For example, an object ranging device can calculate the corresponding face dimensions based on these three distances, resulting in estimated face widths of 5cm, 15cm, and 25cm. That is, when the face is at 25cm, the estimated face width is 5cm; when the face is at 75cm, the estimated face width is 15cm; and when the face is at 125cm, the estimated face width is 25cm.
[0080] A brief explanation of how to calculate face width is provided. For example, if the camera's field of view is known, say m degrees, in a grayscale image, the width of the first image occupies p pixels, and the width of the face occupies q pixels. Therefore, Figure 9 The angle α is calculated as shown in equation (9).
[0081]
[0082] Furthermore, according to The second distance, calculated using trigonometric formulas, can be used to estimate the width (estimated size) of the face. It should be noted that the number of second distances presented here is merely an example for illustrative purposes; in actual applications, the number of second distances may be greater.
[0083] The object ranging device matches the actual physical size of the target object with multiple estimated sizes to determine the estimated size of the target that matches the actual physical size.
[0084] For example, based on empirical values, the actual physical size of a face is 15cm (approximate width of a face). By matching the actual physical size of the target object with multiple estimated sizes (5cm, 15cm, and 25cm), the estimated size of the target is 15cm.
[0085] The object ranging device determines the second distance corresponding to the estimated size of the target as the estimated distance D. E .
[0086] The target estimated size (15cm) is the closest to the actual width of a human face (i.e., the actual physical size of a human face), so 75cm, which corresponds to 15cm, is chosen as the estimated distance.
[0087] In this implementation, the object ranging device can reconstruct the possible position of the target object based on the second phase map, calculate the estimated size of the target object based on multiple possible positions, and further select one estimated size (the closest to the actual physical size of the target object) from among the multiple estimated sizes, and use the second distance corresponding to the target estimated size as the estimated distance.
[0088] Step 604: The object ranging device calculates the unwrapping coefficient corresponding to each pixel in the target area based on the estimated distance and the second phase map.
[0089] The untangling coefficients are used to indicate the signal period corresponding to the actual position of the target object. Please refer to [link / reference]. Figure 3aTraditional single-frequency ranging technology can calculate the possible positions of multiple measured objects, but it cannot determine which signal period corresponds to the true position of the measured object. In this embodiment, the signal period corresponding to the true position of the measured object can be represented by the unwrapping coefficient. Since the maximum distance that the object ranging device can measure within one signal period is an ambiguity distance, the unwrapping coefficient can also be understood as: indicating which ambiguity distance the actual position of the target object is within.
[0090] The object ranging device calculates the untangling coefficient according to the following formula (10):
[0091]
[0092] Where N represents the unwrapping coefficient, round represents rounding calculation, and D E U represents the estimated distance, and U represents the fuzzy distance. This indicates a phase delay.
[0093] In one specific implementation, since a face has depth, the phase delay corresponding to pixels in the target region may exhibit phase flipping. Specifically, the target region corresponding to the face in the first image includes a first region and a second region. The first and second regions are spatially continuous without depth jumps; that is, the entire face region is smooth in the grayscale image (RGB image).
[0094] Phase flipping refers to a situation where the first phase delay and the second phase delay are not in the same signal period. The first phase delay is the phase delay corresponding to multiple pixels in the first region, and the second phase delay is the phase delay corresponding to multiple pixels in the second region. To illustrate the phase flipping phenomenon, consider a scenario where the first region corresponds to the tip of a face's nose, and the second region corresponds to the ears. The tip of the nose is closer to the object ranging device than the ears. If a signal period is [0 degrees, 360 degrees], the phase delay corresponding to at least one pixel in the tip of the nose is 355 degrees, while the phase delay corresponding to at least one pixel in the ear is 365 degrees. This means the phase delays corresponding to the tip of the nose and the ear are not in the same signal period, indicating a phase flip in the target region.
[0095] Based on whether there is a phase flip in the phase delay corresponding to the pixel in the target region, including the following cases 1 and 2.
[0096] Case 1: When the phase delays of multiple pixels in the target region do not exhibit phase flipping, the unwrapping coefficients for each pixel within the target region are identical. In this case, the unwrapping coefficients for all pixels within the target region are the same value, and the depth values of multiple pixels within the target region are close to the estimated distance D. E .
[0097] Case 2: When phase flipping occurs in the phase delays corresponding to multiple pixels in the target region, the unwrapping coefficients include a first unwrapping coefficient and a second unwrapping coefficient. The first phase delay is related to the first unwrapping coefficient, and the second phase delay is related to the second unwrapping coefficient. The first unwrapping coefficient is used to calculate the depth map corresponding to the first region, and the second unwrapping coefficient is used to calculate the depth map corresponding to the second region.
[0098] For example, substituting a first phase delay of 355 degrees into equation (10) above yields a first unwrapping coefficient N1, while substituting a phase delay of 5 degrees (a second phase delay of 365 degrees - 360 degrees) into equation (10) above yields a second unwrapping coefficient N2. For instance, N1 = 0 indicates that the tip of the nose corresponds to the first signal cycle, while N2 = 1 indicates that the ear corresponds to the second signal cycle. N1 and N2 indicate the actual positions corresponding to the first and second regions.
[0099] Step 605: The object ranging device determines the depth map of the target area based on the untangling coefficient and the second phase map.
[0100] The object ranging device calculates the actual distance corresponding to each pixel within the target area based on the unwrapping coefficient and the second phase map. The object ranging device can calculate the actual distance corresponding to each pixel according to the following formula (11).
[0101]
[0102] in, Where is the phase delay, N is the unwrapping coefficient, and U is the ambiguity distance.
[0103] In Case 1 above, the same unwrapping coefficient is used to calculate the actual distance for each pixel across the entire target area. In Case 2 above, the first region uses a first unwrapping coefficient to calculate the actual distance for each pixel within that region, while the second region uses a second unwrapping coefficient. That is, different unwrapping coefficients are used in different regions of the target area. For example, N1 = 0 indicates that the tip of the nose corresponds to the first signal cycle, while N2 = 1 indicates that the ear corresponds to the second signal cycle. N1 and N2 indicate the true positions corresponding to the first and second regions, respectively. Compared to the current single-frequency ranging technology, the object ranging device does not calculate the untangling coefficient. If the phase delay corresponding to the ear is 365 degrees, it will directly convert 365 degrees into 5 degrees (365 degrees - 360 degrees). According to the above formula (2), the distance is calculated. The distances corresponding to 5 degrees and 365 degrees are different. As a result, the depth values of the face region are not continuous. In this embodiment, N1 and N2 indicate the two signal cycles corresponding to the first region and the second region. The two signal cycles can indicate the real position corresponding to the first region and the second region, so that a continuous depth map is finally generated based on the target region corresponding to the face.
[0104] Based on equation (11) above, the object ranging device can calculate the actual distance corresponding to each pixel within the target area. To reconstruct the three-dimensional information of the real scene, further data processing is required. This is based on the two-dimensional coordinates of each pixel and the actual distance D corresponding to each pixel. r To solve for the three-dimensional coordinates of each pixel, please refer to equations (12) to (14) below.
[0105] Z w =D r Equation (14).
[0106] Among them, (u i ,v i Let ) represent the i-th pixel, u0, v0 represent the coordinates of the optical center in the image coordinate system, and f x f represents the focal length in the horizontal direction. y This indicates the focal length in the vertical direction. (X) w ,Y w Z w ) represents coordinates in the world coordinate system.
[0107] In this embodiment, the ranging device obtains the approximate distance (estimated distance) between the target object and the TOF sensor based on the size information of the target object. It can calculate the unwrapping coefficient corresponding to each pixel in the target region based on the estimated distance and the phase map. The unwrapping coefficient indicates the signal period corresponding to each pixel of the target object. Based on the unwrapping coefficient and the phase map of each pixel, the true distance corresponding to each pixel can be determined, thus obtaining the depth map of the target region. Compared to traditional methods, in single-frequency ranging technology, it is not necessary to reduce the modulation frequency to increase the ambiguity distance to obtain the depth map of the target region corresponding to the target object, thereby ensuring ranging accuracy.
[0108] In a specific embodiment, the aforementioned target object is illustrated using a human face as an example. In this embodiment, the category of the target object is not limited. In different application scenarios, the target object may belong to different categories. Before step 403, the above method may also include the following steps.
[0109] The object ranging device uses machine vision technology to identify the category to which the target object belongs, and queries the database for the object size information corresponding to each category based on the category to which the target object belongs.
[0110] For example, if the target object is classified as a face, the object ranging device queries the database for face size information. In method A above, this size information includes the size information as described in step 603 of the above embodiment. Size information a includes multiple first distances a and multiple preset face image sizes, as well as the correspondence between the multiple first distances a and the multiple preset face image sizes. In method B above, the face size information is the actual physical size of the face (e.g., face width 15cm).
[0111] Application scenarios of face ranging: 1. The object ranging device is an in-vehicle terminal. The in-vehicle terminal can accurately detect the driver's head position to determine whether the driver is sufficiently focused or fatigued, thereby initiating appropriate countermeasures. 2. The object ranging device is a mobile terminal (such as a mobile phone, tablet, etc.). Compared to traditional 2D face recognition technology, mobile terminal 3D face recognition offers more accurate biometric detection and higher security, enabling the object ranging method in this application to be applied to scenarios such as facial unlocking and mobile payment.
[0112] For example, if the target object is classified as a hand, the object ranging device queries the database for hand size information. In method A above, this size information includes size information b, which includes multiple first distances b and multiple preset hand image sizes, as well as the correspondence between the multiple first distances b and the multiple preset hand image sizes. In method B above, this size information is the actual physical size of the hand.
[0113] Applications of limb ranging: 1. In-vehicle terminals: The object ranging device detects the position of the user's hand during movement to control the in-vehicle entertainment system or air conditioning. 2. Smart TVs or computers: The object ranging device detects the user's hand position and outputs a corresponding game interface, thereby realizing human-computer interaction.
[0114] For example, if the target object is classified as a machine part, the object ranging device queries the database for the size information of the machine part. In method A above, this size information includes size information c, which includes multiple first distances c and multiple preset machine part image sizes, as well as the correspondence between the multiple first distances c and the multiple preset machine part image sizes. In method B above, this size information is the actual physical size of the machine part.
[0115] Application scenarios of machine part distance measurement. 1. The object distance measuring device is used in industrial robots. The object distance measuring device detects the position of machine parts, thereby enabling precise positioning and placement of the machine parts.
[0116] It should be noted that the categories of target objects and their corresponding application scenarios mentioned above are merely illustrative examples and do not constitute a limiting statement on this application.
[0117] Please see Figure 10 As shown, this application embodiment provides an object ranging device 1000, which is used to execute the method performed by the object ranging device in the above method embodiment. The object ranging device includes an acquisition module 1001 and a processing module 1002.
[0118] The acquisition module 1001 is used to acquire a first image and a first phase map corresponding to the first image using a time-of-flight (TOF) sensor.
[0119] Processing module 1002 is used to identify the target region corresponding to the target object in the first image, and the second phase image corresponding to the target region in the first phase image;
[0120] The processing module 1002 is further configured to obtain the estimated distance between the target object and the TOF sensor based on the size information of the target object, wherein the size information includes the image size of the target object in the first image, or the actual physical size of the target object;
[0121] The processing module 1002 is also used to calculate the unwrapping coefficients corresponding to each pixel in the target region based on the estimated distance and the second phase map;
[0122] The processing module 1002 is also used to determine the depth map of the target region based on the unwrapping coefficient and the second phase map.
[0123] Optionally, the functions of the acquisition module 1001 can be performed by a transceiver. The transceiver has sending and / or receiving capabilities. Optionally, the transceiver can be replaced by a receiver and / or a transmitter.
[0124] Alternatively, the functions of the acquisition module 1001 can also be executed by the processor.
[0125] Optionally, the processing module 1002 is a processor, which can be a general-purpose processor or a dedicated processor, etc. Optionally, the processor includes a transceiver unit for implementing receiving and transmitting functions. For example, this transceiver unit is a transceiver circuit, an interface, or an interface circuit. The transceiver circuit, interface, or interface circuit for implementing receiving and transmitting functions is deployed separately, or optionally, it is integrated together. The aforementioned transceiver circuit, interface, or interface circuit is used for reading or writing code or data, or for transmitting or relaying signals.
[0126] Furthermore, the acquisition module 1001 is used to execute step 601 in the above method embodiment, and the processing module 1002 is used to execute steps 602 to 605 in the above method embodiment.
[0127] In one specific implementation, the size information of the target object is the image size of the target object;
[0128] The processing module 1002 is further configured to determine the estimated distance based on the image size of the target object and a preset relationship, wherein the preset relationship indicates that multiple first distances correspond to multiple preset image sizes, the image size of the target object is the target preset image size among the multiple preset image sizes, and the estimated distance is the first distance that corresponds to the target preset image size.
[0129] In one specific implementation, the processing module 1002 is further configured to:
[0130] Based on the second phase map, multiple second distances between the target object and the TOF sensor are calculated, and each of the multiple second distances corresponds to an estimated size of the target object;
[0131] The actual physical size of the target object is matched with multiple estimated sizes to determine the target estimated size that matches the actual physical size;
[0132] The second distance corresponding to the estimated target size is determined as the estimated distance.
[0133] In one specific implementation, the processing module 1002 is further configured to:
[0134] Determine the category of the target object;
[0135] Obtain the size information of the target object based on its category.
[0136] In one specific implementation, the category of the target object is a human face.
[0137] In one specific implementation, the target area includes a first area and a second area;
[0138] When there is no phase flip in the phase delay corresponding to multiple pixels in the target region, the unwrapping coefficients corresponding to each pixel in the target region are the same; or, when there is a phase flip in the phase delay corresponding to multiple pixels in the target region, the unwrapping coefficients include a first unwrapping coefficient and a second unwrapping coefficient, wherein phase flip means that the first phase delay and the second phase delay are not in the same signal period, the first phase delay is the phase delay corresponding to multiple pixels in the first region, and the second phase delay is the phase delay corresponding to multiple pixels in the second region; the first phase delay is related to the first unwrapping coefficient, and the second phase delay is related to the second unwrapping coefficient; the first unwrapping coefficient is used to calculate the depth map corresponding to the first region, and the second unwrapping coefficient is used to calculate the depth map corresponding to the second region.
[0139] Please see Figure 11 As shown, this application embodiment provides an object ranging device 1100, which is used to execute the method executed by the object ranging device in the above method embodiment. Please refer to the description of the above method embodiment for details. The object ranging device includes, but is not limited to, mobile phones, computers, tablet computers, vehicle terminals, smart home devices (such as smart TVs), gaming devices, robots, etc. In this application embodiment, the object ranging device is described using a mobile phone as an example. The object ranging device 1100 includes components such as a processor 1101, a memory 1102, an input unit 1103, a display unit 1104, a TOF module 1105, a communication unit 1106, and an audio circuit 1107. The memory 1102 can be used to store software programs and modules. The processor 1101 executes various functional applications and data processing of the device by running the software programs and modules stored in the memory 1102. The memory 1102 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Optionally, the processor 1101 includes, but is not limited to, one or more of various types of processors, such as CPU, DSP, and image signal processor.
[0140] In one specific embodiment, processor 1101 is used to perform the above... Figure 5 The functions performed by the processing module.
[0141] The input unit 1103 can be used to receive input numerical or character information, and to generate key signal inputs related to user settings and function control of the device. Specifically, the input unit 1103 may include a touch panel 1131. The touch panel 1131, also known as a touch screen, can collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel 1131).
[0142] The display unit 1104 can be used to display various image information. The display unit 1104 may include a display panel 1141, which may optionally be configured as a liquid crystal display, an organic light-emitting diode, or the like. In some embodiments, the touch panel 1131 can be integrated with the display panel 1141 to realize the input and output functions of the device.
[0143] The TOF module 1105 generates a transmitted signal at a specific frequency, receives the reflected signal from the object being measured (target object), generates raw data based on the transmitted and reflected signals, and transmits the raw data to the processor 1101. The processor 1101 generates a grayscale image and a phase image based on the raw data, and generates a depth map corresponding to the target object based on the grayscale image and phase image. The structure of the TOF module 1105 is described above. Figure 5 We will understand the structure of the TOF module 40.
[0144] Communication unit 1106 is used to establish a communication channel, enabling the object ranging device to connect to a remote server through the communication channel and obtain object detection models and scene recognition models from the remote server. Communication unit 1106 may include communication modules such as a wireless local area network module, a Bluetooth module, and a baseband module, as well as corresponding radio frequency (RF) circuits for wireless local area network communication, Bluetooth communication, infrared communication, and / or cellular communication system communication. The communication modules control the communication of various components in the object ranging device and can support direct memory access.
[0145] Optionally, the various communication modules in communication unit 1106 generally appear in the form of integrated circuit chips and can be selectively combined, without necessarily including all communication modules and corresponding antenna groups. For example, communication unit 1106 may only include a baseband chip, a radio frequency chip, and a corresponding antenna to provide communication functionality in a cellular communication system. Through the wireless communication connection established via communication unit 1106, the object ranging device can connect to a cellular network or the Internet.
[0146] Audio circuit 1107, speaker 1108, and microphone 1109 provide an audio interface between the user and the mobile phone. Audio circuit 1107 converts received audio data into electrical signals and transmits them to speaker 1108, where speaker 1108 converts them into sound signals for output. Microphone 1109 converts collected sound signals into electrical signals, which are then received by audio circuit 1107, converted into audio data, and then processed by processor 1101 before being transmitted via communication unit 1106 to, for example, another mobile phone, or the audio data can be output to memory 1102 for further processing.
[0147] Although not shown, the object ranging device may include more components, such as a camera, power supply, etc., which will not be described in detail.
[0148] This application also provides a computer-readable storage medium for storing computer programs or instructions, which, when executed, cause the computer to perform the method of the object ranging device described in the above method embodiments.
[0149] This application provides a chip including a processor and a communication interface, such as an input / output interface, pins, or circuitry. The processor is used to read instructions to execute the method performed by the object ranging device in the above method embodiments.
[0150] This application also provides a computer program product, which includes computer program code. When the computer program code is executed by a computer or processor, the computer or processor implements the method performed by the object ranging device in the above method embodiments.
[0151] A computer program product includes one or more computer instructions. When the computer program instructions are loaded or executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more sets of available media. The available media can be magnetic media (e.g., floppy disk, hard disk, magnetic tape), optical media (e.g., DVD), or semiconductor media. Semiconductor media can be solid-state drives (SSDs).
[0152] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for measuring the distance of an object, characterized in that, include: A first image and a first phase map corresponding to the first image are acquired using a time-of-flight (TOF) sensor. Identify the target region corresponding to the target object in the first image, and the second phase map corresponding to the target region in the first phase map; The estimated distance between the target object and the TOF sensor is obtained based on the size information of the target object, wherein the size information includes the image size of the target object in the first image, or the actual physical size of the target object; Calculate the unwrapping coefficients for each pixel in the target region based on the estimated distance and the second phase map; The depth map of the target region is determined based on the unwrapping coefficient and the second phase map.
2. The method according to claim 1, characterized in that, The size information of the target object is the image size of the target object. Obtaining the estimated distance between the target object and the TOF sensor based on the target object's size information includes: The estimated distance is determined based on the image size of the target object and a preset relationship, wherein the preset relationship indicates that multiple first distances correspond to multiple preset image sizes, the image size of the target object is the target preset image size among the multiple preset image sizes, and the estimated distance is the first distance that corresponds to the target preset image size.
3. The method according to claim 1, characterized in that, The size information of the target object is the actual physical size of the target object. Obtaining the estimated distance between the target object and the TOF sensor based on the target object's size information includes: Based on the second phase map, a plurality of second distances between the target object and the TOF sensor are calculated, and each of the plurality of second distances corresponds to an estimated size of the target object; The actual physical size of the target object is matched with multiple estimated sizes to determine the target estimated size that matches the actual physical size; The second distance corresponding to the estimated target size is determined as the estimated distance.
4. The method according to any one of claims 1-3, characterized in that, Before obtaining the estimated distance between the target object and the TOF sensor based on the size information of the target object, the method includes: Determine the category of the target object; Obtain the size information of the target object according to the category.
5. The method according to any one of claims 1-3, characterized in that, The target object is classified as a human face.
6. The method according to any one of claims 1-3, characterized in that, The target area includes a first area and a second area; When the phase delay corresponding to multiple pixels in the target region does not have a phase flip, the unwrapping coefficient corresponding to each pixel in the target region is the same; or, When there is a phase flip in the phase delay corresponding to multiple pixels in the target region, the unwrapping coefficient includes a first unwrapping coefficient and a second unwrapping coefficient. The phase flip means that the first phase delay and the second phase delay are not in the same signal period. The first phase delay is the phase delay corresponding to multiple pixels in the first region, and the second phase delay is the phase delay corresponding to multiple pixels in the second region. The first phase delay is related to the first unwrapping coefficient, and the second phase delay is related to the second unwrapping coefficient; the first unwrapping coefficient is used to calculate the depth map corresponding to the first region, and the second unwrapping coefficient is used to calculate the depth map corresponding to the second region.
7. An object ranging device, characterized in that, include: The acquisition module is used to acquire a first image and a first phase map corresponding to the first image using a time-of-flight (TOF) sensor. The processing module is used to identify the target region corresponding to the target object in the first image, and the second phase map corresponding to the target region in the first phase map; The processing module is further configured to obtain an estimated distance between the target object and the TOF sensor based on the size information of the target object, wherein the size information includes the image size of the target object in the first image, or the actual physical size of the target object; The processing module is further configured to calculate the unwrapping coefficients corresponding to each pixel in the target region based on the estimated distance and the second phase map; The processing module is also used to determine the depth map of the target region based on the unwrapping coefficients and the second phase map.
8. The object ranging device according to claim 7, characterized in that, The size information of the target object is the image size of the target object; The processing module is further configured to determine the estimated distance based on the image size of the target object and a preset relationship, wherein the preset relationship indicates that multiple first distances correspond to multiple preset image sizes, the image size of the target object is the target preset image size among the multiple preset image sizes, and the estimated distance is the first distance that corresponds to the target preset image size.
9. The object ranging device according to claim 7, characterized in that, The processing module is also specifically used for: Based on the second phase map, a plurality of second distances between the target object and the TOF sensor are calculated, and each of the plurality of second distances corresponds to an estimated size of the target object; The actual physical size of the target object is matched with multiple estimated sizes to determine the target estimated size that matches the actual physical size; The second distance corresponding to the estimated target size is determined as the estimated distance.
10. The object ranging device according to any one of claims 7-9, characterized in that, The processing module is also specifically used for: Determine the category of the target object; Obtain the size information of the target object according to the category.
11. The object ranging device according to any one of claims 7-9, characterized in that, The target object is classified as a human face.
12. The object ranging device according to any one of claims 7-9, characterized in that, The target area includes a first area and a second area; When the phase delay corresponding to multiple pixels in the target region does not have a phase flip, the unwrapping coefficient corresponding to each pixel in the target region is the same; or, When there is a phase flip in the phase delay corresponding to multiple pixels in the target region, the unwrapping coefficient includes a first unwrapping coefficient and a second unwrapping coefficient. The phase flip means that the first phase delay and the second phase delay are not in the same signal period. The first phase delay is the phase delay corresponding to multiple pixels in the first region, and the second phase delay is the phase delay corresponding to multiple pixels in the second region. The first phase delay is related to the first unwrapping coefficient, and the second phase delay is related to the second unwrapping coefficient; the first unwrapping coefficient is used to calculate the depth map corresponding to the first region, and the second unwrapping coefficient is used to calculate the depth map corresponding to the second region.
13. An object ranging device, characterized in that, The device includes a processor coupled to at least one memory, the processor being configured to read a computer program stored in the at least one memory, causing the object ranging device to perform the method as described in any one of claims 1 to 6.
14. A computer-readable storage medium, characterized in that, Used to store computer programs or instructions, which, when executed, cause a computer or processor to perform the method as described in any one of claims 1 to 6.
15. A computer program product comprising instructions, characterized in that, When the instructions in the computer program product are executed by a computer or processor, the computer or processor performs the method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Multi-frequency phase unwrapping method and device
CN108519588A
Distance compensation method based on flight time and ranging method based on flight time
CN110109133A