WO2023077412A1 - Object distance measurement method and device - Google Patents

Object distance measurement method and device Download PDF

Info

Publication number
WO2023077412A1
WO2023077412A1 PCT/CN2021/128943 CN2021128943W WO2023077412A1 WO 2023077412 A1 WO2023077412 A1 WO 2023077412A1 CN 2021128943 W CN2021128943 W CN 2021128943W WO 2023077412 A1 WO2023077412 A1 WO 2023077412A1
Authority
WO
WIPO (PCT)
Prior art keywords
target object
target
distance
image
unwrapping
Prior art date
Application number
PCT/CN2021/128943
Other languages
French (fr)
Chinese (zh)
Inventor
罗鹏飞
唐样洋
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2021/128943 priority Critical patent/WO2023077412A1/en
Priority to CN202180099316.9A priority patent/CN117480408A/en
Publication of WO2023077412A1 publication Critical patent/WO2023077412A1/en

Links

Images

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01SRADIO DIRECTION-FINDING; RADIO NAVIGATION; DETERMINING DISTANCE OR VELOCITY BY USE OF RADIO WAVES; LOCATING OR PRESENCE-DETECTING BY USE OF THE REFLECTION OR RERADIATION OF RADIO WAVES; ANALOGOUS ARRANGEMENTS USING OTHER WAVES
    • G01S17/00Systems using the reflection or reradiation of electromagnetic waves other than radio waves, e.g. lidar systems
    • G01S17/02Systems using the reflection of electromagnetic waves other than radio waves
    • G01S17/06Systems determining position data of a target
    • G01S17/08Systems determining position data of a target for measuring distance only
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01SRADIO DIRECTION-FINDING; RADIO NAVIGATION; DETERMINING DISTANCE OR VELOCITY BY USE OF RADIO WAVES; LOCATING OR PRESENCE-DETECTING BY USE OF THE REFLECTION OR RERADIATION OF RADIO WAVES; ANALOGOUS ARRANGEMENTS USING OTHER WAVES
    • G01S17/00Systems using the reflection or reradiation of electromagnetic waves other than radio waves, e.g. lidar systems
    • G01S17/88Lidar systems specially adapted for specific applications
    • G01S17/89Lidar systems specially adapted for specific applications for mapping or imaging

Definitions

  • the present application relates to the technical field of three-dimensional distance measurement, and in particular to a method and device for object distance measurement.
  • the time of flight (TOF) ranging method mainly uses the round-trip flight time of the optical signal sent by the transmitter between the target object and the receiver to calculate the distance from the target object to the TOF ranging system.
  • the time of flight is more difficult.
  • the TOF ranging system can calculate the distance by measuring the phase delay between the transmitted signal and the reflected signal, and use the depth map to represent the distance information corresponding to the surface of the target object.
  • the TOF ranging system can use single-frequency ranging technology.
  • the single-frequency ranging technology means that the TOF ranging system uses a modulation frequency to transmit optical signals and performs ranging based on phase delay. Under this modulation frequency, the maximum distance that can be measured within one signal period is called the ambiguity distance. If the actual distance between the TOF ranging system and the target object exceeds the fuzzy distance, phase winding will occur. The phase winding phenomenon means that the measured value of the phase delay of the reflected signal may be different from the actual value. If the actual value exceeds one signal period, it will be subtracted by N 2 ⁇ (N is a positive integer), so that the measured value falls on the signal Period, so there may be a difference of N ⁇ 2 ⁇ between the actual value and the measured value.
  • the TOF ranging system when measuring the distance of an object exceeding 0.5 meters, the TOF ranging system will calculate the distance as a distance between 0 meters and 0.5 meters due to the phenomenon of phase winding, which causes the measured distance to be different from that of Phenomena where the real distance is different. Therefore, in the single-frequency ranging technology, in order to make the measured value the same as the real value, it is necessary to expand the fuzzy distance as much as possible.
  • the ambiguity distance is inversely correlated with the modulation frequency. In order to expand the measurable range, the modulation frequency can be reduced to increase the ambiguity distance. However, the modulation frequency is also related to the measurement accuracy, and reducing the modulation frequency will increase the measurement error.
  • the embodiment of the present application provides a TOF object ranging method.
  • the single-frequency ranging technology even if the position of the measured object exceeds the fuzzy distance, the real distance to the target object can be measured, and the measurement accuracy can be guaranteed.
  • an embodiment of the present application provides a method for measuring distance from an object, including: using a time-of-flight TOF sensor to acquire a first image and a first phase image corresponding to the first image; identifying a target area corresponding to a target object in the first image , and the second phase map corresponding to the target area in the first phase map; obtaining the estimated distance of the target object from the TOF sensor according to 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 area according to the estimated distance and the second phase map; determining the depth map of the target area according to the unwrapping coefficient and the second phase map.
  • the first image can be a grayscale image or a color image
  • the target area can be understood as a region of interest (ROI) area, and the target area is used for the object ranging device to pay attention to the phase image corresponding to the target object
  • the size information of the object obtains the estimated distance of the target object from the TOF sensor, which can be understood as an approximate distance from the target object to the TOF sensor
  • the unwrapping coefficient is used to indicate the real signal period corresponding to each pixel in the target area
  • the depth map Used to visualize the true distance corresponding to each pixel in the target area.
  • the unwrapping coefficient can indicate the signal cycle corresponding to the target object, and the unwrapping coefficient corresponding to each pixel can be determined, and the real distance corresponding to each pixel can be determined, even if the actual distance of the target object exceeds the fuzzy distance, the target can also be detected The actual distance of the object, and can guarantee the measurement accuracy.
  • the size information of the target object is the image size of the target object
  • the estimated distance between the target object and the TOF sensor is obtained according to the size information of the target object, including: according to the image size of the target object, and the preset relationship Determine the estimated distance, the preset relationship indicates that the multiple first distances have a corresponding relationship with 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 target preset image size. Assume that image sizes have a first distance of correspondence.
  • the image size is the number of pixels occupied by the target object in the first image
  • the object ranging device locally stores the corresponding relationship between multiple first distances and multiple preset image sizes, and the multiple first distances and multiple preset
  • the image size and corresponding relationship 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 one of the multiple preset image sizes For the target preset image size, based on the above preset relationship, it is determined that the estimated distance is the first distance having a corresponding relationship with the target preset image size.
  • the single-frequency ranging technology can calculate the possible signal periods corresponding to multiple measured objects ( Corresponding to the possible position), but it is impossible to determine which signal cycle the real position of the measured object corresponds to, which signal cycle the real position of the measured object corresponds to can be represented by the unwrapping coefficient.
  • the unwrapping coefficient can be calculated, that is to say, in the current single-frequency ranging technology, the unwrapping coefficient is not involved, but in this embodiment, the unwrapping technology can be calculated in the single-frequency ranging technology, and the object ranging device
  • the approximate distance between the target object and the object distance measuring device can be judged according to the number (number) of pixels occupied by the target area in the first image, so that the distance corresponding to each pixel in the target area can be calculated according to the approximate distance and the second phase map.
  • 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 according to the size information of the target object, including: calculating the distance between the target object and the TOF sensor according to the second phase map A plurality of second distances between the sensors, each of the plurality of second distances corresponds to an estimated size of a target object; matching the actual physical size of the target object with the plurality of estimated sizes, and determining the actual physical size The estimated size of the matched target; determining the second distance corresponding to the estimated size of the target as the estimated distance.
  • the object ranging device calculates multiple distances (also called “second distances") between the target object and the TOF sensor according to the second phase map, and the multiple second distances are the distance between the target object and the TOF Multiple possible distances, that is, the possible appearance positions of the target object, the object ranging device can calculate the estimated size of a target object according to each of the multiple second distances, that is, each second distance corresponds to a target The estimated size of the object; the object ranging device matches the actual physical size of the target object with a plurality of estimated sizes, and determines the estimated size of the target matching the actual physical size, wherein the actual physical size of the target object is an empirical value, for example, The category of the target object is a human face, and the actual width of the human face is about 15 cm; the object ranging device determines that the second distance corresponding to the estimated size of the target is the above estimated distance.
  • second distances also called "second distances”
  • the single-frequency ranging technology can calculate the possible signal periods corresponding to multiple measured objects ( Corresponding to the possible position), but it is not possible to determine which signal cycle the real position of the measured object corresponds to. Which signal cycle the real position of the measured object corresponds to can be represented by the unwrapping coefficient.
  • the unwrapping coefficient only in the multi-frequency ranging technology In order to calculate the unwrapping coefficient, that is to say, the current single-frequency ranging technology does not involve the unwrapping coefficient, but in this embodiment, the unwrapping technology can be calculated in the single-frequency ranging technology.
  • the distance device can select a second distance from a plurality of calculated distances (second distances) as an estimated distance according to the actual physical size of the target object, thereby being able to calculate the distance of each pixel in the target area according to the estimated distance and the second phase map.
  • second distances a plurality of calculated distances
  • the solution in this embodiment can save the power consumption of the object distance measuring device.
  • the method before obtaining the estimated distance between the target object and the TOF sensor according to the size information of the target object, the method includes: determining the category of the target object; The category obtains the size information of the target object.
  • the object ranging device can determine the category of the target object through machine vision technology.
  • the category of the target object can be human face, hand, machine part, etc.
  • the size information of the target object can be obtained by querying the database according to the category.
  • the database includes Dimensional information for various classes of objects.
  • the object ranging device can locally store size information of multiple types of objects, so that the above object ranging method can be applied to multiple types of objects, thus making the method suitable for various application scenarios.
  • the category of the target object is a human face.
  • the target area includes a first area and a second area; when there is no phase inversion in phase delays corresponding to multiple pixels in the target area, the unwrapping corresponding to each pixel in the target area
  • the coefficients are the same; or, when the phase delays corresponding to multiple pixels in the target area have phase inversion, the unwrapping coefficients include the first unwrapping coefficient and the second unwrapping coefficient, where the phase inversion refers to the first phase delay and the second phase delay
  • the two phase delays are not in the same signal cycle, the first phase delay is the phase delay corresponding to multiple pixels in the first area, and the second phase delay is the phase delay corresponding to multiple pixels in the second area; the first phase delay is the same as the first phase delay
  • the unwrapping coefficient is related, 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.
  • phase delay corresponding to the second area is 365 degrees, it will directly convert 365 degrees into 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 incoherence in the depth value of the target area.
  • N 1 and N 2 indicate the corresponding depths of the first area and the second area.
  • a signal period, where the signal period can indicate the actual distance corresponding to the first area and the second area, so that the depth of the target area is continuous and close to the above estimated distance.
  • the embodiment of the present application provides an object distance measuring device, including: an acquisition module, configured to use a time-of-flight TOF sensor to acquire a first image and a first phase image corresponding to the first image; a processing module, configured to identify 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; the processing module is also used to obtain the estimated distance of the target object from the TOF sensor according to 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 also used to calculate the unwrapping coefficient corresponding to each pixel in the target area according to the estimated distance and the second phase map; The processing module is further configured to determine the depth map of the target area according to the unwrapping coefficient and the second phase map.
  • 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 according to the image size of the target object and a preset relationship, and the preset relationship indicates a plurality of first The distance corresponds to a plurality of preset image sizes, the image size of the target object is the target preset image size in the plurality of preset image sizes, and the estimated distance is the first distance corresponding to the target preset image size.
  • the processing module is further specifically configured to: calculate a plurality of second distances between the target object and the TOF sensor according to the second phase map, and each second distance in the plurality of second distances corresponds to a The estimated size of the target object; matching the actual physical size of the target object with multiple estimated sizes to determine the estimated target size matching the actual physical size; determining the second distance corresponding to the estimated target size as the estimated distance.
  • the processing module is further specifically configured to: determine the category of the target object; and acquire size information of the target object according to the category.
  • the category of the target object is a human face.
  • the target area includes a first area and a second area; when there is no phase reversal in phase delays corresponding to multiple pixels in the target area, the unwrapping coefficients corresponding to each pixel in the target area are the same ;or,
  • the unwrapping coefficient When there is a phase inversion in the phase delays corresponding to multiple pixels in the target area, the unwrapping coefficient includes the first unwrapping coefficient and the second unwrapping coefficient, wherein the phase inversion means that the first phase delay and the second phase delay are not at the same One signal period, the first phase delay is the phase delay corresponding to multiple pixels in the first area, and the second phase delay is the phase delay corresponding to multiple pixels in the second area; the first phase delay is related to the first unwrapping coefficient, 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.
  • the embodiment of the present application provides an object ranging device, including a processor, the processor is coupled with at least one memory, and the processor is used to read the computer program stored in the at least one memory, so that The electronic device executes the method described in any one of the above first aspects.
  • the embodiment of the present application provides a computer-readable storage medium for storing computer programs or instructions, and when the computer programs or instructions are executed, the computer or processor executes any one of the above-mentioned first aspects. the method described.
  • the embodiment of the present application provides a computer program product including instructions, and when the instructions in the computer program product are executed by a computer or a processor, the computer or processor can realize any one of the above first aspects the method described.
  • FIG. 1 is a schematic diagram of the TOF ranging principle
  • FIG. 2 is a schematic diagram of a depth map
  • Figure 3a is a schematic diagram of a scene where a measured object may appear in the single-frequency ranging technique
  • Fig. 3b is a schematic diagram of the scene where the measured object may appear in the multi-frequency ranging technology
  • FIG. 4 is a schematic structural diagram of a ranging system in an embodiment of the present application.
  • FIG. 5 is a schematic diagram of a transmitted signal and a reflected signal in an embodiment of the present application
  • FIG. 6 is a schematic flow chart of the steps of an object ranging method in the embodiment of the present application.
  • FIG. 7 is a schematic diagram of a target area in the first image and a second phase image corresponding to the target area in the embodiment of the present application;
  • Fig. 8 is a relationship diagram of the number of pixels occupied by faces at different distances in the embodiment of the present application.
  • FIG. 9 is a schematic diagram of a plurality of second distances and the actual physical size of a human face corresponding to each second distance in the embodiment of the present application.
  • FIG. 10 is a schematic structural diagram of an embodiment of an object ranging device in the embodiment of the present application.
  • FIG. 11 is a schematic structural diagram of an embodiment of an electronic device in the embodiment of the present application.
  • plural means two or more than two.
  • At least one of the following or similar expressions refer to any combination of these items, including any combination of single or plural items.
  • at least one item (piece) of a, b, or c can represent: a, b, c, a and b, a and c, b and c, or a and b and c, wherein a, b, c can be single or multiple.
  • words such as “first” and “second” are used to distinguish the same or similar items with basically the same function and effect. Those skilled in the art can understand that words such as “first” and “second” do not limit the number and execution order, and words such as “first” and “second” do not necessarily limit the difference.
  • words such as “exemplary” or “for example” are used to represent examples, illustrations or descriptions. Any embodiment or design solution described as “exemplary” or “for example” in the embodiments of the present application shall not be interpreted as being more preferred or more advantageous than other embodiments or design solutions. Rather, the use of words such as “exemplary” or “such as” is intended to present relevant concepts in a concrete manner for easy understanding.
  • the modulated light source When measuring the distance of the measured object, the modulated light source emits a high-frequency infrared modulation signal to illuminate the target object, and then the modulated signal is reflected back to the sensor of the TOF ranging system surface, a distance-dependent phase delay occurs.
  • the TOF sensor receives and demodulates the phase delay caused by the flight process, and then calculates the distance between the sensor and the target object based on known quantities such as light flight speed and modulation frequency.
  • each pixel unit in the TOF sensor array is required to independently receive and demodulate the distance from each corresponding point on the object surface information, and then obtain the depth map of the target object.
  • a depth image also called a range image, refers to an image in which the distance (depth) of each point on the measured object is collected as a pixel value.
  • the depth map directly reflects the geometry of the visible surface of the measured object. Please refer to FIG. 2, the visualized depth map is shown in FIG. 2, different depth values are mapped to different colors, and thus the depth map is visualized in a color image.
  • TOF ranging includes single-frequency ranging technology and multi-frequency ranging technology.
  • the range of the traditional single-frequency ranging technology is limited. Under the single-frequency modulation frequency, it can only measure the objects within the fuzzy distance (as shown in the following formula (1)) and measure the distance according to the following formula (2). If the measured object If the position exceeds the ambiguity distance, the phenomenon of phase winding will appear. Please refer to Figure 3a for understanding.
  • the single-frequency ranging technology can calculate the possible positions of multiple measured objects, but it cannot determine which signal period the real position of the measured object corresponds to. Among them, which signal corresponds to the real position of the measured object The period can be represented by the unwrapping coefficient.
  • the modulation frequency is reduced, thereby expanding the fuzzy distance, so that the real distance of the measured object can fall within the range of the fuzzy distance, so that the measured object can be accurately measured, but this This method will reduce the measurement accuracy.
  • multi-frequency ranging technology that is, add one or more modulating frequency modulation waves to measure the distance of the measured object in sequence, as shown in Figure 3b
  • each modulating frequency will correspond to a fuzzy distance
  • the real distance is how much
  • the beating frequency will generally be lower, allowing longer measurement distances to be extended.
  • modulation frequency a 100MHz
  • the ambiguity distance U 100MHz corresponding to modulation frequency a 1.5m
  • modulation frequency b 80MHz
  • the ambiguity distance U 80MHz corresponding to modulation frequency b 1.875m
  • the multi-frequency ranging technology can accurately measure the real distance of the measured object
  • the multi-frequency ranging technology will increase the power consumption of the ranging system, reduce the frame rate, and limit the application scenarios of the ranging system.
  • c is the speed of light
  • F is the modulation frequency
  • the ranging system includes a TOF module 40 and a processing module 41, wherein the TOF module 40 includes a TOF chip 403, a laser 402 and a lens 404 (including a filter).
  • the TOF chip 403 includes a ToF sensor 4033 , a controller 4031 and an analog-to-digital converter (analog-to-digital converter, ADC) 4032 .
  • the controller 4031 is used for generating a transmission signal of a certain modulation frequency.
  • a measure of a signal waveform change usually in degrees (angles).
  • the emitted infrared continuous optical signal i.e. the transmitted signal
  • the transmitted signal also called "light wave signal”
  • t represents the time
  • represents the angular velocity
  • ⁇ t represents the angle
  • the controller 4031 sends electrical signals to the laser driver 401 and the TOF sensor 4033 respectively.
  • the laser driver 401 is used to drive the laser 402 according to the change of the electrical signal, and the laser 402 is used to emit the corresponding optical wave signal s(t).
  • the light wave signal is reflected by the measured object, the lens 404 is used to receive the reflected signal and send the reflected signal to the TOF sensor, the TOF sensor 4033 is used to receive the reflected signal g(t), and the reflected signal g(t) contains phase delay
  • the modulated cosine signal and the reflected signal g(t) can be expressed by the following formula (4).
  • phase delay represents the propagation delay of light waves during flight.
  • the TOF sensor 4033 is also used for mixing and integrating s(t) and g(t) (as shown in the following formula 5) to obtain the integral value, which is output to the processing module 41 through the ADC4032, and the processing module 41 is used to process the integral value Phase calculation and intensity calculation, so as to obtain the grayscale image and phase image of the measured object.
  • s(t) represents the transmitted signal
  • g(t) represents the reflected signal
  • the 4 different ⁇ values are respectively substituted into the above formula (5), A four-phase integrated value (also called 4-phase bare data) is obtained.
  • the ADC4032 outputs the four-phase integral value to the processing module 41 .
  • the processing module 41 is used to perform phase calculation (as shown in the following formula (6)) and intensity calculation (as shown in the following formula (7) and formula (8)) according to the four-phase bare data.
  • the phase delay in the following equation (6) For obtaining the phase image of the object under test, the intensity B in the following formula (7) can be used to obtain the grayscale image of the object under test.
  • may be 0° or 90°.
  • the processing module 41 is used to identify the target area corresponding to the target object in the grayscale image, and the phase image corresponding to the target area; the processing module 41 can obtain the estimated distance from the target object to the TOF sensor 4033 according to the size information of the target object, and according to the estimated distance and The phase map calculates the unwrapping coefficient corresponding to each pixel in the target area, determines the unwrapping coefficient, that is, determines the signal period corresponding to each pixel in the target area, and then can determine the target according to the unwrapping coefficient and the phase map corresponding to the target area Depth map of the region.
  • the unwrapping coefficient corresponding to each pixel in the target area After determining the unwrapping coefficient corresponding to each pixel, the real distance corresponding to each pixel can be determined. Even if the actual distance of the target object exceeds the fuzzy distance, the target can also be detected The actual distance of the object, and can guarantee the measurement accuracy.
  • An object ranging method provided in an embodiment of the present application may be executed by an object ranging device.
  • the structure of the object ranging device is as shown in FIG. 4 above.
  • the object ranging device includes a TOF module and a processing module.
  • the TOF module and the processing module are integrated in the same in the device.
  • the object distance measuring device is a dedicated distance measuring device, or the object distance measuring device may be a terminal. Terminals include but are not limited to mobile phones, computers, tablet computers, vehicle terminals, smart homes (such as smart TVs), game devices, robots, etc.
  • the TOF module and the processing module can be respectively set in different devices.
  • the TOF module is set in the TOF camera
  • the processing module is set in the object distance measuring device
  • the TOF camera and the object distance measuring device are connected in communication
  • the object distance measuring device can be a terminal
  • the object distance measuring device can also be a terminal
  • the terminals include but are not limited to mobile phones, computers, tablet computers, vehicle terminals, smart homes (such as smart motors), game devices, robots, etc.
  • the object ranging device performs the following steps 601 to 605 .
  • Step 601. The object ranging device acquires a first image and a first phase map corresponding to the first image by using a TOF sensor.
  • the object ranging device uses the TOF sensor to acquire the first image.
  • the first image is a grayscale image of the scene to be photographed.
  • the first image is obtained by using the above formula (7) or the above formula (8).
  • the object ranging device further includes a color image sensor, the first image may also be an RGB (red, green, blue) image.
  • the object ranging device is a mobile phone, the mobile phone includes a color image sensor, and the first image is an RGB image collected by the mobile phone through the color image sensor.
  • the object ranging device uses the TOF sensor to obtain raw data (or called raw data), and calculates the gray value corresponding to each pixel in the first image and the phase delay corresponding to the light wave flight time according to the raw data, and then obtains the corresponding phase delay of the first image.
  • the first phase diagram of Based on the principle of TOF ranging, when measuring the distance of the target object, the modulated light source emits a high-frequency infrared modulation signal to irradiate the target object, and then when the modulated signal is reflected back to the surface of the TOF sensor, a distance-related phase delay occurs.
  • 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 distance measuring device (refer to the above formula (2) for understanding).
  • Step 602 the object ranging device identifies a target area corresponding to the target object in the first image, and a second phase image corresponding to the target area in the first phase image.
  • FIG. 7 is a schematic diagram of a target area of the first image and a second phase map corresponding to the target area.
  • the object ranging device identifies a target area in the first image, where the target area is a position corresponding to the target object in the first image.
  • the object ranging device confirms the target area in the first image, and determines the second phase map corresponding to the target area in the first phase map according to the position of the target area.
  • the object distance measuring device has a built-in object recognition model, such as the object recognition model can be a neural network model, and the object distance measuring device uses the object recognition model to identify the target object and mark the target object location information.
  • the target area can also be the focus area of the TOF sensor.
  • the TOF sensor receives the light waves reflected by the target object to perform automatic focusing.
  • the target object can pass through one side
  • the area enclosed by the frame is the focus area.
  • the target area can be understood as a region of interest (region of interest, ROI).
  • the ROI area is an image area selected from an image, and this area is a key area for image analysis.
  • Step 603 the object ranging device obtains the estimated distance of the target object from the TOF sensor according to 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 size information of the target object is the image size of the target object.
  • the category of the target object is not limited.
  • the category of the target object is illustrated by taking a human face as an example.
  • FIG. 8 is a schematic diagram of the relationship between the number of pixels occupied by faces at different distances (the first distance).
  • Figure 8 shows the number of pixels occupied by human faces captured by adults and children at different distances (first distance) from a certain camera with all parameters determined.
  • the first distance is the multiple distances shown on the horizontal axis in FIG. 8
  • the multiple preset image sizes are the multiple sizes shown on the vertical axis in FIG. 8 .
  • the number of pixels occupied by the face is the image size of the face.
  • the approximate position of the face can be roughly judged by the number of pixels occupied by the face.
  • the object ranging device determines the estimated distance according to the image size of the target object and a preset relationship.
  • the estimated distance can be understood as an approximate distance.
  • the object ranging device stores size information in advance, and the size information includes a plurality of first distances and a plurality of preset image sizes, and a one-to-one correspondence between the plurality of first distances and the plurality of preset image sizes.
  • the image size of the target object is a target preset image size among the multiple preset image sizes, and the estimated distance is a first distance corresponding to the target preset image size.
  • image size horizontal H (horizontal) pixels ⁇ vertical V (vertical).
  • the target object takes a child's face as an example.
  • the image size is 100 pixels, and the first distance corresponding to 100 pixels is 0.6m. That is, when the image size of the target object is 100 pixels, it can be obtained according to the preset relationship The estimated distance is 0.6m.
  • the object ranging device may determine an approximate distance (estimated distance) between the human face and the ranging device according to the number of pixels occupied by the human face in the first image.
  • the size information of the target object is the actual physical size of the target object.
  • the category of the target object is illustrated by taking a human face as an example.
  • the object ranging device calculates a plurality of distances (also referred to as "second distances") between the target object and the TOF sensor according to the second phase map, and each second distance in the plurality of second distances corresponds to an estimate of a target object size.
  • the object distance measuring device performs calculations based on the second phase diagram. Since there may be a phase winding phenomenon, that is, it is impossible to determine which signal period the actual distance of the target object corresponds to, multiple different distances will be calculated for different signal periods.
  • the object ranging device restores and calculates three distances from the second phase image, and the positions corresponding to these three distances are positions where human faces may appear. Please refer to Fig. 9 for understanding, the positions where faces may appear are 25cm, 75cm and 125cm respectively.
  • the object ranging device calculates the corresponding three human face sizes according to the three distances, and the human face widths (estimated sizes) can be calculated to be 5cm, 15cm and 25cm respectively.
  • the estimated width of the corresponding face is 5cm; when the face position is 75cm, the estimated width of the corresponding face is 15cm; when the face position is 125cm, the estimated width of the corresponding face is 25cm.
  • the field of view of the camera is known.
  • the field of view is m degrees.
  • the width of the first image occupies p pixels, and the width of the face occupies q pixels. Therefore, FIG. 9
  • the middle ⁇ angle is calculated according to the following formula (9).
  • the estimated width (estimated size) of the human face can be calculated through a trigonometric calculation formula. It should be noted that the number of the second distances here is just an example for convenience of description, and the number of the second distances may be more in a process of actual application.
  • the object ranging device matches the actual physical size of the target object with a plurality of estimated sizes to determine the estimated size of the target that matches the actual physical size.
  • the actual physical size of the human face is 15cm (the approximate width of the human face), and the actual physical size of the target object is matched with multiple estimated sizes (5cm, 15cm and 25cm), then the target estimated size It is 15cm.
  • the object ranging device determines that the second distance corresponding to the estimated size of the target is the estimated distance D E .
  • the target estimated size (15cm) is the size closest to the real face width (that is, the actual physical size of the face), so 75cm corresponding to 15cm is selected as the estimated distance.
  • the object ranging device can restore the possible position of the target object according to the second phase map, and can calculate the estimated size of the target object based on multiple possible positions, and further, select An estimated size (target estimated size) that matches (closest to) the actual physical size of the target object, and the second distance corresponding to the estimated target size is used as the estimated distance.
  • Step 604 the object ranging device calculates the unwrapping coefficient corresponding to each pixel in the target area according to the estimated distance and the second phase map.
  • the unwrapping coefficient is used to indicate the signal period corresponding to the actual position of the target object. Please refer to FIG. 3a for understanding.
  • the traditional single-frequency ranging technology can calculate the possible positions of multiple measured objects, but cannot determine which signal period the real position of the measured object corresponds to.
  • which signal cycle corresponds to the real position of the measured object can be represented by the unwrapping coefficient. Since the maximum distance that the object distance measuring device can measure within one signal period is an ambiguity distance, the unwrapping coefficient can also be understood as: used to indicate which ambiguity distance the actual position of the target object is within.
  • the object ranging device calculates the unwrapping coefficient according to the following formula (10):
  • N represents the unwrapping coefficient
  • round represents rounding calculation
  • D E represents the estimated distance
  • U represents the fuzzy distance
  • the human face since the human face has depth, there may be a phase reversal in the phase delay corresponding to the pixels in the target area.
  • the target area corresponding to the face in the first image includes the first area and the second area, and the first area and the second area are spatially continuous without depth jump, that is to say, in the grayscale image (RGB image)
  • RGB image grayscale image
  • Phase inversion means that the first phase delay and the second phase delay are not in the same signal cycle, the first phase delay is the phase delay corresponding to multiple pixels in the first area, and the second phase delay is the phase delay corresponding to multiple pixels in the second area phase delay.
  • the first area is the area corresponding to the nose tip area of the human face
  • the second area is the area corresponding to the ears of the human face. The position of the nose tip is closer to the object distance measuring device than the position of the ear.
  • a signal period is [0 degrees, 360 degrees]
  • the phase delay corresponding to at least one pixel in the nose tip area is 355 degrees
  • the phase delay corresponding to at least one pixel in the ear area is 365 degrees, that is, the phase delay corresponding to the nose tip area and the ear If the phase delay corresponding to the region is not within one signal period, it indicates that there is a phase inversion in the target region.
  • Case 1 When the phase delays corresponding to multiple pixels in the target area do not have phase inversion, the unwrapping coefficients corresponding to each pixel in the target area are the same. In this case, the unwrapping coefficients corresponding to all the pixels in the target area are the same value, and the depth values of multiple pixels in the target area are close to the estimated distance D E .
  • the unwrapping coefficients include a first unwrapping coefficient and a second unwrapping coefficient.
  • the first phase delay is related to the first unwrapping coefficient
  • 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
  • the second unwrapping coefficient is used to calculate the depth map corresponding to the second region.
  • the first phase delay of 355 degrees is substituted into the above (10) to obtain the first unwrapping coefficient N 1
  • the phase delay of 5 degrees is substituted into the above formula (10)
  • the second unwrapping coefficient N 2 is obtained.
  • N1 and N2 indicate the real positions corresponding to the first area and the second area.
  • Step 605 the object ranging device determines the depth map of the target area according to the unwrapping coefficient and the second phase map.
  • the object ranging device calculates the actual distance corresponding to each pixel in the target area according to 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).
  • the entire object area uses the same unwrapping coefficient to calculate the actual distance corresponding to each pixel.
  • the first area uses the first unwrapping coefficient to calculate the actual distance corresponding to each pixel in the first area
  • the second area uses the second unwrapping coefficient to calculate the actual distance corresponding to each pixel in the second area , that is, different unwrapping coefficients are used in different regions within the target region.
  • N 1 0 indicates that the tip of the nose corresponds to the first signal period
  • N1 and N2 indicate the corresponding real positions of the first area and the second area.
  • the object ranging device will not calculate the unwrapping 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) is used to calculate the distance, and the corresponding distances of 5 degrees and 365 degrees are different, thus, the depth value of the face area will be incoherent, and in this embodiment, N1 and N2 indicate the first The two signal periods corresponding to the area and the second area can indicate the real positions corresponding to the first area and the second area, so that a coherent depth map can be finally generated based on the target area corresponding to the face.
  • the object ranging device can calculate the actual distance corresponding to each pixel in the target area.
  • further data processing is required.
  • the three-dimensional coordinates corresponding to each pixel are calculated according to the two-dimensional coordinates of each pixel and the real distance D r corresponding to each pixel, please refer to the following formulas (12) to (14).
  • (u i , v i ) represents the i-th pixel point
  • u 0 , v 0 represent the coordinates of the optical center in the image coordinate system
  • f x represents the focal length in the horizontal direction
  • f y represents the focal length in the vertical direction
  • (X w , Y w , Z w ) represent coordinates in the world coordinate system.
  • the ranging device obtains the approximate distance (estimated distance) between the target object and the TOF sensor according to the size information of the target object, and can calculate the solution corresponding to each pixel in the target area according to the estimated distance and the phase map.
  • the unwrapping coefficient and unwrapping coefficient can indicate the signal cycle of each pixel corresponding to the target object.
  • the real distance corresponding to each pixel can be determined, that is, the depth map of the target area can be obtained.
  • the depth map of the target area corresponding to the target object can be obtained without reducing the modulation frequency to increase the blur distance, thereby ensuring the ranging accuracy.
  • the above-mentioned target objects are illustrated by taking human faces as an example.
  • the category of the target object is not limited. In different application scenarios, the target object may belong to different categories.
  • the above method may further include the following steps.
  • the object ranging device uses machine vision technology to identify the category to which the target object belongs, and queries the object size information corresponding to each category that has been stored in the database according to the category to which the target object belongs.
  • the category of the target object is a human face
  • the object ranging device queries the size information of the human face in the database.
  • the size information includes the size information in step 603 in the above embodiment
  • the size information a includes multiple first distances a and multiple preset face image sizes, and multiple first distances a and Correspondence of multiple preset face image sizes.
  • the size information of the human face is the actual physical size of the human face (eg, the width of the human face is 15 cm).
  • the object ranging device is a vehicle-mounted terminal.
  • the vehicle-mounted terminal can accurately detect the position of the driver's head to judge whether the driver is focused enough and whether he is driving fatigued, so as to initiate corresponding countermeasures.
  • the object ranging device is a mobile terminal (such as a mobile phone, a tablet computer, etc.). Compared with the traditional 2D face recognition technology, the mobile terminal recognizes 3D faces, and the bioactivity detection is accurate and safe, so that the embodiments of the present application
  • the object ranging method in the paper is applied to face unlocking, mobile payment application scenarios, etc.
  • the object ranging device queries the size information of the hand in the database.
  • the size information includes size information b
  • the size information b includes a plurality of first distances b and a plurality of preset hand image sizes, and a plurality of first distances b and a plurality of preset hand image sizes corresponding relationship.
  • the size information is the actual physical size of the hand.
  • the object ranging device is a vehicle-mounted terminal.
  • the object ranging device detects various positions of the user's hand during the movement process to control the vehicle entertainment system or the vehicle air conditioner.
  • the object distance measuring device is a smart TV or a computer. The object distance measuring device detects the position of the user's hand and outputs a corresponding game interface to realize human-computer interaction.
  • the type of the target object is a machine part
  • the object ranging device queries the size information of the machine part in the database.
  • the size information includes size information c
  • the size information c includes a plurality of first distances c and a plurality of preset machine part image sizes, and a plurality of first distances c and a plurality of preset machine part image sizes corresponding relationship.
  • the size information is the actual physical size of the machine parts.
  • the object distance measuring device is an industrial robot, and the object distance measuring device detects the position of the machine parts, so that the machine parts can be accurately positioned and placed.
  • an embodiment of the present application provides an object distance measuring device 1000 , which is used to execute the method performed by the object distance measuring device in the foregoing method embodiments.
  • the object ranging device includes an acquisition module 1001 and a processing module 1002 .
  • An acquisition module 1001 configured to acquire a first image and a first phase map corresponding to the first image by using a time-of-flight TOF sensor;
  • a processing module 1002 configured to identify a target area corresponding to the target object in the first image, and a second phase image corresponding to the target area in the first phase image;
  • the processing module 1002 is further configured to acquire the estimated distance of the target object from the TOF sensor according to 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 1002 is further configured to calculate an unwrapping coefficient corresponding to each pixel in the target area according to the estimated distance and the second phase map;
  • the processing module 1002 is further configured to determine a depth map of the target area according to the unwrapping coefficient and the second phase map.
  • the function of the obtaining module 1001 may be performed by a transceiver.
  • the transceiver has the function of sending and/or receiving.
  • the transceiver is replaced by a receiver and/or transmitter.
  • the function of the obtaining module 1001 may also be executed by a processor.
  • the processing module 1002 is a processor, and the processor is a general-purpose processor or a special-purpose processor.
  • the processor includes a transceiver unit configured to implement receiving and sending functions.
  • the transceiver unit is a transceiver circuit, or an interface, or an interface circuit.
  • the transceiver circuits, interfaces or interface circuits for realizing the functions of receiving and sending are deployed separately, and optionally integrated together.
  • the above-mentioned transceiver circuit, interface or interface circuit is used for reading and writing codes or data, or the above-mentioned transceiver circuit, interface or interface circuit is used for signal transmission or transmission.
  • the acquiring module 1001 is configured to execute step 601 in the above method embodiment
  • the processing module 1002 is configured to execute step 602 to step 605 in the above method embodiment.
  • the size information of the target object is the image size of the target object
  • the processing module 1002 is further configured to determine the estimated distance according to the image size of the target object and a preset relationship, the preset relationship indicates that multiple first distances have a corresponding relationship with multiple preset image sizes, and the image size of the target object is multiple
  • the estimated distance of the target preset image size in the preset image size is the first distance corresponding to the target preset image size.
  • processing module 1002 is also specifically configured to:
  • the second distance corresponding to the estimated size of the target is determined as the estimated distance.
  • processing module 1002 is also specifically configured to:
  • the category of the target object is a human face.
  • the target area includes a first area and a second area
  • the unwrapping coefficient includes the first unwrapping coefficient and the second unwrapping coefficient, wherein, the phase inversion means that the first phase delay and the second phase delay are not in the same signal period, and the first phase delay is corresponding to multiple pixels in the first area
  • the second phase delay is the phase delay corresponding to multiple pixels in the second area; 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 It 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.
  • the embodiment of the present application provides an object distance measuring device 1100, the object distance measuring device is used to execute the method performed by the object distance measuring device in the above method embodiment, please refer to the above method embodiment for details illustrate.
  • Object ranging devices include but are not limited to mobile phones, computers, tablet computers, vehicle terminals, smart homes (such as smart TVs), game devices, robots, etc.
  • a mobile phone is taken as an example of an object distance measuring device for description.
  • the object ranging device 1100 includes a processor 1101 , a memory 1102 , an input unit 1103 , a display unit 1104 , a TOF module 1105 , a communication unit 1106 , an audio circuit 1107 and other components.
  • the memory 1102 can be used to store software programs and modules, and 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 a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage devices.
  • the processor 1101 includes, but is not limited to, various types of processors, such as one or more of a CPU, a DSP, and an image signal processor.
  • the processor 1101 is configured to execute the functions executed by the processing modules in FIG. 5 above.
  • the input unit 1103 can be used to receive inputted number or character information, and generate key signal input related to user settings and function control of the device.
  • the input unit 1103 may include a touch panel 1131 .
  • the touch panel 1131 also referred to as a touch screen, can collect touch operations of the user on or near it (for example, the user uses any suitable object or accessory such as a finger or a stylus on the touch panel 1131 or near the touch panel 1131). operate).
  • the display unit 1104 can be used to display various image information.
  • the display unit 1104 may include a display panel 1141.
  • the display panel 1141 may be configured in the form of a liquid crystal display, an organic light emitting diode, or the like.
  • the touch panel 1131 can be integrated with the display panel 1141 to realize the input and output functions of the device.
  • the TOF module 1105 is used to generate a transmission signal of a certain frequency, receive the reflection signal reflected by the object under test (target object), generate raw data according to the transmission signal and the reflection signal, and transmit the raw data to the processor 1101 .
  • the processor 1101 is configured to generate a grayscale image and a phase image according to the raw data, and generate a depth image corresponding to the target object according to the grayscale image and the phase image.
  • the TOF module 1105 please refer to the structure of the TOF module 40 in FIG. 5 above for understanding.
  • the communication unit 1106 is configured to establish a communication channel, so that the object distance measuring device is connected to a remote server through the communication channel, and obtain an object detection model and a scene recognition model from the remote server.
  • the communication unit 1106 may include communication modules such as a wireless local area network module, a bluetooth module, a baseband module, and a radio frequency (radio frequency, RF) circuit corresponding to the communication module, for performing wireless local area network communication, Bluetooth communication, infrared communication and/or cellular communication. Communication system communication.
  • the communication module is used to control the communication of each component in the object ranging device, and can support direct memory access.
  • various communication modules in the communication unit 1106 generally appear in the form of integrated circuit chips, and can be selectively combined without including all communication modules and corresponding antenna groups.
  • the communication unit 1106 may only include a baseband chip, a radio frequency chip and corresponding antennas to provide communication functions in a cellular communication system.
  • the object ranging device Via the wireless communication connection established by the communication unit 1106, the object ranging device can be connected to a cellular network or the Internet.
  • Audio circuitry 1107, speaker 1108, and microphone 1109 may provide an audio interface between the user and the handset.
  • the audio circuit 1107 can transmit the electrical signal converted from the received audio data to the speaker 1108, and the speaker 1108 converts it into an audio signal for output.
  • the microphone 1109 converts the collected sound signal into an electrical signal, which is converted into audio data after being received by the audio circuit 1107, and then the audio data is processed by the output processor 1101, and then sent to, for example, another mobile phone through the communication unit 1106, or the audio data Output to memory 1102 for further processing.
  • the object ranging device may also include more components, such as a camera, a power supply, etc., which will not be described in detail.
  • the embodiment of the present application also provides a computer-readable storage medium for storing computer programs or instructions.
  • the computer programs or instructions When executed, the computer executes the method of the object distance measuring device in the above method embodiments.
  • An embodiment of the present application provides a chip, and the chip includes a processor and a communication interface, where the communication interface is, for example, an input/output interface, a pin, or a circuit.
  • the processor is used to read instructions to execute the method executed by the object ranging device in the above method embodiment.
  • the embodiment of the present application also provides a computer program product.
  • the computer program product includes computer program code.
  • the computer program code When executed by a computer or a processor, the computer or processor implements the object distance measuring device in the above method embodiment. Methods.
  • a computer program product includes one or more computer instructions. When the computer program instructions are loaded or executed on the computer, the processes or functions according to the embodiments of the present application will be generated in whole or in part.
  • the computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable devices.
  • Computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, e.g. Coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) to another website site, computer, server or data center.
  • DSL digital subscriber line
  • the computer-readable storage medium may be any available medium that can be accessed by a computer, or a data storage device such as a server or a data center that includes one or more sets of available media.
  • the available media may be magnetic media (eg, floppy disk, hard disk, magnetic tape), optical media (eg, DVD), or semiconductor media.
  • the semiconductor medium may be a solid state drive (SSD).

Abstract

An object distance measurement method and device. The method comprises: acquiring a first image and a first phase map corresponding to the first image by using a time of flight (ToF) sensor (4033) (601); recognizing a target area corresponding to a target object in the first image, and determining, on the basis of the target area, a second phase map corresponding to the target area in the first phase map (602), so as to pay attention to a phase map corresponding to the target object; acquiring, according to size information of the target object, an estimated distance of the target object from the ToF sensor (4033) (603); calculating, according to the estimated distance and the second phase map, an unwrapping coefficient corresponding to each pixel in the target area (604), the unwrapping coefficient indicating a real signal period at which each pixel is located; and determining a depth map of the target area according to the unwrapping coefficient and the second phase map (605), wherein the depth map is capable of visualizing the real distance corresponding to each pixel. The actual distance of the target object can be measured in the single frequency distance measurement technology, and the measurement precision can be ensured.

Description

一种物体测距方法及装置Object ranging method and device 技术领域technical field
本申请涉及三维测距技术领域,尤其涉及一种物体测距方法及装置。The present application relates to the technical field of three-dimensional distance measurement, and in particular to a method and device for object distance measurement.
背景技术Background technique
飞行时间(time of flight,TOF)测距方法主要利用发射器发送的光信号在目标物体与接收器之间的往返飞行时间来计算目标物体到TOF测距系统的距离,由于直接测量光信号的飞行时间难度较大,TOF测距系统可以采用测量发射信号与反射信号之间的相位延时来计算距离,并用深度图表示目标物体表面对应的距离信息。The time of flight (TOF) ranging method mainly uses the round-trip flight time of the optical signal sent by the transmitter between the target object and the receiver to calculate the distance from the target object to the TOF ranging system. The time of flight is more difficult. The TOF ranging system can calculate the distance by measuring the phase delay between the transmitted signal and the reflected signal, and use the depth map to represent the distance information corresponding to the surface of the target object.
TOF测距系统可以采用单频测距技术,单频测距技术是指TOF测距系统使用一个调制频率发射光信号,并基于相位延迟进行测距。在该调制频率下,一个信号周期内能够测量的最大距离称为模糊距离。若TOF测距系统与目标物体的实际距离超过该模糊距离,则会出现相位缠绕现象。相位缠绕现象是指反射信号的相位延迟的测量值可能与实际值不同,若实际值超过一个信号周期,就会被减去N个2π(N为正整数),从而使得测量值落在该信号周期内,所以实际值和测量值之间可能会相差N×2π。例如,若模糊距离为0.5米,在对超过0.5米的物体进行测距时,会因为相位缠绕现象,TOF测距系统将距离计算成0米至0.5米以内的距离,这就造成测量距离与真实距离不同的现象。因此,在单频测距技术中,为了能够使得测量值和真实值相同,就需要尽量的扩大模糊距离。模糊距离与调制频率反相关,为了能够扩大可测距范围,可以降低调制频率,从而增大模糊距离,但是调制频率还与测量精度有关,降低调制频率又会增大测量误差。The TOF ranging system can use single-frequency ranging technology. The single-frequency ranging technology means that the TOF ranging system uses a modulation frequency to transmit optical signals and performs ranging based on phase delay. Under this modulation frequency, the maximum distance that can be measured within one signal period is called the ambiguity distance. If the actual distance between the TOF ranging system and the target object exceeds the fuzzy distance, phase winding will occur. The phase winding phenomenon means that the measured value of the phase delay of the reflected signal may be different from the actual value. If the actual value exceeds one signal period, it will be subtracted by N 2π (N is a positive integer), so that the measured value falls on the signal Period, so there may be a difference of N×2π between the actual value and the measured value. For example, if the fuzzy distance is 0.5 meters, when measuring the distance of an object exceeding 0.5 meters, the TOF ranging system will calculate the distance as a distance between 0 meters and 0.5 meters due to the phenomenon of phase winding, which causes the measured distance to be different from that of Phenomena where the real distance is different. Therefore, in the single-frequency ranging technology, in order to make the measured value the same as the real value, it is necessary to expand the fuzzy distance as much as possible. The ambiguity distance is inversely correlated with the modulation frequency. In order to expand the measurable range, the modulation frequency can be reduced to increase the ambiguity distance. However, the modulation frequency is also related to the measurement accuracy, and reducing the modulation frequency will increase the measurement error.
在单频测距技术中,如何能够测量到真实距离且不会增大测量误差成为亟待解决的问题。In the single-frequency ranging technology, how to measure the real distance without increasing the measurement error has become an urgent problem to be solved.
发明内容Contents of the invention
本申请实施例提供了一种TOF的物体测距方法,在单频测距技术中,即使被测物体的位置超过模糊距离,也能够测量到目标物体的真实距离,且保证测量精度。The embodiment of the present application provides a TOF object ranging method. In the single-frequency ranging technology, even if the position of the measured object exceeds the fuzzy distance, the real distance to the target object can be measured, and the measurement accuracy can be guaranteed.
第一方面,本申请实施例提供了一种物体测距方法,包括:利用飞行时间TOF传感器获取第一图像及第一图像对应的第一相位图;识别第一图像中目标物体对应的目标区域,及在第一相位图中目标区域对应的第二相位图;根据目标物体的尺寸信息获取目标物体距离TOF传感器的估计距离,其中,尺寸信息包括第一图像中目标物体的图像尺寸,或者,目标物体的实际物理尺寸;根据估计距离和第二相位图计算目标区域中每个像素对应的解缠系数;根据解缠系数和第二相位图确定目标区域的深度图。In the first aspect, an embodiment of the present application provides a method for measuring distance from an object, including: using a time-of-flight TOF sensor to acquire a first image and a first phase image corresponding to the first image; identifying a target area corresponding to a target object in the first image , and the second phase map corresponding to the target area in the first phase map; obtaining the estimated distance of the target object from the TOF sensor according to 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 area according to the estimated distance and the second phase map; determining the depth map of the target area according to the unwrapping coefficient and the second phase map.
第一图像可以是灰度图,也可以是彩色图;目标区域可以理解为感兴趣区域(ROI)区域,目标区域用于物体测距装置关注目标物体对应的相位图;物体测距装置根据目标物体的尺寸信息获取目标物体距离TOF传感器的估计距离,该估计距离可以理解为目标物体距离TOF传感器的一个大致距离;解缠系数用于指示目标区域中每个像素对应的真实信号周期;深度图用于可视化目标区域内每个像素对应的真实距离。本申请实施例中,不需要 通过降低调制频率来扩展模糊距离,而是通过物体的尺寸信息确定目标物体距离TOF传感器的一个估计距离,基于该估计距离计算目标区域内每个像素对应的解缠系数,解缠系数能够指示目标物体对应的信号周期,确定了每个像素对应的解缠系数,就能够确定每个像素对应的真实距离,即使目标物体的实际距离超过模糊距离,也能够探测目标物体的实际距离,并且能够保证测量精度。The first image can be a grayscale image or a color image; the target area can be understood as a region of interest (ROI) area, and the target area is used for the object ranging device to pay attention to the phase image corresponding to the target object; The size information of the object obtains the estimated distance of the target object from the TOF sensor, which can be understood as an approximate distance from the target object to the TOF sensor; the unwrapping coefficient is used to indicate the real signal period corresponding to each pixel in the target area; the depth map Used to visualize the true distance corresponding to each pixel in the target area. In the embodiment of the present application, it is not necessary to reduce the modulation frequency to extend the blur distance, but to determine an estimated distance between the target object and the TOF sensor through the size information of the object, and calculate the unwrapping corresponding to each pixel in the target area based on the estimated distance coefficient, the unwrapping coefficient can indicate the signal cycle corresponding to the target object, and the unwrapping coefficient corresponding to each pixel can be determined, and the real distance corresponding to each pixel can be determined, even if the actual distance of the target object exceeds the fuzzy distance, the target can also be detected The actual distance of the object, and can guarantee the measurement accuracy.
在一个可选的实现方式中,目标物体的尺寸信息为目标物体的图像尺寸,根据目标物体的尺寸信息获取目标物体距离TOF传感器的估计距离,包括:根据目标物体的图像尺寸,及预设关系确定估计距离,预设关系指示多个第一距离与多个预设图像尺寸具有对应关系,目标物体的图像尺寸为多个预设图像尺寸中的目标预设图像尺寸,估计距离为与目标预设图像尺寸具有对应关系的第一距离。In an optional implementation, the size information of the target object is the image size of the target object, and the estimated distance between the target object and the TOF sensor is obtained according to the size information of the target object, including: according to the image size of the target object, and the preset relationship Determine the estimated distance, the preset relationship indicates that the multiple first distances have a corresponding relationship with 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 target preset image size. Assume that image sizes have a first distance of correspondence.
图像尺寸为目标物体在第一图像中所占的像素个数,物体测距装置本地保存多个第一距离与多个预设图像尺寸的对应关系,该多个第一距离和多个预设图像尺寸及对应关系是根据经验值得到的,物体测距装置确定了目标区域对应像素的个数,即确定了目标物体的图像尺寸,若目标物体的图像尺寸为多个预设图像尺寸中的目标预设图像尺寸,则基于上述预设关系,确定出估计距离为与目标预设图像尺寸具有对应关系的第一距离。传统的单频测距技术中,当目标物体的位置超过模糊距离时,只能计算出目标物体可能的几个位置,单频测距技术能够计算出多个被测物体可能对应的信号周期(对应可能的位置),但是不能确定被测物体的真实位置对应哪个信号周期,被测物体的真实位置对应哪个信号周期可以由解缠系数来表示,当前技术中,只有在多频测距技术中,才能计算出解缠系数,也就是说当前单频测距技术中,不涉及解缠系数,而本实施例中,是在单频测距技术中,能够计算解缠技术,物体测距装置可以依据第一图像中目标区域所占像素的数量(个数)来判断目标物体距离物体测距装置的大致距离,从而能够根据该大致距离和第二相位图计算目标区域内每个像素对应的解缠系数,并且相对于传统方法中只有多频测距技术才能计算解缠系数的方法,本实施例中的方案可以节省物体测距装置的功耗。The image size is the number of pixels occupied by the target object in the first image, and the object ranging device locally stores the corresponding relationship between multiple first distances and multiple preset image sizes, and the multiple first distances and multiple preset The image size and corresponding relationship 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 one of the multiple preset image sizes For the target preset image size, based on the above preset relationship, it is determined that the estimated distance is the first distance having a corresponding relationship with the target preset image size. In the traditional single-frequency ranging technology, when the position of the target object exceeds the fuzzy distance, only a few possible positions of the target object can be calculated, and the single-frequency ranging technology can calculate the possible signal periods corresponding to multiple measured objects ( Corresponding to the possible position), but it is impossible to determine which signal cycle the real position of the measured object corresponds to, which signal cycle the real position of the measured object corresponds to can be represented by the unwrapping coefficient. In the current technology, only in the multi-frequency ranging technology , the unwrapping coefficient can be calculated, that is to say, in the current single-frequency ranging technology, the unwrapping coefficient is not involved, but in this embodiment, the unwrapping technology can be calculated in the single-frequency ranging technology, and the object ranging device The approximate distance between the target object and the object distance measuring device can be judged according to the number (number) of pixels occupied by the target area in the first image, so that the distance corresponding to each pixel in the target area can be calculated according to the approximate distance and the second phase map. The unwrapping coefficient, and compared with the traditional method in which only the multi-frequency ranging technology can calculate the unwrapping coefficient, the solution in this embodiment can save the power consumption of the object distance measuring device.
在一个可选的实现方式中,目标物体的尺寸信息为目标物体的实际物理尺寸,根据目标物体的尺寸信息获取目标物体距离TOF传感器的估计距离,包括:根据第二相位图计算目标物体与TOF传感器之间的多个第二距离,多个第二距离中的每个第二距离对应一个目标物体的估计尺寸;将目标物体的实际物理尺寸与多个估计尺寸进行匹配,确定与实际物理尺寸相匹配的目标估计尺寸;确定目标估计尺寸对应的第二距离为估计距离。In an optional implementation, the size information of the target object is the actual physical size of the target object, and the estimated distance between the target object and the TOF sensor is obtained according to the size information of the target object, including: calculating the distance between the target object and the TOF sensor according to the second phase map A plurality of second distances between the sensors, each of the plurality of second distances corresponds to an estimated size of a target object; matching the actual physical size of the target object with the plurality of estimated sizes, and determining the actual physical size The estimated size of the matched target; determining the second distance corresponding to the estimated size of the target as the estimated distance.
由于相位缠绕现象,物体测距装置根据第二相位图计算出目标物体与TOF传感器之间的多个距离(也称为“第二距离”),该多个第二距离为目标物体距离TOF的多个可能的距离,即目标物体可能的出现位置,物体测距装置能够根据多个第二距离中的每个第二距离计算出一个目标物体的估计尺寸,即每个第二距离对应一个目标物体的估计尺寸;物体测距装置将目标物体的实际物理尺寸与多个估计尺寸进行匹配,确定与实际物理尺寸相匹配的目标估计尺寸,其中,目标物体的实际物理尺寸为经验值,例如,目标物体的类别为人脸,人脸的实际宽度大概为15cm;物体测距装置确定目标估计尺寸对应的第二距离为上述估计距离。传统的单频测距技术中,当目标物体的位置超过模糊距离时,只能计算出目标 物体可能的几个位置,单频测距技术能够计算出多个被测物体可能对应的信号周期(对应可能的位置),但是不能确定被测物体的真实位置对应哪个信号周期,被测物体的真实位置对应哪个信号周期是可以由解缠系数来表示,当前技术中,只有在多频测距技术中,才能计算出解缠系数,也就是说当前单频测距技术中,不涉及解缠系数,而本实施例中,是在单频测距技术中,能够计算解缠技术,当物体测距装置能够根据目标物体的实际物理尺寸从多个计算出的距离(第二距离)中选择一个第二距离作为估计距离,从而能够根据该估计距离和第二相位图计算目标区域内每个像素对应的解缠系数,并且相对于传统方法中只有多频测距技术才能计算解缠系数的方法,本实施例中的方案可以节省物体测距装置的功耗。Due to the phase winding phenomenon, the object ranging device calculates multiple distances (also called "second distances") between the target object and the TOF sensor according to the second phase map, and the multiple second distances are the distance between the target object and the TOF Multiple possible distances, that is, the possible appearance positions of the target object, the object ranging device can calculate the estimated size of a target object according to each of the multiple second distances, that is, each second distance corresponds to a target The estimated size of the object; the object ranging device matches the actual physical size of the target object with a plurality of estimated sizes, and determines the estimated size of the target matching the actual physical size, wherein the actual physical size of the target object is an empirical value, for example, The category of the target object is a human face, and the actual width of the human face is about 15 cm; the object ranging device determines that the second distance corresponding to the estimated size of the target is the above estimated distance. In the traditional single-frequency ranging technology, when the position of the target object exceeds the fuzzy distance, only a few possible positions of the target object can be calculated, and the single-frequency ranging technology can calculate the possible signal periods corresponding to multiple measured objects ( Corresponding to the possible position), but it is not possible to determine which signal cycle the real position of the measured object corresponds to. Which signal cycle the real position of the measured object corresponds to can be represented by the unwrapping coefficient. In the current technology, only in the multi-frequency ranging technology In order to calculate the unwrapping coefficient, that is to say, the current single-frequency ranging technology does not involve the unwrapping coefficient, but in this embodiment, the unwrapping technology can be calculated in the single-frequency ranging technology. The distance device can select a second distance from a plurality of calculated distances (second distances) as an estimated distance according to the actual physical size of the target object, thereby being able to calculate the distance of each pixel in the target area according to the estimated distance and the second phase map. Corresponding unwrapping coefficients, and compared to the traditional method in which only the multi-frequency ranging technology can calculate the unwrapping coefficients, the solution in this embodiment can save the power consumption of the object distance measuring device.
在一个可选的实现方式中,所述根据所述目标物体的尺寸信息获取所述目标物体距离所述TOF传感器的估计距离之前,所述方法包括:确定所述目标物体的类别;根据所述类别获取所述目标物体的尺寸信息。In an optional implementation manner, before obtaining the estimated distance between the target object and the TOF sensor according to the size information of the target object, the method includes: determining the category of the target object; The category obtains the size information of the target object.
物体测距装置可以通过机器视觉技术确定目标物体的类别,例如,该目标物体的类别可以为人脸、手部、机器零件等;根据类别查询数据库就可以获取目标物体的尺寸信息,该数据库中包括各种类别物体的尺寸信息。本实施例中,物体测距装置本地可以存储多个类别的物体的尺寸信息,使得上述物体测距方法可以适用于多个类别的物体,从而使得该方法适应于多种应用场景。The object ranging device can determine the category of the target object through machine vision technology. For example, the category of the target object can be human face, hand, machine part, etc.; the size information of the target object can be obtained by querying the database according to the category. The database includes Dimensional information for various classes of objects. In this embodiment, the object ranging device can locally store size information of multiple types of objects, so that the above object ranging method can be applied to multiple types of objects, thus making the method suitable for various application scenarios.
在一个可选的实现方式中,目标物体的类别为人脸。In an optional implementation manner, the category of the target object is a human face.
在一个可选的实现方式中,所述目标区域包括第一区域和第二区域;当目标区域中的多个像素对应的相位延迟不存在相位翻转时,目标区域内每个像素对应的解缠系数相同;或者,当目标区域中的多个像素对应的相位延迟存在相位翻转时,解缠系数包括第一解缠系数和第二解缠系数,其中,相位翻转是指第一相位延迟和第二相位延迟不在同一个信号周期,第一相位延迟是第一区域中多个像素对应的相位延迟,第二相位延迟是第二区域中多个像素对应的相位延迟;第一相位延迟与第一解缠系数有关,第二相位延迟与第二解缠系数有关;第一解缠系数用于计算第一区域对应的深度图,第二解缠系数用于计算第二区域对应的深度图。In an optional implementation, the target area includes a first area and a second area; when there is no phase inversion in phase delays corresponding to multiple pixels in the target area, the unwrapping corresponding to each pixel in the target area The coefficients are the same; or, when the phase delays corresponding to multiple pixels in the target area have phase inversion, the unwrapping coefficients include the first unwrapping coefficient and the second unwrapping coefficient, where the phase inversion refers to the first phase delay and the second phase delay The two phase delays are not in the same signal cycle, the first phase delay is the phase delay corresponding to multiple pixels in the first area, and the second phase delay is the phase delay corresponding to multiple pixels in the second area; the first phase delay is the same as the first phase delay The unwrapping coefficient is related, 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.
第一区域和第二区域在空间上连续;相位翻转是指第一相位延迟和第二相位延迟不在同一个信号周期,例如,第一相位延迟为355度,第二相位延迟为365度;根据第一相位延迟355度计算第一解缠系数N 1,根据5度(第二相位延迟365度-360度)得到第二解缠系数N 2,例如,N 1=0,表明第一区域对应第一个信号周期,而N 2=1表明第二区域对应第二个信号周期,N 1和N 2指示出第一区域和第二区域对应的真实位置,相对于当前的单频测距技术中,物体测距装置不能计算解缠系数,若第二区域对应的相位延迟是365度,会直接将365度折算成5度(365度-360度),按照相位延迟5度来计算距离,5度(测量值)和365度(真实值)是不同的,会造成目标区域深度值不连贯,而本实施例中,N 1和N 2指示出第一区域和第二区域所分别对应的信号周期,该信号周期能够指示第一区域和第二区域对应的实际距离,从而使得目标区域的深度连续且接近上述估计距离。 The first area and the second area are spatially continuous; phase inversion means that the first phase delay and the second phase delay are not in the same signal period, for example, the first phase delay is 355 degrees, and the second phase delay is 365 degrees; according to The first phase delay is 355 degrees to calculate the first unwrapping coefficient N 1 , and the second unwrapping coefficient N 2 is obtained according to 5 degrees (the second phase delay is 365 degrees-360 degrees), for example, N 1 =0, indicating that the first area corresponds to The first signal period, and N 2 =1 indicates that the second area corresponds to the second signal period, N 1 and N 2 indicate the real positions corresponding to the first area and the second area, compared to the current single-frequency ranging technology Among them, the object ranging device cannot calculate the unwrapping coefficient. If the phase delay corresponding to the second area is 365 degrees, it will directly convert 365 degrees into 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 incoherence in the depth value of the target area. In this embodiment, N 1 and N 2 indicate the corresponding depths of the first area and the second area. A signal period, where the signal period can indicate the actual distance corresponding to the first area and the second area, so that the depth of the target area is continuous and close to the above estimated distance.
第二方面,本申请实施例提供了一种物体测距装置,包括:获取模块,用于利用飞行 时间TOF传感器获取第一图像及第一图像对应的第一相位图;处理模块,用于识别第一图像中目标物体对应的目标区域,及在第一相位图中目标区域对应的第二相位图;处理模块,还用于根据目标物体的尺寸信息获取目标物体距离TOF传感器的估计距离,其中,尺寸信息包括第一图像中目标物体的图像尺寸,或者,目标物体的实际物理尺寸;处理模块,还用于根据估计距离和第二相位图计算目标区域中每个像素对应的解缠系数;处理模块,还用于根据解缠系数和第二相位图确定目标区域的深度图。In the second aspect, the embodiment of the present application provides an object distance measuring device, including: an acquisition module, configured to use a time-of-flight TOF sensor to acquire a first image and a first phase image corresponding to the first image; a processing module, configured to identify 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; the processing module is also used to obtain the estimated distance of the target object from the TOF sensor according to 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 also used to calculate the unwrapping coefficient corresponding to each pixel in the target area according to the estimated distance and the second phase map; The processing module is further configured to determine the depth map of the target area according to the unwrapping coefficient and the second phase map.
在一个可选的实现方式中,目标物体的尺寸信息为目标物体的图像尺寸;处理模块,还用于根据目标物体的图像尺寸,及预设关系确定估计距离,预设关系指示多个第一距离与多个预设图像尺寸具有对应关系,目标物体的图像尺寸为多个预设图像尺寸中的目标预设图像尺寸,估计距离为与目标预设图像尺寸具有对应关系的第一距离。In an optional implementation manner, 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 according to the image size of the target object and a preset relationship, and the preset relationship indicates a plurality of first The distance corresponds to a plurality of preset image sizes, the image size of the target object is the target preset image size in the plurality of preset image sizes, and the estimated distance is the first distance corresponding to the target preset image size.
在一个可选的实现方式中,处理模块还具体用于:根据第二相位图计算目标物体与TOF传感器之间的多个第二距离,多个第二距离中的每个第二距离对应一个目标物体的估计尺寸;将目标物体的实际物理尺寸与多个估计尺寸进行匹配,确定与实际物理尺寸相匹配的目标估计尺寸;确定目标估计尺寸对应的第二距离为估计距离。In an optional implementation manner, the processing module is further specifically configured to: calculate a plurality of second distances between the target object and the TOF sensor according to the second phase map, and each second distance in the plurality of second distances corresponds to a The estimated size of the target object; matching the actual physical size of the target object with multiple estimated sizes to determine the estimated target size matching the actual physical size; determining the second distance corresponding to the estimated target size as the estimated distance.
在一个可选的实现方式中,处理模块还具体用于:确定目标物体的类别;根据类别获取目标物体的尺寸信息。In an optional implementation manner, the processing module is further specifically configured to: determine the category of the target object; and acquire size information of the target object according to the category.
在一个可选的实现方式中,目标物体的类别为人脸。In an optional implementation manner, the category of the target object is a human face.
在一个可选的实现方式中,目标区域包括第一区域和第二区域;当目标区域中的多个像素对应的相位延迟不存在相位翻转时,目标区域内每个像素对应的解缠系数相同;或者,In an optional implementation, the target area includes a first area and a second area; when there is no phase reversal in phase delays corresponding to multiple pixels in the target area, the unwrapping coefficients corresponding to each pixel in the target area are the same ;or,
当目标区域中的多个像素对应的相位延迟存在相位翻转时,解缠系数包括第一解缠系数和第二解缠系数,其中,相位翻转是指第一相位延迟和第二相位延迟不在同一个信号周期,第一相位延迟是第一区域中多个像素对应的相位延迟,第二相位延迟是第二区域中多个像素对应的相位延迟;第一相位延迟与第一解缠系数有关,第二相位延迟与第二解缠系数有关;第一解缠系数用于计算第一区域对应的深度图,第二解缠系数用于计算第二区域对应的深度图。When there is a phase inversion in the phase delays corresponding to multiple pixels in the target area, the unwrapping coefficient includes the first unwrapping coefficient and the second unwrapping coefficient, wherein the phase inversion means that the first phase delay and the second phase delay are not at the same One signal period, the first phase delay is the phase delay corresponding to multiple pixels in the first area, and the second phase delay is the phase delay corresponding to multiple pixels in the second area; the first phase delay is related to the first unwrapping coefficient, 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.
第三方面,本申请实施例提供了一种物体测距装置,包括处理器,所述处理器与至少一个存储器耦合,所述处理器用于读取所述至少一个存储器所存储的计算机程序,使得所述电子设备执行如上述第一方面中任一项所述的方法。In a third aspect, the embodiment of the present application provides an object ranging device, including a processor, the processor is coupled with at least one memory, and the processor is used to read the computer program stored in the at least one memory, so that The electronic device executes the method described in any one of the above first aspects.
第四方面,本申请实施例提供了一种计算机可读存储介质,用于储存计算机程序或指令,所述计算机程序或指令被执行时使得计算机或处理器执行如上述第一方面中任一项所述的方法。In the fourth aspect, the embodiment of the present application provides a computer-readable storage medium for storing computer programs or instructions, and when the computer programs or instructions are executed, the computer or processor executes any one of the above-mentioned first aspects. the method described.
第五方面,本申请实施例提供了一种包括指令的计算机程序产品,当所述计算机程序产品中的指令被计算机或处理器执行时,使得计算机或处理器实现上述第一方面中任一项所述的方法。In the fifth aspect, the embodiment of the present application provides a computer program product including instructions, and when the instructions in the computer program product are executed by a computer or a processor, the computer or processor can realize any one of the above first aspects the method described.
附图说明Description of drawings
图1为TOF测距原理的示意图;FIG. 1 is a schematic diagram of the TOF ranging principle;
图2为深度图的示意图;FIG. 2 is a schematic diagram of a depth map;
图3a为单频测距技术中被测物体可能出现的位置的场景示意图;Figure 3a is a schematic diagram of a scene where a measured object may appear in the single-frequency ranging technique;
图3b为多频测距技术中被测物体可能出现的位置的场景示意图;Fig. 3b is a schematic diagram of the scene where the measured object may appear in the multi-frequency ranging technology;
图4为本申请实施例中测距系统的结构示意图;FIG. 4 is a schematic structural diagram of a ranging system in an embodiment of the present application;
图5为本申请实施例中发射信号和反射信号的示意图;FIG. 5 is a schematic diagram of a transmitted signal and a reflected signal in an embodiment of the present application;
图6为本申请实施例中一种物体测距方法的步骤流程示意图;FIG. 6 is a schematic flow chart of the steps of an object ranging method in the embodiment of the present application;
图7为本申请实施例中第一图像中目标区域及目标区域对应的第二相位图的示意图;7 is a schematic diagram of a target area in the first image and a second phase image corresponding to the target area in the embodiment of the present application;
图8为本申请实施例中不同距离下人脸所占像素个数的关系图;Fig. 8 is a relationship diagram of the number of pixels occupied by faces at different distances in the embodiment of the present application;
图9为本申请实施例中多个第二距离及每个第二距离对应的人脸的实际物理尺寸的示意图;FIG. 9 is a schematic diagram of a plurality of second distances and the actual physical size of a human face corresponding to each second distance in the embodiment of the present application;
图10为本申请实施例中一种物体测距装置的一个实施例的结构示意图;FIG. 10 is a schematic structural diagram of an embodiment of an object ranging device in the embodiment of the present application;
图11为本申请实施例中一种电子设备的一个实施例的结构示意图。FIG. 11 is a schematic structural diagram of an embodiment of an electronic device in the embodiment of the present application.
具体实施方式Detailed ways
本申请中,除特殊说明外,各个实施例之间相同或相似的部分可以互相参考。在本申请中各个实施例、以及各实施例中的各个实施方式/实施方法/实现方法中,如果没有特殊说明以及逻辑冲突,不同的实施例之间、以及各实施例中的各个实施方式/实施方法/实现方法之间的术语和/或描述具有一致性、且可以相互引用,不同的实施例、以及各实施例中的各个实施方式/实施方法/实现方法中的技术特征根据其内在的逻辑关系可以组合形成新的实施例、实施方式、实施方法、或实现方法。以下该的本申请实施方式并不构成对本申请保护范围的限定。In this application, unless otherwise specified, the parts that are the same or similar among the various embodiments can be referred to each other. In the various embodiments in this application, and the various implementation methods/implementation methods/implementation methods in each embodiment, if there is no special description and logical conflict, different embodiments, and each implementation method/implementation method in each embodiment The terms and/or descriptions between implementation methods/implementation methods are consistent and can be referred to each other. Different embodiments, and the technical features in each implementation manner/implementation method/implementation method in each embodiment are based on their inherent Logical relationships can be combined to form new embodiments, implementation modes, implementation methods, or implementation methods. The following embodiments of the present application are not intended to limit the protection scope of the present application.
可以理解,本申请实施例中的一些可选的特征,在某些场景下,可以不依赖于其他特征,比如其当前所基于的方案,而独立实施,解决相应的技术问题,达到相应的效果,也可以在某些场景下,依据需求与其他特征进行结合。相应的,本申请实施例中给出的装置也可以相应的实现这些特征或功能,在此不予赘述。It can be understood that some optional features in the embodiments of the present application, in some scenarios, can be independently implemented without relying on other features, such as the current solution on which they are based, to solve corresponding technical problems and achieve corresponding effects , and can also be combined with other features according to requirements in some scenarios. Correspondingly, the devices provided in the embodiments of the present application can also correspondingly implement these features or functions, which will not be repeated here.
在本申请的描述中,除非另有说明,"多个"是指两个或多于两个。"以下至少一项(个)"或其类似表达,是指的这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a,b,或c中的至少一项(个),可以表示:a,b,c,a和b,a和c,b和c,或a和b和c,其中a,b,c可以是单个,也可以是多个。In the description of the present application, unless otherwise stated, "plurality" means two or more than two. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one item (piece) of a, b, or c can represent: a, b, c, a and b, a and c, b and c, or a and b and c, wherein a, b, c can be single or multiple.
另外,为了便于清楚描述本申请实施例的技术方案,在本申请的实施例中,采用了"第一"、"第二"等字样对功能和作用基本相同的相同项或相似项进行区分。本领域技术人员可以理解"第一"、"第二"等字样并不对数量和执行次序进行限定,并且"第一"、"第二"等字样也并不限定一定不同。同时,在本申请实施例中,"示例性的"或者"例如"等词用于表示作例子、例证或说明。本申请实施例中被描述为"示例性的"或者"例如"的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用"示例性的"或者"例如"等词旨在以具体方式呈现相关概念,便于理解。In addition, in order to clearly describe the technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as "first" and "second" are used to distinguish the same or similar items with basically the same function and effect. Those skilled in the art can understand that words such as "first" and "second" do not limit the number and execution order, and words such as "first" and "second" do not necessarily limit the difference. Meanwhile, in the embodiments of the present application, words such as "exemplary" or "for example" are used to represent examples, illustrations or descriptions. Any embodiment or design solution described as "exemplary" or "for example" in the embodiments of the present application shall not be interpreted as being more preferred or more advantageous than other embodiments or design solutions. Rather, the use of words such as "exemplary" or "such as" is intended to present relevant concepts in a concrete manner for easy understanding.
TOF测距原理示例性说明:请参阅图1进行理解,在对被测物体进行测距时,通过调制光源发射高频红外调制信号照射目标物体,此后调制信号反射回到TOF测距系统的传感器表面时,产生与距离相关的相位延迟。TOF传感器接收并解调飞行过程中引起的相位延 迟,再依据光飞行速率和调制频率等已知量来求出传感器与目标物体之间的距离。为了得到目标物体完整的三维信息,并通过二维的TOF传感器阵列来重建目标物体表面的形状,要求TOF传感器阵列中的各个像素单元能够独立的接收并解调出与物体表面各对应点的距离信息,进而得到目标物体的深度图。深度图(depth image)也被称为距离影像(range image),是指将采集到的被测物体上各点的距离(深度)作为像素值的图像。深度图直接反映了被测物体可见表面的几何形状。请参阅图2所示,可视化的深度图如图2所示,不同的深度值映射为不同的颜色,从而以彩色图像方式可视化该深度图。An exemplary description of the principle of TOF ranging: Please refer to Figure 1 for understanding. When measuring the distance of the measured object, the modulated light source emits a high-frequency infrared modulation signal to illuminate the target object, and then the modulated signal is reflected back to the sensor of the TOF ranging system surface, a distance-dependent phase delay occurs. The TOF sensor receives and demodulates the phase delay caused by the flight process, and then calculates the distance between the sensor and the target object based on known quantities such as light flight speed and modulation frequency. In order to obtain the complete three-dimensional information of the target object and reconstruct the surface shape of the target object through the two-dimensional TOF sensor array, each pixel unit in the TOF sensor array is required to independently receive and demodulate the distance from each corresponding point on the object surface information, and then obtain the depth map of the target object. A depth image, also called a range image, refers to an image in which the distance (depth) of each point on the measured object is collected as a pixel value. The depth map directly reflects the geometry of the visible surface of the measured object. Please refer to FIG. 2, the visualized depth map is shown in FIG. 2, different depth values are mapped to different colors, and thus the depth map is visualized in a color image.
TOF测距包括单频测距技术和多频测距技术。传统的单频测距技术测距范围有限,在单频调制频率下,仅能够测量位于模糊距离(如下式(1))内的物体按照下述式(2)测量距离,若被测物体的位置超过模糊距离,会出现相位缠绕现象。请参阅图3a进行理解,单频测距技术能够计算出多个被测物体可能位于的位置,但是不能确定被测物体的真实位置对应哪个信号周期,其中,被测物体的真实位置对应哪个信号周期可以用解缠系数来表示。当前技术中,要么在单频测距技术中,降低调制频率,从而扩大模糊距离,使得被测物体的真实距离能够落入到模糊距离范围内,从而能够准确的测出被测物体,但是这种方式又会降低测量精度。要么使用多频测距技术,即增加一个或者多个调制频率的调制波来对被测物体进行依次测距,请参阅图3b所示,每个调制频率都会对应一个模糊距离,真实距离就是多个调制频率的调制波共同测量到的那个值,该真实位置对应调制频率也就是多个频率的最大公约数,称为击打频率(beat frequency)。击打频率一般会更低,从而能够扩展更长的测量距离。例如,调制频率a=100MHz,调制频率a对应的模糊距离U 100MHz=1.5m,调制频率b=80MHz,调制频率b的对应的模糊距离U 80MHz=1.875m,双频后,整个系统的模糊距离被扩展为7.5m。虽然,多频测距技术能够准确的测量被测物体的真实距离,但是多频测距技术会增加测距系统的功耗,降低帧率,限制了测距系统的应用场景。 TOF ranging includes single-frequency ranging technology and multi-frequency ranging technology. The range of the traditional single-frequency ranging technology is limited. Under the single-frequency modulation frequency, it can only measure the objects within the fuzzy distance (as shown in the following formula (1)) and measure the distance according to the following formula (2). If the measured object If the position exceeds the ambiguity distance, the phenomenon of phase winding will appear. Please refer to Figure 3a for understanding. The single-frequency ranging technology can calculate the possible positions of multiple measured objects, but it cannot determine which signal period the real position of the measured object corresponds to. Among them, which signal corresponds to the real position of the measured object The period can be represented by the unwrapping coefficient. In the current technology, either in the single-frequency ranging technology, the modulation frequency is reduced, thereby expanding the fuzzy distance, so that the real distance of the measured object can fall within the range of the fuzzy distance, so that the measured object can be accurately measured, but this This method will reduce the measurement accuracy. Or use multi-frequency ranging technology, that is, add one or more modulating frequency modulation waves to measure the distance of the measured object in sequence, as shown in Figure 3b, each modulating frequency will correspond to a fuzzy distance, the real distance is how much The value measured by the modulation waves of two modulation frequencies, the real position corresponds to the modulation frequency, that is, the greatest common divisor of multiple frequencies, is called the beat frequency (beat frequency). The beating frequency will generally be lower, allowing longer measurement distances to be extended. For example, modulation frequency a = 100MHz, the ambiguity distance U 100MHz corresponding to modulation frequency a = 1.5m, modulation frequency b = 80MHz, and the ambiguity distance U 80MHz corresponding to modulation frequency b = 1.875m, after dual frequency, the ambiguity distance of the entire system Was extended to 7.5m. Although the multi-frequency ranging technology can accurately measure the real distance of the measured object, the multi-frequency ranging technology will increase the power consumption of the ranging system, reduce the frame rate, and limit the application scenarios of the ranging system.
Figure PCTCN2021128943-appb-000001
Figure PCTCN2021128943-appb-000001
其中,c为光速,F为调制频率。Among them, c is the speed of light, and F is the modulation frequency.
Figure PCTCN2021128943-appb-000002
Figure PCTCN2021128943-appb-000002
其中,c为光速,
Figure PCTCN2021128943-appb-000003
为相位延迟,F为调制频率。
where c is the speed of light,
Figure PCTCN2021128943-appb-000003
is the phase delay, and F is the modulation frequency.
鉴于上述问题,本申请提出一种物体测距方法,该方法应用于一种物体测距系统,请参阅图4所示,图4为物体测距系统的结构示意图。测距系统包括TOF模组40和处理模块41,其中,TOF模组40包括TOF芯片403、激光器402和镜头404(包含滤光片)。TOF芯片403包括ToF传感器4033、控制器4031和模数转换器(analog-to-digital converter,ADC)4032。其中,控制器4031用于产生某一调制频率的发射信号。信号波形变化的度量,通常以度(角度)作为单位。请参阅图5所示,发射的红外连续光信号(即发射信号)为通过调制后的余弦信号s(t),该发射信号(也可以称为“光波信号”)可用下述式(3)表示。In view of the above problems, the present application proposes an object ranging method, which is applied to an object ranging system, please refer to FIG. 4 , which is a schematic structural diagram of the object ranging system. The ranging system includes a TOF module 40 and a processing module 41, wherein the TOF module 40 includes a TOF chip 403, a laser 402 and a lens 404 (including a filter). The TOF chip 403 includes a ToF sensor 4033 , a controller 4031 and an analog-to-digital converter (analog-to-digital converter, ADC) 4032 . Wherein, the controller 4031 is used for generating a transmission signal of a certain modulation frequency. A measure of a signal waveform change, usually in degrees (angles). Please refer to Fig. 5, the emitted infrared continuous optical signal (i.e. the transmitted signal) is a modulated cosine signal s(t), and the transmitted signal (also called "light wave signal") can be obtained by the following formula (3) express.
s(t)=cos(ωt),式(3)。s(t)=cos(ωt), formula (3).
其中,t表示时刻,ω表示角速度,ωt表示角度。Among them, t represents the time, ω represents the angular velocity, and ωt represents the angle.
控制器4031将电信号分别发送给激光器驱动401和TOF传感器4033。激光器驱动401用于按照电信号的变化驱动激光器402,激光器402用于发射相应的光波信号s(t)。光波信号经过被测物体的反射,镜头404用于接收反射信号并将反射信号发送给TOF传感器,TOF传感器4033用于接收反射信号g(t),反射信号g(t)包含有相位延时的已调余弦信号,反射信号g(t)可以用下述式(4)表示。The controller 4031 sends electrical signals to the laser driver 401 and the TOF sensor 4033 respectively. The laser driver 401 is used to drive the laser 402 according to the change of the electrical signal, and the laser 402 is used to emit the corresponding optical wave signal s(t). The light wave signal is reflected by the measured object, the lens 404 is used to receive the reflected signal and send the reflected signal to the TOF sensor, the TOF sensor 4033 is used to receive the reflected signal g(t), and the reflected signal g(t) contains phase delay The modulated cosine signal and the reflected signal g(t) can be expressed by the following formula (4).
Figure PCTCN2021128943-appb-000004
Figure PCTCN2021128943-appb-000004
其中,A表示振幅,t表示时刻,ω表示角速度,
Figure PCTCN2021128943-appb-000005
表示相位延迟,相位延迟
Figure PCTCN2021128943-appb-000006
代表光波在飞行过程中的传播延迟。
Among them, A represents the amplitude, t represents the time, ω represents the angular velocity,
Figure PCTCN2021128943-appb-000005
Indicates phase delay, phase delay
Figure PCTCN2021128943-appb-000006
Represents the propagation delay of light waves during flight.
TOF传感器4033还用于对s(t)与g(t)进行混频积分(如下述式5),得到积分值,积分值通过ADC4032输出给处理模块41,处理模块41用于对积分值进行相位计算和强度计算,从而得到被测物体的灰度图和相位图。The TOF sensor 4033 is also used for mixing and integrating s(t) and g(t) (as shown in the following formula 5) to obtain the integral value, which is output to the processing module 41 through the ADC4032, and the processing module 41 is used to process the integral value Phase calculation and intensity calculation, so as to obtain the grayscale image and phase image of the measured object.
Figure PCTCN2021128943-appb-000007
Figure PCTCN2021128943-appb-000007
其中,s(t)表示发射信号,g(t)表示反射信号,
Figure PCTCN2021128943-appb-000008
表示互相关。
Among them, s(t) represents the transmitted signal, g(t) represents the reflected signal,
Figure PCTCN2021128943-appb-000008
Indicates mutual correlation.
控制器4031可以选取4个不同的τ值:τ 0=0°、τ 1=90°、τ 2=180°和τ 3=270°,4个不同的τ值分别代入上述式(5),得到四相位积分值(也称为4相位裸数据)。ADC4032将四相位积分值输出至处理模块41。处理模块41用于根据四相位裸数据进行相位计算(如下述式(6)所示)及强度计算(如下述式(7)和式(8)所示)。下述式(6)中的相位延迟
Figure PCTCN2021128943-appb-000009
用于得到被测物体的相位图,下述式(7)中的强度B可以用来得到被测物体的灰度图。
The controller 4031 can select 4 different τ values: τ 0 = 0°, τ 1 = 90°, τ 2 = 180° and τ 3 = 270°. The 4 different τ values are respectively substituted into the above formula (5), A four-phase integrated value (also called 4-phase bare data) is obtained. The ADC4032 outputs the four-phase integral value to the processing module 41 . The processing module 41 is used to perform phase calculation (as shown in the following formula (6)) and intensity calculation (as shown in the following formula (7) and formula (8)) according to the four-phase bare data. The phase delay in the following equation (6)
Figure PCTCN2021128943-appb-000009
For obtaining the phase image of the object under test, the intensity B in the following formula (7) can be used to obtain the grayscale image of the object under test.
Figure PCTCN2021128943-appb-000010
Figure PCTCN2021128943-appb-000010
Figure PCTCN2021128943-appb-000011
Figure PCTCN2021128943-appb-000011
B=c(τ)+c(τ+180°),式(8)。B=c(τ)+c(τ+180°), formula (8).
其中,上述式(8)中,τ可以为0°或90°。Wherein, in the above formula (8), τ may be 0° or 90°.
处理模块41用于识别灰度图中目标物体对应的目标区域,及目标区域对应的相位图;处理模块41能够根据目标物体的尺寸信息获取目标物体距离TOF传感器4033的估计距离,根据估计距离和相位图计算目标区域中每个像素对应的解缠系数,确定了解缠系数,也即确定出目标区域中每个像素对应的信号周期,进而能够根据解缠系数和目标区域对应的相位图确定目标区域的深度图。本申请实施例中,在单频测距技术中,不需要像当前技术中通过降低调制频率来扩展模糊距离,而是通过物体的尺寸信息确定目标物体距离TOF传感器的一个估计距离,基于该估计距离计算目标区域内每个像素对应的解缠系数,确定了每个像素对应的解缠系数,就能够确定每个像素对应的真实距离,即使目标物体的实际距离超过模糊距离,也能够探测目标物体的实际距离,并且能够保证测量精度。The processing module 41 is used to identify the target area corresponding to the target object in the grayscale image, and the phase image corresponding to the target area; the processing module 41 can obtain the estimated distance from the target object to the TOF sensor 4033 according to the size information of the target object, and according to the estimated distance and The phase map calculates the unwrapping coefficient corresponding to each pixel in the target area, determines the unwrapping coefficient, that is, determines the signal period corresponding to each pixel in the target area, and then can determine the target according to the unwrapping coefficient and the phase map corresponding to the target area Depth map of the region. In the embodiment of the present application, 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, but to determine an estimated distance from the target object to the TOF sensor through the size information of the object, based on the estimation Distance calculates the unwrapping coefficient corresponding to each pixel in the target area. After determining the unwrapping coefficient corresponding to each pixel, the real distance corresponding to each pixel can be determined. Even if the actual distance of the target object exceeds the fuzzy distance, the target can also be detected The actual distance of the object, and can guarantee the measurement accuracy.
下面通过具体的实施例对本申请的技术方案进行示例性说明。本申请实施例提供的一 种物体测距方法,该方法的执行主体可以为物体测距装置。一种实现方式中,物体测距装置的结构如上述图4中所示出的结构,物体测距装置包括TOF模组和处理模块,在一个示例中,TOF模组和处理模块集成在同一个设备中。例如,物体测距装置为一个专用的测距装置,或者,物体测距设备可以为终端。终端包括但不限定于手机,电脑,平板电脑,车载终端、智能家居(如智能电视)、游戏设备、机器人等。另一种实现方式中,TOF模组和处理模块可以分别设置于不同的设备中。例如,TOF模组设置于TOF相机中,处理模块设置于物体测距装置中,TOF相机和物体测距装置通信连接,该物体测距装置可以是终端,或者,物体测距装置也可以是终端中的处理器,其中,终端包括但不限定于手机,电脑,平板电脑,车载终端、智能家居(如智能电机)、游戏设备、机器人等。请参阅图6所示,物体测距装置执行如下步骤601至步骤605。The technical solutions of the present application are illustrated below through specific examples. An object ranging method provided in an embodiment of the present application may be executed by an object ranging device. In one implementation, the structure of the object ranging device is as shown in FIG. 4 above. The object ranging device includes a TOF module and a processing module. In one example, the TOF module and the processing module are integrated in the same in the device. For example, the object distance measuring device is a dedicated distance measuring device, or the object distance measuring device may be a terminal. Terminals include but are not limited to mobile phones, computers, tablet computers, vehicle terminals, smart homes (such as smart TVs), game devices, robots, etc. In another implementation manner, the TOF module and the processing module can be respectively set in different devices. For example, the TOF module is set in the TOF camera, the processing module is set in the object distance measuring device, the TOF camera and the object distance measuring device are connected in communication, the object distance measuring device can be a terminal, or the object distance measuring device can also be a terminal In the processor, the terminals include but are not limited to mobile phones, computers, tablet computers, vehicle terminals, smart homes (such as smart motors), game devices, robots, etc. Please refer to FIG. 6 , the object ranging device performs the following steps 601 to 605 .
步骤601、物体测距装置利用TOF传感器获取第一图像及所述第一图像对应的第一相位图。 Step 601. The object ranging device acquires a first image and a first phase map corresponding to the first image by using a TOF sensor.
物体测距装置利用TOF传感器获取第一图像,在一种可选的情况中,第一图像为被摄场景的灰度图,第一图像利用上述式(7)或上述式(8)得到的。可选地,若物体测距装置还包括彩色图像传感器,该第一图像也可以为RGB(red,green,blue)图像。例如,物体测距装置为手机,手机包括彩色图像传感器,第一图像是手机通过彩色图像传感器采集的RGB图像。The object ranging device uses the TOF sensor to acquire the first image. In an optional situation, the first image is a grayscale image of the scene to be photographed. The first image is obtained by using the above formula (7) or the above formula (8). . Optionally, if the object ranging device further includes a color image sensor, the first image may also be an RGB (red, green, blue) image. For example, the object ranging device is a mobile phone, the mobile phone includes a color image sensor, and the first image is an RGB image collected by the mobile phone through the color image sensor.
物体测距装置利用TOF传感器获取裸数据(或称为原始数据),并根据裸数据计算第一图像中每个像素对应的灰度值和光波飞行时间对应的相位延迟,进而得到第一图像对应的第一相位图。基于TOF测距原理,在对目标物体进行测距时,通过调制光源发射高频红外调制信号照射目标物体,此后调制信号反射回到TOF传感器表面时,产生与距离相关的相位延迟。第一图像中每个像素都会对应第一相位图中的一个相位延迟,第一相位图能够指示目标物体距离物体测距装置的距离信息(参见上述式(2)进行理解)。The object ranging device uses the TOF sensor to obtain raw data (or called raw data), and calculates the gray value corresponding to each pixel in the first image and the phase delay corresponding to the light wave flight time according to the raw data, and then obtains the corresponding phase delay of the first image. The first phase diagram of . Based on the principle of TOF ranging, when measuring the distance of the target object, the modulated light source emits a high-frequency infrared modulation signal to irradiate the target object, and then when the modulated signal is reflected back to the surface of the TOF sensor, a distance-related phase delay occurs. 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 distance measuring device (refer to the above formula (2) for understanding).
步骤602、物体测距装置识别第一图像中目标物体对应的目标区域,及在第一相位图中目标区域对应的第二相位图。 Step 602, the object ranging device identifies a target area corresponding to the target object in the first image, and a second phase image corresponding to the target area in the first phase image.
请参阅图7所示,图7为第一图像的目标区域及目标区域对应的第二相位图的示意图。物体测距装置识别第一图像中的目标区域,目标区域为第一图像中目标物体所对应的位置。物体测距装置确认第一图像中的目标区域,按照目标区域的位置确定第一相位图中目标区域对应的第二相位图。Please refer to FIG. 7 , which is a schematic diagram of a target area of the first image and a second phase map corresponding to the target area. The object ranging device identifies a target area in the first image, where the target area is a position corresponding to the target object in the first image. The object ranging device confirms the target area in the first image, and determines the second phase map corresponding to the target area in the first phase map according to the position of the target area.
物体测距装置识别目标区域的方法并不限定。示例性的,在一种可能的实现方式中,物体测距装置内置有物体识别模型,如该物体识别模型可以为神经网络模型,物体测距装置利用物体识别模型识别目标物体,并标记目标物体所在的位置信息。在另一种可能的实现方式中,该目标区域也可以为TOF传感器的对焦区域,例如,TOF传感器接收目标物体反射回来的光波进行自动对焦,例如,在第一图像中,目标物体可以通过一方框圈定,该方框区域为对焦区域。该目标区域可以理解为感兴趣区域(region of interest,ROI),ROI区域是从图像中选择的一个图像区域,这个区域是进行图像分析所关注的重点区域。The method for identifying the target area by the object ranging device is not limited. Exemplarily, in a possible implementation, the object distance measuring device has a built-in object recognition model, such as the object recognition model can be a neural network model, and the object distance measuring device uses the object recognition model to identify the target object and mark the target object location information. In another possible implementation, the target area can also be the focus area of the TOF sensor. For example, the TOF sensor receives the light waves reflected by the target object to perform automatic focusing. For example, in the first image, the target object can pass through one side The area enclosed by the frame is the focus area. The target area can be understood as a region of interest (region of interest, ROI). The ROI area is an image area selected from an image, and this area is a key area for image analysis.
步骤603、物体测距装置根据目标物体的尺寸信息获取目标物体距离TOF传感器的估 计距离,其中,尺寸信息包括第一图像中目标物体的图像尺寸,或者,目标物体的实际物理尺寸。 Step 603, the object ranging device obtains the estimated distance of the target object from the TOF sensor according to 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.
在方式A中,目标物体的尺寸信息为目标物体的图像尺寸。In mode A, the size information of the target object is the image size of the target object.
本申请实施例中,不限定目标物体的类别。示例性的,目标物体的类别以人脸为例进行示例性说明。请参阅图8所示,图8为不同距离(第一距离)下人脸所占像素个数的关系示意图。图8给出了成人和孩子在距离某一款所有参数都确定的相机在不同距离(第一距离)下所拍摄到人脸所占pixel的个数。第一距离即为图8中横轴所示出的多个距离,多个预设图像尺寸即为图8中纵轴所示出的多个尺寸。人脸所占像素个数即为人脸的图像尺寸。随着第一距离的增大,人脸所占像素的个数随之减少,相应地,随着第一距离的减小,人脸所占像素的个数随之增多。由此,可以通过人脸所占像素个数来粗略判断人脸的大概位置。In this embodiment of the present application, the category of the target object is not limited. Exemplarily, the category of the target object is illustrated by taking a human face as an example. Please refer to FIG. 8 , which is a schematic diagram of the relationship between the number of pixels occupied by faces at different distances (the first distance). Figure 8 shows the number of pixels occupied by human faces captured by adults and children at different distances (first distance) from a certain camera with all parameters determined. The first distance is the multiple distances shown on the horizontal axis in FIG. 8 , and the multiple preset image sizes are the multiple sizes shown on the vertical axis in FIG. 8 . The number of pixels occupied by the face is the image size of the face. As the first distance increases, the number of pixels occupied by the face decreases, and correspondingly, as the first distance decreases, the number of pixels occupied by the face increases. Thus, the approximate position of the face can be roughly judged by the number of pixels occupied by the face.
物体测距装置根据目标物体的图像尺寸,及预设关系确定估计距离。该预估距离可以理解为一个大致距离。物体测距装置预先存储有尺寸信息,尺寸信息包括多个第一距离与多个预设图像尺寸,及多个第一距离与多个预设图像尺寸之间的一一对应关系。目标物体的图像尺寸为多个预设图像尺寸中的目标预设图像尺寸,估计距离为与目标预设图像尺寸具有对应关系的第一距离。The object ranging device determines the estimated distance according to the image size of the target object and a preset relationship. The estimated distance can be understood as an approximate distance. The object ranging device stores size information in advance, and the size information includes a plurality of first distances and a plurality of preset image sizes, and a one-to-one correspondence between the plurality of first distances and the plurality of preset image sizes. The image size of the target object is a target preset image size among the multiple preset image sizes, and the estimated distance is a first distance corresponding to the target preset image size.
示例性的,请参阅上述图8进行理解,图像尺寸=横向H(horizontal)像素×竖向V(vertical)。目标物体以孩子人脸为例,例如,图像尺寸为100个像素,100个像素对应的第一距离为0.6m,也即当目标物体的图像尺寸为100个像素时,能够根据预设关系得到估计距离为0.6m。For example, please refer to the above-mentioned FIG. 8 for understanding, image size=horizontal H (horizontal) pixels×vertical V (vertical). The target object takes a child's face as an example. For example, the image size is 100 pixels, and the first distance corresponding to 100 pixels is 0.6m. That is, when the image size of the target object is 100 pixels, it can be obtained according to the preset relationship The estimated distance is 0.6m.
在这种实现方式中,物体测距装置可以依据第一图像中人脸所占像素的数量来判断人脸距离测距装置的一个大致距离(估计距离)。In this implementation manner, the object ranging device may determine an approximate distance (estimated distance) between the human face and the ranging device according to the number of pixels occupied by the human face in the first image.
在实现B中,目标物体的尺寸信息为目标物体的实际物理尺寸。目标物体的类别以人脸为例进行示例性说明。In implementation B, the size information of the target object is the actual physical size of the target object. The category of the target object is illustrated by taking a human face as an example.
物体测距装置根据第二相位图计算目标物体与TOF传感器之间的多个距离(也称为“第二距离”),多个第二距离中的每个第二距离对应一个目标物体的估计尺寸。The object ranging device calculates a plurality of distances (also referred to as "second distances") between the target object and the TOF sensor according to the second phase map, and each second distance in the plurality of second distances corresponds to an estimate of a target object size.
物体测距装置根据第二相位图进行计算,由于可能存在相位缠绕现象,即不能确定目标物体的实际距离对应哪个信号周期,故而针对不同的信号周期会计算出多个不同的距离。示例性的,物体测距装置对第二相位图进行还原计算出3个距离,这3个距离对应的位置是人脸可能出现的位置。请参阅图9进行理解,人脸可能出现的位置分别为25cm、75cm和125cm。例如,物体测距装置根据这3个距离计算出对应的3个人脸尺寸,可计算得到人脸宽度(估计尺寸)分别为5cm、15cm和25cm。即人脸位置为25cm时,对应的人脸的估计宽度是5cm;人脸位置为75cm时,对应的人脸的估计宽度是15cm;人脸位置为125cm时,对应的人脸的估计宽度是25cm。The object distance measuring device performs calculations based on the second phase diagram. Since there may be a phase winding phenomenon, that is, it is impossible to determine which signal period the actual distance of the target object corresponds to, multiple different distances will be calculated for different signal periods. Exemplarily, the object ranging device restores and calculates three distances from the second phase image, and the positions corresponding to these three distances are positions where human faces may appear. Please refer to Fig. 9 for understanding, the positions where faces may appear are 25cm, 75cm and 125cm respectively. For example, the object ranging device calculates the corresponding three human face sizes according to the three distances, and the human face widths (estimated sizes) can be calculated to be 5cm, 15cm and 25cm respectively. That is, when the face position is 25cm, the estimated width of the corresponding face is 5cm; when the face position is 75cm, the estimated width of the corresponding face is 15cm; when the face position is 125cm, the estimated width of the corresponding face is 25cm.
对如何计算人脸宽度进行简要说明。示例性的,相机的视场角已知,如视场角为m度,在灰度图中,第一图像的宽度占p个像素,人脸的宽度占q个像素,由此,图9中α角如下述式(9)计算。A brief description of how to calculate the face width. Exemplarily, the field of view of the camera is known. For example, the field of view is m degrees. In the grayscale image, the width of the first image occupies p pixels, and the width of the face occupies q pixels. Therefore, FIG. 9 The middle α angle is calculated according to the following formula (9).
Figure PCTCN2021128943-appb-000012
Figure PCTCN2021128943-appb-000012
进一步的,根据
Figure PCTCN2021128943-appb-000013
及第二距离,通过三角函数计算公式能够计算出人脸的估计宽度(估计尺寸)。需要说明的是,此处第二距离的数量仅是为了方便说明而举的例子,实际应用的过程中,第二距离的数量可能会更多。
Further, according to
Figure PCTCN2021128943-appb-000013
and the second distance, the estimated width (estimated size) of the human face can be calculated through a trigonometric calculation formula. It should be noted that the number of the second distances here is just an example for convenience of description, and the number of the second distances may be more in a process of actual application.
物体测距装置将目标物体的实际物理尺寸与多个估计尺寸进行匹配,确定与实际物理尺寸相匹配的目标估计尺寸。The object ranging device matches the actual physical size of the target object with a plurality of estimated sizes to determine the estimated size of the target that matches the actual physical size.
示例性的,基于经验值,人脸的实际物理尺寸为15cm(人脸大致宽度),将该目标物体的实际物理尺寸与多个估计尺寸(5cm、15cm和25cm)进行匹配,则目标估计尺寸为15cm。Exemplary, based on empirical values, the actual physical size of the human face is 15cm (the approximate width of the human face), and the actual physical size of the target object is matched with multiple estimated sizes (5cm, 15cm and 25cm), then the target estimated size It is 15cm.
物体测距装置确定目标估计尺寸对应的第二距离为估计距离D EThe object ranging device determines that the second distance corresponding to the estimated size of the target is the estimated distance D E .
目标估计尺寸(15cm)是最接近真实的人脸宽度(即人脸的实际物理尺寸)的尺寸,因此选择15cm对应的75cm作为估计距离。The target estimated size (15cm) is the size closest to the real face width (that is, the actual physical size of the face), so 75cm corresponding to 15cm is selected as the estimated distance.
在这种实现方式中,物体测距装置能够根据第二相位图还原出目标物体可能的位置,能够基于多个可能的位置计算出目标物体的估计尺寸,进一步的,在多个估计尺寸中选择一个与目标物体的实际物理尺寸相匹配(最接近)的一个估计尺寸(目标估计尺寸),将目标估计尺寸对应的第二距离作为估计距离。In this implementation, the object ranging device can restore the possible position of the target object according to the second phase map, and can calculate the estimated size of the target object based on multiple possible positions, and further, select An estimated size (target estimated size) that matches (closest to) the actual physical size of the target object, and the second distance corresponding to the estimated target size is used as the estimated distance.
步骤604、物体测距装置根据估计距离和第二相位图计算目标区域中每个像素对应的解缠系数。 Step 604, the object ranging device calculates the unwrapping coefficient corresponding to each pixel in the target area according to the estimated distance and the second phase map.
解缠系数用于指示目标物体的实际位置对应的信号周期。请参阅图3a进行理解,传统的单频测距技术能够计算出多个被测物体可能对应的位置,但是不能确定被测物体的真实位置对应哪个信号周期。本实施例中,被测物体的真实位置对应哪个信号周期可以用解缠系数来表示。由于物体测距装置在一个信号周期内能够测量的最大距离为一个模糊距离,故而,解缠系数也可以理解为:用于指示目标物体的实际位置位于第几个模糊距离内。The unwrapping coefficient is used to indicate the signal period corresponding to the actual position of the target object. Please refer to FIG. 3a for understanding. The traditional single-frequency ranging technology can calculate the possible positions of multiple measured objects, but cannot determine which signal period the real position of the measured object corresponds to. In this embodiment, which signal cycle corresponds to the real position of the measured object can be represented by the unwrapping coefficient. Since the maximum distance that the object distance measuring device can measure within one signal period is an ambiguity distance, the unwrapping coefficient can also be understood as: used to indicate which ambiguity distance the actual position of the target object is within.
物体测距装置按照如下公式(10)计算解缠系数:The object ranging device calculates the unwrapping coefficient according to the following formula (10):
Figure PCTCN2021128943-appb-000014
Figure PCTCN2021128943-appb-000014
其中,N表示解缠系数,round表示四舍五入计算,D E表示估计距离,U表示模糊距离,
Figure PCTCN2021128943-appb-000015
表示相位延迟。
Among them, N represents the unwrapping coefficient, round represents rounding calculation, D E represents the estimated distance, U represents the fuzzy distance,
Figure PCTCN2021128943-appb-000015
Indicates phase delay.
在一个具体的实施方式中,由于人脸是有深度的,因此目标区域中像素对应的相位延迟可能存在相位翻转。其中,第一图像中人脸对应的目标区域包括第一区域和第二区域,第一区域和第二区域在空间上连续,无深度跳变,也就是说,在灰度图(RGB图)中整个人脸区域是光滑的。In a specific implementation, since the human face has depth, there may be a phase reversal in the phase delay corresponding to the pixels in the target area. Wherein, the target area corresponding to the face in the first image includes the first area and the second area, and the first area and the second area are spatially continuous without depth jump, that is to say, in the grayscale image (RGB image) The entire face area in is smooth.
相位翻转是指第一相位延迟和第二相位延迟不在同一个信号周期,第一相位延迟是第一区域中多个像素对应的相位延迟,第二相位延迟是第二区域中多个像素对应的相位延迟。对相位翻转现象进行举例说明,例如,第一区域为人脸鼻尖区域对应的区域,第二区域为人脸耳朵对应的区域,鼻尖的位置相对于耳朵的位置距离物体测距装置的距离更近,若一 个信号周期是【0度,360度】,鼻尖区域的至少一个像素对应的相位延迟是355度,而耳朵区域的至少一个像素对应的相位延迟是365度,即鼻尖区域对应的相位延迟和耳朵区域对应的相位延迟不在一个信号周期,则表明目标区域存在相位翻转。Phase inversion means that the first phase delay and the second phase delay are not in the same signal cycle, the first phase delay is the phase delay corresponding to multiple pixels in the first area, and the second phase delay is the phase delay corresponding to multiple pixels in the second area phase delay. To illustrate the phase reversal phenomenon, for example, the first area is the area corresponding to the nose tip area of the human face, and the second area is the area corresponding to the ears of the human face. The position of the nose tip is closer to the object distance measuring device than the position of the ear. If A signal period is [0 degrees, 360 degrees], the phase delay corresponding to at least one pixel in the nose tip area is 355 degrees, and the phase delay corresponding to at least one pixel in the ear area is 365 degrees, that is, the phase delay corresponding to the nose tip area and the ear If the phase delay corresponding to the region is not within one signal period, it indicates that there is a phase inversion in the target region.
基于目标区域中像素对应的相位延迟是否存在相位翻转,包括下述情况1和情况2。Whether there is phase inversion based on the phase delay corresponding to the pixels in the target area, including the following cases 1 and 2.
情况1、当目标区域中的多个像素对应的相位延迟不存在相位翻转时,目标区域内每个像素对应的解缠系数相同。在这种情况中,目标区域内所有的像素对应的解缠系数为同一个值,目标区域内多个像素的深度值接近估计距离D ECase 1: When the phase delays corresponding to multiple pixels in the target area do not have phase inversion, the unwrapping coefficients corresponding to each pixel in the target area are the same. In this case, the unwrapping coefficients corresponding to all the pixels in the target area are the same value, and the depth values of multiple pixels in the target area are close to the estimated distance D E .
情况2、当目标区域中的多个像素对应的相位延迟存在相位翻转时,解缠系数包括第一解缠系数和第二解缠系数。其中,第一相位延迟与第一解缠系数有关,第二相位延迟与第二解缠系数有关。第一解缠系数用于计算第一区域对应的深度图,第二解缠系数用于计算第二区域对应的深度图。Case 2: When the phase delays corresponding to multiple pixels in the target area have phase inversion, the unwrapping coefficients include a first unwrapping coefficient and a second unwrapping coefficient. Wherein, 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.
示例性的,将第一相位延迟355度代入到上述(10)得到第一解缠系数N 1,而将相位延迟5度(第二相位延迟365度-360度)代入到上述式(10)得到第二解缠系数N 2。例如,N 1=0,表明鼻尖对应第一个信号周期,而N 2=1表明耳朵对应第二个信号周期。N1和N2指示出第一区域和第二区域对应的真实位置。 Exemplarily, the first phase delay of 355 degrees is substituted into the above (10) to obtain the first unwrapping coefficient N 1 , and the phase delay of 5 degrees (the second phase delay of 365 degrees - 360 degrees) is substituted into the above formula (10) The second unwrapping coefficient N 2 is obtained. For example, N 1 =0 indicates that the tip of the nose corresponds to the first signal period, while N 2 =1 indicates that the ear corresponds to the second signal period. N1 and N2 indicate the real positions corresponding to the first area and the second area.
步骤605、物体测距装置根据解缠系数和第二相位图确定目标区域的深度图。 Step 605, the object ranging device determines the depth map of the target area according to the unwrapping coefficient and the second phase map.
物体测距装置根据解缠系数和第二相位图计算目标区域内每个像素对应的实际距离。物体测距装置可以按照下式(11)进行计算每个像素对应的实际距离。The object ranging device calculates the actual distance corresponding to each pixel in the target area according to 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).
Figure PCTCN2021128943-appb-000016
Figure PCTCN2021128943-appb-000016
其中,
Figure PCTCN2021128943-appb-000017
为相位延迟,N为解缠系数,U为模糊距离。
in,
Figure PCTCN2021128943-appb-000017
is the phase delay, N is the unwrapping coefficient, and U is the ambiguity distance.
在上述情况1中,整个目标区域使用同一个解缠系数计算每个像素对应的实际距离。在上述情况2中,第一区域使用第一解缠系数计算第一区域内每个像素对应的实际距离,而第二区域使用第二解缠系数计算第二区域内每个像素对应的实际距离,即在目标区域内的不同区域使用不同的解缠系数。例如,N 1=0,表明鼻尖对应第一个信号周期,而N 2=1表明耳朵对应第二个信号周期,通过N1和N2指示出第一区域和第二区域对应的真实位置。相对于当前的单频测距技术中,物体测距装置不会计算解缠系数,若耳朵对应的相位延迟是365度,会直接将365度折算成5度(365度-360度),按照上述式(2)来计算距离,5度和365度对应的距离是不同的,由此,会造成人脸区域深度值不连贯,而本实施例中,通过N 1和N 2指示出第一区域和第二区域所对应的2个信号周期,2个信号周期能够指示第一区域和第二区域对应的真实位置,从而使得最终基于人脸对应的目标区域生成一个连贯的深度图。 In case 1 above, the entire object area uses the same unwrapping coefficient to calculate the actual distance corresponding to each pixel. In the above case 2, the first area uses the first unwrapping coefficient to calculate the actual distance corresponding to each pixel in the first area, and the second area uses the second unwrapping coefficient to calculate the actual distance corresponding to each pixel in the second area , that is, different unwrapping coefficients are used in different regions within the target region. For example, N 1 =0 indicates that the tip of the nose corresponds to the first signal period, and N 2 =1 indicates that the ear corresponds to the second signal period, and N1 and N2 indicate the corresponding real positions of the first area and the second area. Compared with the current single-frequency ranging technology, the object ranging device will not calculate the unwrapping 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) is used to calculate the distance, and the corresponding distances of 5 degrees and 365 degrees are different, thus, the depth value of the face area will be incoherent, and in this embodiment, N1 and N2 indicate the first The two signal periods corresponding to the area and the second area can indicate the real positions corresponding to the first area and the second area, so that a coherent depth map can be finally generated based on the target area corresponding to the face.
依据上述式(11),物体测距装置可以计算出目标区域内每个像素所对应的实际距离,为了重建出真实场景中的三维信息,还需要进一步对数据进行处理。根据每个像素的二维坐标及每个像素对应的真实距离D r求解出每个像素对应的三维坐标,请参阅下述式(12)到式(14)。 According to the above formula (11), the object ranging device can calculate the actual distance corresponding to each pixel in the target area. In order to reconstruct the three-dimensional information in the real scene, further data processing is required. The three-dimensional coordinates corresponding to each pixel are calculated according to the two-dimensional coordinates of each pixel and the real distance D r corresponding to each pixel, please refer to the following formulas (12) to (14).
Figure PCTCN2021128943-appb-000018
Z w=D r,式(14)。
Figure PCTCN2021128943-appb-000018
Z w =D r , formula (14).
其中,(u i,v i)表示第i个像素点,u 0,v 0表示光心在图像坐标系中的坐标,f x表示水平方向上的焦距,f y表示竖直方向上的焦距。(X w,Y w,Z w)表示世界坐标系下的坐标。 Among them, (u i , v i ) represents the i-th pixel point, u 0 , v 0 represent the coordinates of the optical center in the image coordinate system, f x represents the focal length in the horizontal direction, and f y represents the focal length in the vertical direction . (X w , Y w , Z w ) represent coordinates in the world coordinate system.
本申请实施例中,测距装置根据所述目标物体的尺寸信息获取所述目标物体距离TOF传感器的大致距离(估计距离),能够根据估计距离和相位图计算目标区域中每个像素对应的解缠系数,解缠系数能够指示出目标物体对应的每个像素位于的信号周期,根据每个像素的解缠系数和相位图可以确定每个像素对应的真实距离,即得到目标区域的深度图。相对于传统方法,在单频测距技术中,不需要降低调制频率来增加模糊距离就能够得到目标物体对应的目标区域的深度图,从而保证测距精度。In the embodiment of the present application, the ranging device obtains the approximate distance (estimated distance) between the target object and the TOF sensor according to the size information of the target object, and can calculate the solution corresponding to each pixel in the target area according to the estimated distance and the phase map. The unwrapping coefficient and unwrapping coefficient can indicate the signal cycle of each pixel corresponding to the target object. According to the unwrapping coefficient and phase map of each pixel, the real distance corresponding to each pixel can be determined, that is, the depth map of the target area can be obtained. Compared with the traditional method, in the single-frequency ranging technology, the depth map of the target area corresponding to the target object can be obtained without reducing the modulation frequency to increase the blur distance, thereby ensuring the ranging accuracy.
在一个具体的实施例中,前述目标物体均以人脸为例进行举例说明,本申请实施例中,并不限定目标物体的类别,在不同的应用场景中,目标物体可以属于不同的类别,上述步骤403之前,上述方法还可以包括如下步骤。In a specific embodiment, the above-mentioned target objects are illustrated by taking human faces as an example. In the embodiment of the present application, the category of the target object is not limited. In different application scenarios, the target object may belong to different categories. Before the above step 403, the above method may further include the following steps.
物体测距装置利用机器视觉技术识别该目标物体所属的类别,并根据目标物体所属的类别查询数据库中已经存储的各类别对应的物体尺寸信息。The object ranging device uses machine vision technology to identify the category to which the target object belongs, and queries the object size information corresponding to each category that has been stored in the database according to the category to which the target object belongs.
例如,目标物体的类别为人脸,物体测距装置查询数据库中人脸的尺寸信息。在上述方式A中,该尺寸信息包括如上述实施例中步骤603中的尺寸信息,尺寸信息a包括多个第一距离a与多个预设人脸图像尺寸,及多个第一距离a与多个预设人脸图像尺寸的对应关系。在上述方式B中,该人脸的尺寸信息为人脸的实际物理尺寸(如人脸宽度15cm)。For example, the category of the target object is a human face, and the object ranging device queries the size information of the human face in the database. In the above method A, the size information includes the size information in step 603 in the above embodiment, the size information a includes multiple first distances a and multiple preset face image sizes, and multiple first distances a and Correspondence of multiple preset face image sizes. In the above method B, the size information of the human face is the actual physical size of the human face (eg, the width of the human face is 15 cm).
人脸测距的应用场景。1、物体测距装置为车载终端,车载终端可以精确检测驾驶员的头部位置,以判断驾驶员是否注意力足够集中、是否正疲劳驾驶,从而启动相应对策。2、物体测距装置为移动终端(如手机,平板电脑等),移动终端识别3D人脸相较于传统的2D人脸识别技术,生物活性检测准确、安全性高,从而使得本申请实施例中的物体测距方法应用于面容解锁、移动支付应用场景等。Application scenarios of face ranging. 1. The object ranging device is a vehicle-mounted terminal. The vehicle-mounted terminal can accurately detect the position of the driver's head to judge whether the driver is focused enough and whether he is driving fatigued, so as to initiate corresponding countermeasures. 2. The object ranging device is a mobile terminal (such as a mobile phone, a tablet computer, etc.). Compared with the traditional 2D face recognition technology, the mobile terminal recognizes 3D faces, and the bioactivity detection is accurate and safe, so that the embodiments of the present application The object ranging method in the paper is applied to face unlocking, mobile payment application scenarios, etc.
又如,目标物体的类别为手部,物体测距装置查询数据库中手部的尺寸信息。在上述方式A中,该尺寸信息包括尺寸信息b,尺寸信息b包括多个第一距离b与多个预设手部图像尺寸,及多个第一距离b与多个预设手部图像尺寸的对应关系。在上述方式B中,该尺寸信息为手部的实际物理尺寸。In another example, if the category of the target object is a hand, the object ranging device queries the size information of the hand in the database. In the above method A, the size information includes size information b, and the size information b includes a plurality of first distances b and a plurality of preset hand image sizes, and a plurality of first distances b and a plurality of preset hand image sizes corresponding relationship. In the above method B, the size information is the actual physical size of the hand.
肢体测距的应用场景。1、物体测距装置为车载终端,物体测距装置检测用户的手部在运动过程的中各个位置,以控制车载娱乐系统或车用空调。2、物体测距装置为智能电视或电脑,物体测距装置检测用户的手部位置,输出相应的游戏界面,进而实现人机交互。Application scenarios of limb distance measurement. 1. The object ranging device is a vehicle-mounted terminal. The object ranging device detects various positions of the user's hand during the movement process to control the vehicle entertainment system or the vehicle air conditioner. 2. The object distance measuring device is a smart TV or a computer. The object distance measuring device detects the position of the user's hand and outputs a corresponding game interface to realize human-computer interaction.
再如,目标物体的类别为机器零件,物体测距装置查询数据库中机器零件的尺寸信息。在上述方式A中,该尺寸信息包括尺寸信息c,尺寸信息c包括多个第一距离c与多个预设机器零件图像尺寸,及多个第一距离c与多个预设机器零件图像尺寸的对应关系。在上述方式B中,该尺寸信息为机器零件的实际物理尺寸。For another example, the type of the target object is a machine part, and the object ranging device queries the size information of the machine part in the database. In the above method A, the size information includes size information c, and the size information c includes a plurality of first distances c and a plurality of preset machine part image sizes, and a plurality of first distances c and a plurality of preset machine part image sizes corresponding relationship. In the above method B, the size information is the actual physical size of the machine parts.
机器零件测距的应用场景。1、物体测距装置为工业机器人,物体测距装置检测机器零件的位置,从而可以对机器零件进行精准定位安置。Application scenarios of distance measurement of machine parts. 1. The object distance measuring device is an industrial robot, and the object distance measuring device detects the position of the machine parts, so that the machine parts can be accurately positioned and placed.
需要说明的是,上述目标物体的类别及对应的应用场景仅是举例说明,并不造成对本申请的限定性说明。It should be noted that the above categories of target objects and corresponding application scenarios are only for illustration, and do not constitute a limiting description of the present application.
请参阅图10所示,本申请实施例提供了一种物体测距装置1000,该物体测距装置用于执行上述方法实施例中物体测距装置所执行的方法。物体测距装置包括获取模块1001和处理模块1002。Referring to FIG. 10 , an embodiment of the present application provides an object distance measuring device 1000 , which is used to execute the method performed by the object distance measuring device in the foregoing method embodiments. The object ranging device includes an acquisition module 1001 and a processing module 1002 .
获取模块1001,用于利用飞行时间TOF传感器获取第一图像及第一图像对应的第一相位图;An acquisition module 1001, configured to acquire a first image and a first phase map corresponding to the first image by using a time-of-flight TOF sensor;
处理模块1002,用于识别第一图像中目标物体对应的目标区域,及在第一相位图中目标区域对应的第二相位图;A processing module 1002, configured to identify a target area corresponding to the target object in the first image, and a second phase image corresponding to the target area in the first phase image;
处理模块1002,还用于根据目标物体的尺寸信息获取目标物体距离TOF传感器的估计距离,其中,尺寸信息包括第一图像中目标物体的图像尺寸,或者,目标物体的实际物理尺寸;The processing module 1002 is further configured to acquire the estimated distance of the target object from the TOF sensor according to 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;
处理模块1002,还用于根据估计距离和第二相位图计算目标区域中每个像素对应的解缠系数;The processing module 1002 is further configured to calculate an unwrapping coefficient corresponding to each pixel in the target area according to the estimated distance and the second phase map;
处理模块1002,还用于根据解缠系数和第二相位图确定目标区域的深度图。The processing module 1002 is further configured to determine a depth map of the target area according to the unwrapping coefficient and the second phase map.
可选地,获取模块1001的功能可以由收发器来执行。其中,收发器具有发送和/或接收的功能。可选地,收发器由接收器和/或发射器代替。Optionally, the function of the obtaining module 1001 may be performed by a transceiver. Wherein, the transceiver has the function of sending and/or receiving. Optionally, the transceiver is replaced by a receiver and/or transmitter.
可选地,获取模块1001的功能也可以由处理器来执行。Optionally, the function of the obtaining module 1001 may also be executed by a processor.
可选地,处理模块1002为处理器,处理器是通用处理器或者专用处理器等。可选地,处理器包括用于实现接收和发送功能的收发单元。例如该收发单元是收发电路,或者是接口,或者是接口电路。用于实现接收和发送功能的收发电路、接口或接口电路是分开的部署的,可选地,是集成在一起部署的。上述收发电路、接口或接口电路用于代码或数据的读写,或者,上述收发电路、接口或接口电路用于信号的传输或传递。Optionally, the processing module 1002 is a processor, and the processor is a general-purpose processor or a special-purpose processor. Optionally, the processor includes a transceiver unit configured to implement receiving and sending functions. For example, the transceiver unit is a transceiver circuit, or an interface, or an interface circuit. The transceiver circuits, interfaces or interface circuits for realizing the functions of receiving and sending are deployed separately, and optionally integrated together. The above-mentioned transceiver circuit, interface or interface circuit is used for reading and writing codes or data, or the above-mentioned transceiver circuit, interface or interface circuit is used for signal transmission or transmission.
进一步的,获取模块1001用于执行上述方法实施例中的步骤601,处理模块1002用于执行上述方法实施例中的步骤602至步骤605。Further, the acquiring module 1001 is configured to execute step 601 in the above method embodiment, and the processing module 1002 is configured to execute step 602 to step 605 in the above method embodiment.
在一个具体的实施方式中,目标物体的尺寸信息为目标物体的图像尺寸;In a specific embodiment, the size information of the target object is the image size of the target object;
处理模块1002,还用于根据目标物体的图像尺寸,及预设关系确定估计距离,预设关系指示多个第一距离与多个预设图像尺寸具有对应关系,目标物体的图像尺寸为多个预设图像尺寸中的目标预设图像尺寸,估计距离为与目标预设图像尺寸具有对应关系的第一距离。The processing module 1002 is further configured to determine the estimated distance according to the image size of the target object and a preset relationship, the preset relationship indicates that multiple first distances have a corresponding relationship with multiple preset image sizes, and the image size of the target object is multiple The estimated distance of the target preset image size in the preset image size is the first distance corresponding to the target preset image size.
在一个具体的实施方式中,处理模块1002还具体用于:In a specific implementation manner, the processing module 1002 is also specifically configured to:
根据第二相位图计算目标物体与TOF传感器之间的多个第二距离,多个第二距离中的每个第二距离对应一个目标物体的估计尺寸;calculating a plurality of second distances between the target object and the TOF sensor according to the second phase map, and each second distance in the plurality of second distances corresponds to an estimated size of the target object;
将目标物体的实际物理尺寸与多个估计尺寸进行匹配,确定与实际物理尺寸相匹配的目标估计尺寸;Matching the actual physical size of the target object with the plurality of estimated sizes to determine the estimated size of the target that matches the actual physical size;
确定目标估计尺寸对应的第二距离为估计距离。The second distance corresponding to the estimated size of the target is determined as the estimated distance.
在一个具体的实施方式中,处理模块1002还具体用于:In a specific implementation manner, the processing module 1002 is also specifically configured to:
确定目标物体的类别;Determine the category of the target object;
根据类别获取目标物体的尺寸信息。Obtain the size information of the target object according to the category.
在一个具体的实施方式中,目标物体的类别为人脸。In a specific implementation manner, the category of the target object is a human face.
在一个具体的实施方式中,目标区域包括第一区域和第二区域;In a specific embodiment, the target area includes a first area and a second area;
当目标区域中的多个像素对应的相位延迟不存在相位翻转时,目标区域内每个像素对应的解缠系数相同;或者,当目标区域中的多个像素对应的相位延迟存在相位翻转时,解缠系数包括第一解缠系数和第二解缠系数,其中,相位翻转是指第一相位延迟和第二相位延迟不在同一个信号周期,第一相位延迟是第一区域中多个像素对应的相位延迟,第二相位延迟是第二区域中多个像素对应的相位延迟;第一相位延迟与第一解缠系数有关,第二相位延迟与第二解缠系数有关;第一解缠系数用于计算第一区域对应的深度图,第二解缠系数用于计算第二区域对应的深度图。When the phase delays corresponding to multiple pixels in the target area do not have phase inversion, the unwrapping coefficients corresponding to each pixel in the target area are the same; or, when the phase delays corresponding to multiple pixels in the target area have phase inversion, The unwrapping coefficient includes the first unwrapping coefficient and the second unwrapping coefficient, wherein, the phase inversion means that the first phase delay and the second phase delay are not in the same signal period, and the first phase delay is corresponding to multiple pixels in the first area The second phase delay is the phase delay corresponding to multiple pixels in the second area; 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 It 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.
请参阅图11所示,本申请实施例提供了一种物体测距装置1100,物体测距装置用于执行上述方法实施例中物体测距装置所执行的方法,具体请参阅上述方法实施例的说明。物体测距装置包括但不限定于手机,电脑,平板电脑,车载终端、智能家居(如智能电视)、游戏设备、机器人等。本申请实施例中,物体测距装置以手机为例进行说明。物体测距装置1100包括处理器1101、存储器1102、输入单元1103、显示单元1104、TOF模组1105、通信单元1106和音频电路1107等部件。存储器1102可用于存储软件程序以及模块,处理器1101通过运行存储在存储器1102的软件程序以及模块,从而执行装置的各种功能应用以及数据处理。存储器1102可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。可选地,处理器1101包括但不限于各类型的处理器,如CPU、DSP、图像信号处理器中的一个或多个。Please refer to FIG. 11, the embodiment of the present application provides an object distance measuring device 1100, the object distance measuring device is used to execute the method performed by the object distance measuring device in the above method embodiment, please refer to the above method embodiment for details illustrate. Object ranging devices include but are not limited to mobile phones, computers, tablet computers, vehicle terminals, smart homes (such as smart TVs), game devices, robots, etc. In the embodiment of the present application, a mobile phone is taken as an example of an object distance measuring device for description. The object ranging device 1100 includes a processor 1101 , a memory 1102 , an input unit 1103 , a display unit 1104 , a TOF module 1105 , a communication unit 1106 , an audio circuit 1107 and other components. The memory 1102 can be used to store software programs and modules, and 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 a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage devices. Optionally, the processor 1101 includes, but is not limited to, various types of processors, such as one or more of a CPU, a DSP, and an image signal processor.
一个具体的实施例中,处理器1101用于执行上述图5中处理模块所执行的功能。In a specific embodiment, the processor 1101 is configured to execute the functions executed by the processing modules in FIG. 5 above.
输入单元1103可用于接收输入的数字或字符信息,以及产生与装置的用户设置以及功能控制有关的键信号输入。具体地,输入单元1103可包括触控面板1131。触控面板1131,也称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触控面板1131上或在触控面板1131附近的操作)。The input unit 1103 can be used to receive inputted number or character information, and generate key signal input 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 referred to as a touch screen, can collect touch operations of the user on or near it (for example, the user uses any suitable object or accessory such as a finger or a stylus on the touch panel 1131 or near the touch panel 1131). operate).
显示单元1104可用于显示各种图像信息。显示单元1104可包括显示面板1141,可选的,可以采用液晶显示器、有机发光二极管等形式来配置显示面板1141。在某些实施例中,可以将触控面板1131与显示面板1141集成而实现装置的输入和输出功能。The display unit 1104 can be used to display various image information. The display unit 1104 may include a display panel 1141. Optionally, the display panel 1141 may be configured in the form of 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.
TOF模组1105用于产生某一频率的发射信号,并接收被测物体(目标物体)反射回来的反射信号,并根据发射信号和反射信号生成裸数据,并将裸数据传输至处理器1101。处理器1101用于根据裸数据生成灰度图和相位图,并根据灰度图和相位图生成目标物体对应的深度图。其中,TOF模组1105的结构请参阅上述图5中TOF模组40的结构进行理解。The TOF module 1105 is used to generate a transmission signal of a certain frequency, receive the reflection signal reflected by the object under test (target object), generate raw data according to the transmission signal and the reflection signal, and transmit the raw data to the processor 1101 . The processor 1101 is configured to generate a grayscale image and a phase image according to the raw data, and generate a depth image corresponding to the target object according to the grayscale image and the phase image. For the structure of the TOF module 1105 , please refer to the structure of the TOF module 40 in FIG. 5 above for understanding.
通信单元1106,用于建立通信信道,使物体测距装置通过通信信道以连接至远程服务器,并从远程服务器获取物体检测模型及场景识别模型。通信单元1106可以包括无线局域网模块、蓝牙模块、基带模块等通信模块,以及通信模块对应的射频(radio frequency,RF)电路,用于进行无线局域网络通信、蓝牙通信、红外线通信及/或蜂窝式通信系统通信。通信模块用于控制物体测距装置中的各组件的通信,并且可以支持直接内存存取。The communication unit 1106 is configured to establish a communication channel, so that the object distance measuring device is connected to a remote server through the communication channel, and obtain an object detection model and a scene recognition model from the remote server. The communication unit 1106 may include communication modules such as a wireless local area network module, a bluetooth module, a baseband module, and a radio frequency (radio frequency, RF) circuit corresponding to the communication module, for performing wireless local area network communication, Bluetooth communication, infrared communication and/or cellular communication. Communication system communication. The communication module is used to control the communication of each component in the object ranging device, and can support direct memory access.
可选地,通信单元1106中的各种通信模块一般以集成电路芯片的形式出现,并可进行 选择性组合,而不必包括所有通信模块及对应的天线组。例如,通信单元1106可以仅包括基带芯片、射频芯片以及相应的天线以在一个蜂窝通信系统中提供通信功能。经由通信单元1106建立的无线通信连接,物体测距装置可以连接至蜂窝网或因特网。Optionally, various communication modules in the communication unit 1106 generally appear in the form of integrated circuit chips, and can be selectively combined without including all communication modules and corresponding antenna groups. For example, the communication unit 1106 may only include a baseband chip, a radio frequency chip and corresponding antennas to provide communication functions in a cellular communication system. Via the wireless communication connection established by the communication unit 1106, the object ranging device can be connected to a cellular network or the Internet.
音频电路1107、扬声器1108和传声器1109可提供用户与手机之间的音频接口。音频电路1107可将接收到的音频数据转换后的电信号,传输到扬声器1108,由扬声器1108转换为声音信号输出。传声器1109将收集的声音信号转换为电信号,由音频电路1107接收后转换为音频数据,再将音频数据输出处理器1101处理后,经通信单元1106以发送给比如另一手机,或者将音频数据输出至存储器1102以便进一步处理。 Audio circuitry 1107, speaker 1108, and microphone 1109 may provide an audio interface between the user and the handset. The audio circuit 1107 can transmit the electrical signal converted from the received audio data to the speaker 1108, and the speaker 1108 converts it into an audio signal for output. The microphone 1109 converts the collected sound signal into an electrical signal, which is converted into audio data after being received by the audio circuit 1107, and then the audio data is processed by the output processor 1101, and then sent to, for example, another mobile phone through the communication unit 1106, or the audio data Output to memory 1102 for further processing.
虽然未示出,物体测距装置还可以包括更多的部件,如摄像头、电源等,具体的不详细说明。Although not shown, the object ranging device may also include more components, such as a camera, a power supply, etc., which will not be described in detail.
本申请实施例还提供了一种计算机可读存储介质,用于储存计算机程序或指令,计算机程序或指令被执行时使得计算机执行上述方法实施例中物体测距装置的方法。The embodiment of the present application also provides a computer-readable storage medium for storing computer programs or instructions. When the computer programs or instructions are executed, the computer executes the method of the object distance measuring device in the above method embodiments.
本申请实施例提供了一种芯片,芯片包括处理器和通信接口,通信接口例如是输入/输出接口、管脚或电路等。处理器用于读取指令以执行上述方法实施例中物体测距装置所执行的方法。An embodiment of the present application provides a chip, and the chip includes a processor and a communication interface, where the communication interface is, for example, an input/output interface, a pin, or a circuit. The processor is used to read instructions to execute the method executed by the object ranging device in the above method embodiment.
本申请实施例还提供了一种计算机程序产品,计算机程序产品中包括计算机程序代码,当计算机程序代码被计算机或处理器执行时,使得计算机或处理器实现上述方法实施例中物体测距装置执行的方法。The embodiment of the present application also provides a computer program product. The computer program product includes computer program code. When the computer program code is executed by a computer or a processor, the computer or processor implements the object distance measuring device in the above method embodiment. Methods.
计算机程序产品包括一个或多个计算机指令。在计算机上加载或执行计算机程序指令时,全部或部分地产生按照本申请实施例的流程或功能。计算机可以为通用计算机、专用计算机、计算机网络、或者其他可编程装置。计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集合的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质。半导体介质可以是固态硬盘(solid state drive,SSD)。A computer program product includes one or more computer instructions. When the computer program instructions are loaded or executed on the computer, the processes or functions according to the embodiments of the present application will be generated in whole or in part. The computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable devices. Computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, e.g. Coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that can be accessed by a computer, or a data storage device such as a server or a data center that includes one or more sets of available media. The available media may be magnetic media (eg, floppy disk, hard disk, magnetic tape), optical media (eg, DVD), or semiconductor media. The semiconductor medium may be a solid state drive (SSD).
以上所述,以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。As mentioned above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: it can still understand the foregoing The technical solutions recorded in each embodiment are modified, or some of the technical features are replaced equivalently; and these modifications or replacements do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (15)

  1. 一种物体测距方法,其特征在于,包括:A method for measuring distance from an object, comprising:
    利用飞行时间TOF传感器获取第一图像及所述第一图像对应的第一相位图;acquiring a first image and a first phase map corresponding to the first image by using a time-of-flight TOF sensor;
    识别所述第一图像中目标物体对应的目标区域,及在所述第一相位图中所述目标区域对应的第二相位图;identifying a target region corresponding to the target object in the first image, and a second phase map corresponding to the target region in the first phase map;
    根据所述目标物体的尺寸信息获取所述目标物体距离所述TOF传感器的估计距离,其中,所述尺寸信息包括所述第一图像中所述目标物体的图像尺寸,或者,所述目标物体的实际物理尺寸;Acquiring an estimated distance between the target object and the TOF sensor according to 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 target object's actual physical size;
    根据所述估计距离和所述第二相位图计算所述目标区域中每个像素对应的解缠系数;calculating an unwrapping coefficient corresponding to each pixel in the target area according to the estimated distance and the second phase map;
    根据解缠系数和所述第二相位图确定所述目标区域的深度图。Determining a depth map of the target region according to unwrapping coefficients and the second phase map.
  2. 根据权利要求1所述的方法,其特征在于,所述目标物体的尺寸信息为所述目标物体的图像尺寸,所述根据目标物体的尺寸信息获取所述目标物体距离所述TOF传感器的估计距离,包括:The method according to claim 1, wherein the size information of the target object is the image size of the target object, and the estimated distance between the target object and the TOF sensor is acquired according to the size information of the target object ,include:
    根据所述目标物体的图像尺寸,及预设关系确定所述估计距离,所述预设关系指示多个第一距离与多个预设图像尺寸具有对应关系,所述目标物体的图像尺寸为所述多个预设图像尺寸中的目标预设图像尺寸,所述估计距离为与所述目标预设图像尺寸具有对应关系的第一距离。The estimated distance is determined according to the image size of the target object and a preset relationship, the preset relationship indicates that a plurality of first distances have a corresponding relationship with a plurality of preset image sizes, and the image size of the target object is the a target preset image size among the plurality of preset image sizes, and the estimated distance is a first distance corresponding to the target preset image size.
  3. 根据权利要求1所述的方法,其特征在于,所述目标物体的尺寸信息为所述目标物体的实际物理尺寸,所述根据目标物体的尺寸信息获取所述目标物体距离所述TOF传感器的估计距离,包括:The method according to claim 1, wherein the size information of the target object is the actual physical size of the target object, and the estimated distance between the target object and the TOF sensor is obtained according to the size information of the target object distance, including:
    根据所述第二相位图计算所述目标物体与所述TOF传感器之间的多个第二距离,所述多个第二距离中的每个第二距离对应一个所述目标物体的估计尺寸;calculating a plurality of second distances between the target object and the TOF sensor according to the second phase map, each second distance in the plurality of second distances corresponds to an estimated size of the target object;
    将所述目标物体的实际物理尺寸与多个所述估计尺寸进行匹配,确定与所述实际物理尺寸相匹配的目标估计尺寸;matching the actual physical size of the target object with a plurality of the estimated sizes, and determining an estimated target size matching the actual physical size;
    确定所述目标估计尺寸对应的第二距离为所述估计距离。A second distance corresponding to the estimated size of the target is determined as the estimated distance.
  4. 根据权利要求1-3中任一项所述的方法,其特征在于,所述根据所述目标物体的尺寸信息获取所述目标物体距离所述TOF传感器的估计距离之前,所述方法包括:The method according to any one of claims 1-3, wherein before obtaining the estimated distance between the target object and the TOF sensor according to the size information of the target object, the method comprises:
    确定所述目标物体的类别;determining the category of the target object;
    根据所述类别获取所述目标物体的尺寸信息。The size information of the target object is acquired according to the category.
  5. 根据权利要求1-4中任一项所述的方法,其特征在于,所述目标物体的类别为人脸。The method according to any one of claims 1-4, wherein the category of the target object is a human face.
  6. 根据权利要求1-5中任一项所述的方法,其特征在于,所述目标区域包括第一区域和第二区域;The method according to any one of claims 1-5, wherein the target area comprises a first area and a second area;
    当所述目标区域中的多个像素对应的相位延迟不存在相位翻转时,所述目标区域内每个像素对应的解缠系数相同;When the phase delays corresponding to multiple pixels in the target area do not have phase inversion, the unwrapping coefficients corresponding to each pixel in the target area are the same;
    或者,or,
    当所述目标区域中的多个像素对应的相位延迟存在相位翻转时,所述解缠系数包括第一解缠系数和第二解缠系数,其中,所述相位翻转是指第一相位延迟和第二相位延迟不在 同一个信号周期,所述第一相位延迟是所述第一区域中多个像素对应的相位延迟,所述第二相位延迟是第二区域中多个像素对应的相位延迟;When the phase delays corresponding to multiple pixels in the target area have phase inversion, the unwrapping coefficients include a first unwrapping coefficient and a second unwrapping coefficient, wherein the phase inversion refers to the first phase delay and The second phase delay is not in the same signal period, the first phase delay is a phase delay corresponding to a plurality of pixels in the first region, and the second phase delay is a phase delay corresponding to a plurality of 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 corresponding to the first region , the second unwrapping coefficient is used to calculate the depth map corresponding to the second region.
  7. 一种物体测距装置,其特征在于,包括:An object ranging device is characterized in that it comprises:
    获取模块,用于利用飞行时间TOF传感器获取第一图像及所述第一图像对应的第一相位图;An acquisition module, configured to acquire a first image and a first phase map corresponding to the first image by using a time-of-flight TOF sensor;
    处理模块,用于识别所述第一图像中目标物体对应的目标区域,及在所述第一相位图中所述目标区域对应的第二相位图;A processing module, configured to identify a target area corresponding to the target object in the first image, and a second phase image corresponding to the target area in the first phase image;
    处理模块,还用于根据所述目标物体的尺寸信息获取所述目标物体距离所述TOF传感器的估计距离,其中,所述尺寸信息包括所述第一图像中所述目标物体的图像尺寸,或者,所述目标物体的实际物理尺寸;The processing module is further configured to obtain an estimated distance between the target object and the TOF sensor according to 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;
    处理模块,还用于根据所述估计距离和所述第二相位图计算所述目标区域中每个像素对应的解缠系数;A processing module, further configured to calculate an unwrapping coefficient corresponding to each pixel in the target area according to the estimated distance and the second phase map;
    处理模块,还用于根据解缠系数和所述第二相位图确定所述目标区域的深度图。The processing module is further configured to determine the depth map of the target area according to the unwrapping coefficient and the second phase map.
  8. 根据权利要求7所述的物体测距装置,其特征在于,所述目标物体的尺寸信息为所述目标物体的图像尺寸;The object ranging device according to claim 7, wherein 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 according to the image size of the target object and a preset relationship, the preset relationship indicates that a plurality of first distances have a corresponding relationship with a plurality of preset image sizes, and the target The image size of the object is a target preset image size among the plurality of preset image sizes, and the estimated distance is a first distance corresponding to the target preset image size.
  9. 根据权利要求7所述的物体测距装置,其特征在于,所述处理模块还具体用于:The object ranging device according to claim 7, wherein the processing module is further specifically used for:
    根据所述第二相位图计算所述目标物体与所述TOF传感器之间的多个第二距离,所述多个第二距离中的每个第二距离对应一个所述目标物体的估计尺寸;calculating a plurality of second distances between the target object and the TOF sensor according to the second phase map, each second distance in the plurality of second distances corresponds to an estimated size of the target object;
    将所述目标物体的实际物理尺寸与多个所述估计尺寸进行匹配,确定与所述实际物理尺寸相匹配的目标估计尺寸;matching the actual physical size of the target object with a plurality of the estimated sizes, and determining an estimated target size matching the actual physical size;
    确定所述目标估计尺寸对应的第二距离为所述估计距离。A second distance corresponding to the estimated size of the target is determined as the estimated distance.
  10. 根据权利要求7-9中任一项所述的物体测距装置,其特征在于,所述处理模块还具体用于:The object ranging device according to any one of claims 7-9, wherein the processing module is further specifically used for:
    确定所述目标物体的类别;determining the category of the target object;
    根据所述类别获取所述目标物体的尺寸信息。The size information of the target object is acquired according to the category.
  11. 根据权利要求7-10中任一项所述的物体测距装置,其特征在于,所述目标物体的类别为人脸。The object ranging device according to any one of claims 7-10, wherein the type of the target object is a human face.
  12. 根据权利要求7-11中任一项所述的物体测距装置,其特征在于,所述目标区域包括第一区域和第二区域;The object ranging device according to any one of claims 7-11, wherein the target area includes a first area and a second area;
    当所述目标区域中的多个像素对应的相位延迟不存在相位翻转时,所述目标区域内每 个像素对应的解缠系数相同;When the phase delays corresponding to multiple pixels in the target area do not have phase inversion, the unwrapping coefficients corresponding to each pixel in the target area are the same;
    或者,or,
    当所述目标区域中的多个像素对应的相位延迟存在相位翻转时,所述解缠系数包括第一解缠系数和第二解缠系数,其中,所述相位翻转是指第一相位延迟和第二相位延迟不在同一个信号周期,所述第一相位延迟是所述第一区域中多个像素对应的相位延迟,所述第二相位延迟是第二区域中多个像素对应的相位延迟;When the phase delays corresponding to multiple pixels in the target area have phase inversion, the unwrapping coefficients include a first unwrapping coefficient and a second unwrapping coefficient, wherein the phase inversion refers to the first phase delay and The second phase delay is not in the same signal period, the first phase delay is a phase delay corresponding to a plurality of pixels in the first region, and the second phase delay is a phase delay corresponding to a plurality of 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 corresponding to the first region , the second unwrapping coefficient is used to calculate the depth map corresponding to the second region.
  13. 一种物体测距装置,其特征在于,包括处理器,所述处理器与至少一个存储器耦合,所述处理器用于读取所述至少一个存储器所存储的计算机程序,使得所述物体测距装置执行如权利要求1至6中任一项所述的方法。An object distance measuring device, characterized in that it includes a processor, the processor is coupled with at least one memory, and the processor is used to read the computer program stored in the at least one memory, so that the object distance measuring device Carrying out the method according to any one of claims 1 to 6.
  14. 一种计算机可读存储介质,其特征在于,用于储存计算机程序或指令,所述计算机程序或指令被执行时使得计算机或处理器执行如权利要求1至6中任一项所述的方法。A computer-readable storage medium is characterized in that it is used to store computer programs or instructions, and when the computer programs or instructions are executed, the computer or processor executes the method according to any one of claims 1 to 6.
  15. 一种包括指令的计算机程序产品,其特征在于,当所述计算机程序产品中的指令被计算机或处理器执行时,使得所述计算机或所述处理器实现上述如权利要求1至6中任一项所述的方法。A computer program product comprising instructions, characterized in that, when the instructions in the computer program product are executed by a computer or a processor, the computer or the processor is made to implement any of the above claims 1 to 6. method described in the item.
PCT/CN2021/128943 2021-11-05 2021-11-05 Object distance measurement method and device WO2023077412A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2021/128943 WO2023077412A1 (en) 2021-11-05 2021-11-05 Object distance measurement method and device
CN202180099316.9A CN117480408A (en) 2021-11-05 2021-11-05 Object ranging method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/128943 WO2023077412A1 (en) 2021-11-05 2021-11-05 Object distance measurement method and device

Publications (1)

Publication Number Publication Date
WO2023077412A1 true WO2023077412A1 (en) 2023-05-11

Family

ID=86240416

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/128943 WO2023077412A1 (en) 2021-11-05 2021-11-05 Object distance measurement method and device

Country Status (2)

Country Link
CN (1) CN117480408A (en)
WO (1) WO2023077412A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117011365A (en) * 2023-10-07 2023-11-07 宁德时代新能源科技股份有限公司 Dimension measuring method, dimension measuring device, computer equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110109133A (en) * 2019-05-05 2019-08-09 武汉市聚芯微电子有限责任公司 Compensated distance method and distance measuring method based on the flight time
US20200090355A1 (en) * 2018-09-14 2020-03-19 Facebook Technologies, Llc Depth measurement assembly with a structured light source and a time of flight camera
CN111708032A (en) * 2019-03-18 2020-09-25 英飞凌科技股份有限公司 Resolving range measurement ambiguity using code modulated phase image frames
US20200363198A1 (en) * 2019-05-13 2020-11-19 Lumileds Llc Depth sensing using line pattern generators
US20210004937A1 (en) * 2019-07-02 2021-01-07 Microsoft Technology Licensing, Llc Machine-learned depth dealiasing
CN112986972A (en) * 2019-12-13 2021-06-18 华为技术有限公司 Method and device for detecting the position of an object

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200090355A1 (en) * 2018-09-14 2020-03-19 Facebook Technologies, Llc Depth measurement assembly with a structured light source and a time of flight camera
CN111708032A (en) * 2019-03-18 2020-09-25 英飞凌科技股份有限公司 Resolving range measurement ambiguity using code modulated phase image frames
CN110109133A (en) * 2019-05-05 2019-08-09 武汉市聚芯微电子有限责任公司 Compensated distance method and distance measuring method based on the flight time
US20200363198A1 (en) * 2019-05-13 2020-11-19 Lumileds Llc Depth sensing using line pattern generators
US20210004937A1 (en) * 2019-07-02 2021-01-07 Microsoft Technology Licensing, Llc Machine-learned depth dealiasing
CN112986972A (en) * 2019-12-13 2021-06-18 华为技术有限公司 Method and device for detecting the position of an object

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117011365A (en) * 2023-10-07 2023-11-07 宁德时代新能源科技股份有限公司 Dimension measuring method, dimension measuring device, computer equipment and storage medium
CN117011365B (en) * 2023-10-07 2024-03-15 宁德时代新能源科技股份有限公司 Dimension measuring method, dimension measuring device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN117480408A (en) 2024-01-30

Similar Documents

Publication Publication Date Title
CN105026955B (en) For to the method and apparatus for answering the data of camera to carry out noise reduction from distance perception
TWI706152B (en) Optoelectronic modules for distance measurements and/or multi-dimensional imaging, and methods of obtaining distance and/or three-dimensional data
WO2020168742A1 (en) Method and device for vehicle body positioning
US9432593B2 (en) Target object information acquisition method and electronic device
JP2021516401A (en) Data fusion method and related equipment
WO2022126427A1 (en) Point cloud processing method, point cloud processing apparatus, mobile platform, and computer storage medium
US20220277467A1 (en) Tof-based depth measuring device and method and electronic equipment
JP2017528621A (en) Handheld multi-sensor system for measuring irregular objects
CN206348456U (en) A kind of solid-state face battle array detection device
CN110494827A (en) The tracking of position and orientation to the object in virtual reality system
CN111045029A (en) Fused depth measuring device and measuring method
CN113160328A (en) External reference calibration method, system, robot and storage medium
CN103412318A (en) Portable infrared target locator and locating control method
WO2023077412A1 (en) Object distance measurement method and device
US10416305B2 (en) Positioning device and positioning method
CN106772408A (en) A kind of solid-state face battle array detection device and detection method
CN113052890A (en) Depth truth value acquisition method, device and system and depth camera
CN109032354B (en) Electronic device, gesture recognition method thereof and computer-readable storage medium
CN109000565B (en) Measuring method, measuring device and terminal
CN112987022A (en) Distance measurement method and device, computer readable medium and electronic equipment
CN113340433A (en) Temperature measuring method, temperature measuring device, storage medium, and electronic device
CN112630750A (en) Sensor calibration method and sensor calibration device
WO2021168847A1 (en) Time of flight (tof)-based ranging chip, apparatus and method
CN112400082A (en) Electronic device for providing visual effect using light emitting element based on user's position and method thereof
WO2021253308A1 (en) Image acquisition apparatus

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21962926

Country of ref document: EP

Kind code of ref document: A1