WO2020199562A1 - Depth information detection method, apparatus and electronic device - Google Patents

Depth information detection method, apparatus and electronic device Download PDF

Info

Publication number
WO2020199562A1
WO2020199562A1 PCT/CN2019/113434 CN2019113434W WO2020199562A1 WO 2020199562 A1 WO2020199562 A1 WO 2020199562A1 CN 2019113434 W CN2019113434 W CN 2019113434W WO 2020199562 A1 WO2020199562 A1 WO 2020199562A1
Authority
WO
WIPO (PCT)
Prior art keywords
group
matching template
speckle image
matching
target speckle
Prior art date
Application number
PCT/CN2019/113434
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 四川深瑞视科技有限公司
Publication of WO2020199562A1 publication Critical patent/WO2020199562A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/50Depth or shape recovery

Definitions

  • This application relates to the field of image processing technology, and more specifically, to a depth information detection method, device, and electronic equipment.
  • 3D images are more real and accurate because they have more depth information than 2D images.
  • the use of 3D scenes is more and more common, such as face payment, motion sensing games, AR shopping, etc.
  • this application proposes a depth information detection method, device and electronic equipment to improve the above problems.
  • an embodiment of the present application provides a depth information detection method, the method includes: obtaining a target speckle image group formed by projecting k different reference speckle patterns to a target object; and matching m coarse matching templates The group is matched with all or part of the target speckle image group, and the rough matching template group with the highest similarity is obtained as the primary matching template group.
  • Each matching template group corresponds to its own depth information, and every two adjacent ones
  • the interval of the rough matching template group is R
  • every two adjacent rough matching template groups include a fine matching template group
  • the interval between every two adjacent fine matching template groups is r
  • R is greater than r
  • the group or the same fine matching template group is formed by all or part of the k different reference speckle patterns respectively projected to the reference screen at the same position; the fine matching templates within the preset range before and after the primary matching template group are selected Groups, respectively matching all or part of the target speckle image group, obtaining the fine matching template group with the highest similarity as the secondary matching template group; determining the target speckle according to the depth information of the secondary matching template group The depth information of the image.
  • an embodiment of the present application provides a depth information detection device, the device includes: an image acquisition module configured to acquire a target speckle image group formed by projecting k different reference speckle patterns to a target object;
  • the rough matching module is used to match the m rough matching template groups with all or part of the target speckle image group respectively, and obtain the rough matching template group with the highest similarity as the primary matching template group, where each matching template The groups correspond to their respective depth information.
  • Every two adjacent rough matching template groups includes a fine matching template group, and every two adjacent fine matching template groups are separated Is r, R is greater than r, the same rough matching template group or the same fine matching template group is formed by all or part of the k different reference speckle patterns projected to the same position of the reference screen;
  • the fine matching module Used to select the fine matching template group within the preset range before and after the primary matching template group, respectively match all or part of the target speckle image group, and obtain the fine matching template group with the highest similarity as the secondary matching Template group;
  • a depth information determination module for determining the depth information of the target speckle image according to the depth information of the secondary matching template group.
  • an embodiment of the present application provides an electronic device, including a memory and a processor, the memory is coupled to the processor, and the memory stores instructions. When the instructions are executed by the processor, The processor executes the above-mentioned method.
  • Fig. 1 shows a schematic structural diagram of a matching template obtaining system provided by an embodiment of the present application.
  • Figures 2 to 4 show different schematic diagrams of projections in the matching template acquisition.
  • FIG. 5 shows a schematic diagram of speckle movement provided by an embodiment of the present application.
  • Fig. 6 shows a flowchart of a depth information detection method provided by an embodiment of the present application.
  • Fig. 7 shows a flowchart of a depth information detection method provided by another embodiment of the present application.
  • FIG. 8 shows a schematic diagram of a matching template provided by an embodiment of the present application.
  • FIG. 9 shows a schematic diagram of the matching template and the target speckle image area division provided by an embodiment of the present application.
  • FIG. 10 shows a schematic diagram of a specific area division method provided by an embodiment of the present application.
  • Fig. 11 shows a functional block diagram of a depth information detection device provided by an embodiment of the present application.
  • Fig. 12 shows a structural block diagram of an electronic device provided by an embodiment of the present application.
  • Fig. 13 is a storage medium for storing or carrying program codes for implementing the depth information detection method according to the embodiment of the present application.
  • Monocular speckle measurement can be used as a method to obtain image depth information.
  • monocular speckle measurement can be divided into time correlation and space correlation.
  • Time correlation generally refers to moving an equidistant reference screen in a space with a known depth.
  • the transmitter projects a pattern with speckle patterns on the reference screen, and the collector records the speckle patterns at these positions, thereby recording the corresponding known depth.
  • the speckle pattern of the equidistant reference screen in each position is moved in space. Taking advantage of the different shape of speckles at each position in space, when the target object (such as the face in face payment) is placed in this dimension, it is similar to speckles of different shapes at each position in this set of time series The degree of matching can search for the depth information of the target object.
  • Spatial correlation generally refers to only using a reference screen speckle image and projecting a speckle image with a speckle shape to the target object. Only the two images are matched for similarity to compare the target object relative to the reference screen speckle image. The offset of each coordinate position is used to obtain the depth map of the target object with the help of the external geometric triangle relationship, and obtain the depth information of the target object.
  • the time correlation method needs to load all speckle images and match them with all speckle images, and in addition to various complex forms of cross-correlation matching functions, the calculation is very time-consuming and not suitable for fast measurement methods.
  • the spatial correlation method only uses two images, and needs to calculate the offset of each coordinate position, which is time-consuming.
  • using only a small window in the calculation will bring about a large number of mismatches, while using a large window will result in a decrease in spatial resolution.
  • the accuracy will be lower.
  • an embodiment of the present application proposes a depth information detection method.
  • the approximate depth information of the target object is found through coarse matching, and then the fine matching is performed.
  • the partial fine matching image is scattered with the target. Spot image matching can obtain accurate depth information of the target object with a small amount of calculation.
  • Figure 1 shows a matching template acquisition system for acquiring a matching template used for depth information detection.
  • the matching template acquisition system includes a projection unit, an image acquisition unit and a storage unit.
  • the projection unit may include a light source, a collimating lens, a diffractive optical element and other devices for projecting patterns.
  • the projection unit can be used to project one pattern, and can also be used to project multiple patterns with different densities and/or shapes.
  • the projection unit may be a visible light projector.
  • the projection unit may be an infrared laser module, and its light source may be a VCSEL array laser for projecting infrared patterns.
  • the light source of the projection unit is a VCSEL array laser
  • the VCSEL array laser with variable density and/or shape can be continuously projected to project different patterns; it can also be combined with multiple VCSEL array lasers to emit different densities And/or the shape of the pattern; or the relative position can be changed by multiple diffractive optical elements for emitting different patterns.
  • the specific shape and density of the pattern projected by the projection unit are not limited in the embodiments of the present application.
  • different imaging can be achieved.
  • the characteristic of speckle is scattered round spots, which meets the irregular messy information required for matching.
  • the projection unit can be used to project the speckle pattern, and the speckle pattern is taken as an example for description.
  • the specific light source of the projection unit is not limited in the embodiments of the present application.
  • the speckle pattern projected by the light source can be collected by the corresponding image acquisition unit.
  • the speckle image projected by the infrared light source is collected by the infrared image acquisition device.
  • the visible light image acquisition device collects speckle images projected by the visible light source, etc.
  • the image acquisition unit maintains a certain baseline distance from the projection unit. It can be an image sensor that records the wavelength of the pattern emitted by the projection unit. It is used to collect the image of the speckle pattern projected by the projection unit. It can include photosensitive elements, filters, and lenses.
  • the image acquisition unit may be an image sensor corresponding to the type of light source.
  • the light source of the projection unit is infrared light
  • the image acquisition unit is an infrared light image acquisition device; if the light source is visible light, the image acquisition unit is a visible light image acquisition device.
  • the positional relationship between the image acquisition unit and the projection unit is not limited in the embodiment of the present application. For example, the projection unit is placed horizontally and projected horizontally, and the image acquisition unit and the projection unit are placed at the same level.
  • the storage unit is connected to the image acquisition unit, and is used to store the speckle pattern acquired by the image acquisition unit as a matching template.
  • the storage unit can be any of FLASH, ROM or hard disk.
  • the matching template acquisition system may further include a processing unit, which is electrically connected to the image acquisition unit, the projection unit, and the storage unit.
  • the platform of the processing unit can be one of ASIC, FPGA and DSP, which is used to process the collected images, and can also be used to control the projection of the projection unit and the image collection of the image acquisition unit.
  • the processing unit may include a controller for performing control, such as control by a synchronous sequential circuit and an asynchronous sequential circuit; and may also include a depth processor for performing depth information acquisition processing.
  • the units in the system can be independent of each other or integrated.
  • the system may be an electronic device that integrates a projection unit, an image acquisition unit, a storage unit, and a processing unit, such as a mobile phone, a tablet computer, and a notebook computer.
  • the matching template obtaining system can obtain the matching template for image depth information detection.
  • a reference screen can be placed in the projection direction of the projection unit (as shown by the arrow in Figure 2).
  • the reference screen is placed on the depth axis of the projection unit, and the reference screen and The distance between the projection units changes, such as increasing or decreasing sequentially.
  • the image acquisition unit acquires different distances between the reference screen and the projection unit, the speckle pattern projected by the projection unit is imaged on the reference screen.
  • the reference screen is the projection plane used to carry the speckle pattern
  • the image projected by the projection unit can be imaged on the reference screen
  • the image acquisition unit can acquire the pattern projected by the projection unit on the reference screen by collecting images on the reference screen.
  • FIG. 2 is only an exemplary illustration, and the reference screen at all positions is not drawn.
  • R11, R12 to Rpb are respectively equidistantly arranged position points in the projection direction, and the distance between every two adjacent position points of R11, R12 to Rpb is r.
  • R11, R21, R31 and so on are deduced to Rp1, among the p position points, the distance between every two adjacent position points is R.
  • the image acquisition unit collects the image projected on the reference screen by the projection unit; when the reference screen is at R12, the image acquisition unit collects the image projected on the reference screen by the projection unit; until the reference screen is at the position point In Rpb, the image acquisition unit collects the image projected on the reference screen by the projection unit.
  • the image projected to the reference screen by the speckle pattern collected at each position is a speckle image, so as to obtain a series of equidistant speckle images, and the distance between the speckle images represents the reference screen imaged by the speckle image.
  • the spacing between For example, the distance between the speckle image formed on the reference screen at R11 and the speckle image formed on the reference screen at R12 is the distance between the R11 position point and the R12 position point.
  • the distance between the reference screen and the projection unit is small, such as less than a certain minimum preset threshold, the distance between the reference screen and the projection unit is increased sequentially, and the collection is performed as the distance increases. image.
  • the way to increase the distance between the projection unit and the reference screen in sequence may be to move the reference screen in the projection direction and move away from the projection unit to form a series of equidistant reference screens.
  • the speckle pattern at each position is imaged on the reference screen to obtain a series of equally spaced images.
  • the reference screen is moved from R11 to R12 to Rpb, the speckle image projected by the projection unit is imaged on the reference screen at each position, and the image acquisition unit collects scatter at each position.
  • the speckle image is imaged on the reference screen to obtain b*p equidistant speckle images.
  • the way to increase the distance between the projection unit and the reference screen in sequence may also be to move the projection unit in the projection direction to the direction away from the reference screen at equal intervals to form a series of equidistant reference screens. Screen, obtain the imaging of the reference screen on the reference screen at each position, and obtain a series of equally spaced images.
  • the placement of the projection unit and the image acquisition unit and the reference screen is shown in Figure 4. Move the projection unit and the image acquisition unit from R11 to R12, R13 and Rpb at the same time as shown in Figure 4.
  • the projection unit is in The speckle image projected at each position point is imaged on the reference screen, and the image acquisition unit collects the imaging of the speckle image projected by the projection unit at each position point on the reference screen, b*p speckle images with a spacing of r.
  • the distance between the reference screen and the projection unit is large, such as greater than a certain maximum preset threshold, the distance between the reference screen and the projection unit is sequentially reduced, and the collection is performed as the distance decreases. image.
  • the way to sequentially reduce the distance between the projection unit and the reference screen may be to move the reference screen to the projection unit in sequence to form a series of equidistant reference screens.
  • the reference screen is moved from Rpb to Rp(b-1) to R11, the speckle image projected by the projection unit is imaged on the reference screen at each position, and the image acquisition unit collects each Refer to the speckle image on the screen at the position point to obtain b*p equidistant speckle images.
  • the way to sequentially reduce the distance between the projection unit and the reference screen may also be to move the projection unit to the reference screen in sequence to form a series of equally spaced reference screens.
  • the image acquisition unit and the projection unit are moved from Rpb to Rp(b-1) to R11 at the same time.
  • the speckle image projected by the projection unit at each position point is imaged on the reference screen.
  • the acquisition unit acquires the imaging of the speckle image projected by the projection unit at each position point on the reference screen, and obtains b*p speckle images with a spacing of r. It can be understood that when the relative displacement between the reference screen and the projection unit changes, the speckles in the speckle image will also move left and right.
  • the criterion for selecting the distance between every two adjacent position points may be such that the moving distance of the speckle is less than or equal to the radius of the speckle. That is to say, every time the distance between the reference screen and the projection unit increases or decreases by r, the moving distance of the speckle on the reference screen is less than or equal to the radius of the speckle, and the distance between the reference screen and the projection unit increases There is an intersection between the two positions where r and the reduced r speckle are located.
  • Fig. 5 shows an example of the movement of a speckle.
  • the solid circle 101 represents the image of a speckle on the reference screen when it is at a certain position on the reference screen.
  • the selection criterion for the distance between every two adjacent points is that when the distance between the reference screen and the projection unit decreases by r, the solid circle 101 moves to the position of the dotted circle 102, and the solid circle 101 to the dashed circle 102
  • the moving distance of is smaller than the radius of the solid circle 101; when the distance between the reference screen and the projection unit increases by r, the solid circle 101 moves to the position of the dashed circle 103, and the moving distance of the solid circle 101 to the dashed circle 103 It is smaller than the radius of the solid circle 101.
  • the solid circle 101 and the dashed circle 102 have an intersection, and the solid circle 101 and the dashed circle 103 also have an intersection.
  • the matching template obtaining system multiple templates can be obtained for multi-template matching, or a single template can be obtained for single-template matching.
  • the speckle pattern projected from the projection unit is defined as the reference speckle pattern.
  • a single template is a set of matching templates obtained when a reference speckle pattern is projected;
  • a multi-template is a set of matching templates obtained when multiple different reference speckle patterns are projected.
  • different reference speckle patterns may have different shapes of speckle patterns, different densities of speckle patterns, or different shapes and densities of speckle patterns.
  • a reference speckle pattern is projected from the projection unit.
  • the image acquisition unit acquires different distances between the reference screen and the projection unit
  • the speckle pattern projected by the projection unit is imaged on the reference screen to obtain the corresponding A series of matching templates for the reference speckle pattern.
  • the reference speckle pattern P1 is projected from the projection unit, and the images formed when the reference speckle pattern P1 is projected onto the reference screens at R11, R12, R13 to Rpb, respectively, are obtained to obtain b*p A matching template as a set of matching templates corresponding to the reference speckle pattern P1.
  • the multiple sets of matching templates include multiple sets of matching templates, and each set of matching templates is an image formed by projecting a different reference speckle pattern onto the same position. It is understandable that in the embodiment of the present application, a set of matching templates can also be selected from multiple templates as a single template.
  • single templates corresponding to different reference speckle patterns may be obtained in a manner of obtaining single templates, as multiple templates.
  • k different reference speckle patterns include P1, P2, P3 to Pk, project the reference speckle pattern P1 from the projection unit to obtain a set of matching templates corresponding to P1; project the reference speckle pattern P2 from the projection unit, Obtain a set of matching templates corresponding to P2; project the reference speckle pattern P3 from the projection unit to obtain a set of matching templates corresponding to P3; until the reference speckle pattern Pk is projected from the projection unit to obtain a set of matching templates corresponding to Pk,
  • k sets of matching templates corresponding to k different reference speckle patterns P1, P2, P3 to Pk are obtained.
  • the k sets of templates include b*p matching templates, and each matching template includes k matching templates P1, P2, P3 to Pk respectively projected at the same position.
  • the images formed by P1, P2, P3 to Pk projected on the reference screen at R11 are a set of matching templates
  • the images formed by P1, P2, P3 to Pk projected on the reference screen at R12 are a set of matching templates
  • the images formed by P2, P3 to Pk projected on the reference screen at R13 are a set of matching templates, and so on, forming a b*p set of matching templates.
  • different reference speckle patterns are respectively projected at each position at different distances from the projection unit, and different matching templates corresponding to different reference speckle patterns at that position are obtained.
  • the k different reference speckle patterns include P1, P2, P3 to Pk.
  • the reference speckle patterns P1, P2, P3 to Pk are respectively projected to obtain P1, P2,
  • Each of P3 to Pk is imaged at the reference screen at R11 to obtain a set of matching templates at R11, including k matching templates corresponding to P1, P2, P3 to Pk;
  • Project the reference speckle patterns P1, P2, P3 to Pk respectively obtain the imaging of the reference screen at R12 for each of P1, P2, P3 to Pk, and obtain a set of matching templates at R12, including corresponding P1, K matching templates of P2, P3 to Pk;
  • the reference screen is at Rpb, project the reference speckle patterns P1, P2, P3 to Pk respectively, and obtain the reference of each of P1, P2, P3 to Pk at Rpb
  • the imaging of the scene obtain a set of matching templates in Rpb, including k matching templates corresponding to P1, P2, P3 to Pk. So as to match the template in the b
  • a fine matching template may be selected from a single template for fine matching, and a coarse matching template may be selected for coarse matching.
  • the distance between the coarse matching templates is greater than the distance between the fine matching templates.
  • R the spacing
  • select templates at equal intervals as a set of coarse matching templates
  • Rp1 the remaining templates as fine matching templates.
  • adjacent rough matching templates include (b-1) fine matching templates.
  • the rough matching template at R11 and the rough matching template at R21 include (b-1) at R12 to R1b, respectively.
  • a fine matching template group may be selected from multiple templates for fine matching, and a coarse matching template group may be selected for coarse matching.
  • the spacing between the coarse matching template groups is greater than the spacing between the fine matching template groups
  • the matching templates in the same coarse matching template group are selected from the same set of matching templates
  • the matching templates in the same fine matching template group are selected Match templates in the same group.
  • R the spacing between the coarse matching template groups
  • multiple sets of matching templates are selected at equal intervals as multiple rough matching template groups, and the remaining sets of matching templates are used as multiple fine matching template groups.
  • p sets of matching templates formed at p positions of R11, R21, R31, R41, and so on to Rp1, respectively can be selected as p rough Matching template group; other matching templates are used as fine matching template groups.
  • the adjacent rough matching template groups include (b-1) fine matching template groups.
  • the rough matching template group at R11 and the rough matching template group at R21 include R12 to R1b respectively.
  • the number of matching templates in each rough matching template group is the same, and the corresponding reference speckle patterns are the same.
  • the reference speckle patterns corresponding to each rough matching template group are P1, P2, P3 to Pk ;
  • the number of matching templates in each fine matching template group is the same, and the corresponding reference speckle patterns are the same.
  • the reference speckle patterns corresponding to each fine matching template group are P1, P2, P3 to Pk.
  • the number of matching templates in each rough matching template group is not limited to be equal to the number of matching templates in a set of matching templates, such as the selected rough matching template group in the scenario shown in Figure 2.
  • the number of matching templates in a rough matching template group is not limited to k.
  • the number of matching templates in each fine matching template group is not limited to be equal to the number of matching templates in a set of matching templates, such as the fine matching template group selected in the scenario shown in Figure 2.
  • the number of matching templates in a fine matching template group is not limited to k.
  • the number of matching templates in each fine matching template group may be different from the number of matching templates in the rough matching template group.
  • when generating the matching template only the coarse matching template for coarse matching and the fine matching template for fine matching may be generated; or when the matching template is obtained, only the coarse matching template for coarse matching may be obtained. Matching template and fine matching template for fine matching.
  • the coarse matching template group can be regarded as the coarse matching template in single template matching; when the number of matching templates in a fine matching template group is 1, then The fine matching template group can be regarded as the fine matching template in single template matching.
  • depth information can be defined for each location point, and the change relationship between the depth information corresponds to the change relationship between the location points.
  • the depth information of R11 is defined as x0
  • the depth information of R12 is (x0-x)
  • the depth information of R13 is (x0-2x)
  • the depth information of R14 is (x0-3x)
  • the depth information of Rpb is (x0-(p*b-1)x).
  • each matching template and each group of matching templates corresponds to depth information
  • the depth information corresponding to each matching template is the depth information of the location where the matching template is obtained
  • the depth information corresponding to each group of matching templates is the acquisition The depth information corresponding to the position of the set of matching templates.
  • the selected coarse matching template, fine matching template, coarse matching template group, and fine matching template group all have depth information of corresponding positions.
  • the depth information detection of the image can be performed through the matching template obtained by the matching template acquisition system.
  • Fig. 6 shows a depth information detection method provided by an embodiment of the present application. This method can be applied to electronic devices.
  • the electronic device can be a mobile phone, a tablet computer, a personal computer, and other smart devices that can be used for in-depth information detection.
  • the depth information detection method can also be used in a depth information detection system.
  • the depth information detection system may include a projection unit, an image acquisition unit, a storage unit, and a processing unit as shown in FIG. 1, or the depth information detection system and matching template acquisition
  • the system is the same system. Among them, the target object of the measured depth needs to be placed between the distance range corresponding to the nearest and the farthest reference screen and within the field of view of the acquisition unit, that is, the effective measurement area.
  • k reference speckle patterns P1, P2, P3 to Pk are respectively projected to R11, R21, R31, and so on to the p set of matching templates formed by Rp1 as the multi-template rough matching
  • the p rough matching template groups of, and k reference speckle patterns P1, P2, P3 to Pk are respectively projected into the b*p group of matching templates formed by R11 to Rpb, and the other groups except the rough matching template group
  • the p matching templates formed by projecting the reference speckle pattern P1 to R11, R21, R31 and so on to Rp1 are used as the p coarse matching templates of single template coarse matching
  • the reference speckle pattern P1 is projected into the b*p matching templates formed by R11 to Rpb, and the matching templates except the rough matching template are used as multiple fine matching templates of single template fine matching.
  • the number of coarse matching template groups and the number of matching templates in a coarse matching template group are not limited.
  • the number of fine matching template groups and the number of fine matching template groups are not limited.
  • the number of matching templates is not limited; in single template matching, the number of rough matching templates is not limited, and the number of fine matching templates is not limited.
  • the depth information detection method may include:
  • Step S110 Obtain a target speckle image group formed by projecting k different reference speckle patterns to the target object.
  • k different reference speckle patterns can be projected to the k images formed by the target object as a target speckle image group, and each image is defined as the target speckle image group. Spot image.
  • the k different reference speckle patterns are the same as the reference speckle patterns when the matching template group is obtained.
  • each of the k images includes a target speckle image formed by projecting a reference speckle pattern onto a human face.
  • the captured image only includes the target speckle image formed by the projection of the speckle pattern
  • the k captured images are used as the target speckle image group; if the captured image also includes the image of the target object , Image processing is performed on the collected k images, and the target speckle image formed by projection of the reference speckle pattern is obtained as the target speckle image group.
  • the device for detecting depth information may project k different reference speckle patterns onto the target object to form a target speckle image group; it may also be that other devices combine k different reference speckle patterns Projecting to the target object forms a target speckle image group, and the device for depth information detection obtains the target speckle image group from other devices.
  • the preprocessing may also be performed by a device that performs depth information detection or by other devices, which is not limited in the embodiment of the present application.
  • Step S120 The m rough matching template groups are respectively matched with all or part of the target speckle image group, and the rough matching template group with the highest similarity is obtained as the primary matching template group.
  • each group of matching templates corresponds to its own depth information
  • the interval between every two adjacent rough matching template groups is R
  • every two adjacent rough matching template groups includes a fine matching template group
  • every two adjacent rough matching template groups include a fine matching template group.
  • the interval of the fine matching template group is r
  • R is greater than r.
  • the same rough matching template group or the same fine matching template group is formed by all or part of the k different reference speckle patterns projected to the reference screen at the same position.
  • R may be a positive integer multiple of r, and the positive integer is greater than 1.
  • the number of rough matching template groups as m.
  • the m rough matching template groups are respectively matched with all or part of the target speckle image group.
  • m may be equal to or less than p. In the embodiment of the present application, m is equal to p as an example for description.
  • a rough matching template group in the embodiment of the present application may include multiple matching templates for multi-template rough matching, or one rough matching template for single template matching.
  • all or part of the target speckle image group that is, the target speckle images in the target speckle image group that have the same number of matching templates as the rough matching template group and correspond to the same reference speckle pattern.
  • the rough matching template group is used for single template matching, and each rough matching template group has only one matching template corresponding to the reference speckle pattern P1, then the target speckle image corresponding to the reference speckle pattern P1 in the target speckle image group is combined with Matching of m rough matching template groups.
  • each coarse matching template group has k matching templates corresponding to the reference speckle patterns P1 to Pk, then all target speckle images in the target speckle image group are combined with m coarse speckle images. Match template group matches.
  • the number of rough matching templates in each rough matching template group can be defined as I.
  • the rough matching template group is used for single-template rough matching; when I is greater than 1, the rough matching template group is used for multiple rough matching.
  • Rough template matching when I is greater than 1, I is equal to k as an example for description, that is, the number of matching templates in each rough matching template group is equal to the number of target speckle images in the target speckle image group. Description.
  • this step it may be that one target speckle image corresponding to the rough matching template group in the target speckle image group is used as the first target speckle image group, and the m rough matching template groups are respectively combined with The first target speckle image group is matched, and the rough matching template group with the highest similarity to the first target speckle image group is acquired as a primary matching template group.
  • the distance between the rough matching template groups is R, the distance is relatively large. If all or part of the target speckle image group is roughly matched with the rough matching template group, a rough matching template group with the highest similarity can be determined. , Less precise depth information. Therefore, in the embodiment of the present application, the fine matching template group with a small distance between each other can be further matched to obtain more accurate depth information.
  • Step S130 Select the fine matching template group within the preset range before and after the primary matching template group, and respectively match all or part of the target speckle image group, and obtain the fine matching template group with the highest similarity as the secondary Match template group.
  • the rough matching template with the highest similarity to the speckle image group is defined as the primary matching template group. Since the primary matching template group can determine an approximate depth information of the target speckle image group, according to the inherent properties of the object, its more accurate depth information usually fluctuates within the approximate depth information range. Therefore, in order to reduce the amount of calculation, the fine matching template group can be selected from before and after the primary matching template group.
  • the fine matching template group before the primary matching template group that is, the fine matching template group corresponding to the position before the position of the primary matching template group
  • the fine matching template group after the primary matching template group that is, the position after the primary matching template group
  • the previous fine matching template set is R1p, R1(p-1), R1(p-2) and then the fine matching template set by analogy; the subsequent fine matching template The group is the fine matching template group of R22, R23, R24 and so on.
  • a fine matching template group in the embodiment of the present application may include multiple matching templates for multi-template fine matching, or one fine matching template for single template matching.
  • all or part of the target speckle image group that is, the target speckle images in the target speckle image group that have the same number of matching templates as the fine matching template group and correspond to the same reference speckle pattern.
  • the fine matching template group is used for single template matching, and there is only one matching template corresponding to the reference speckle pattern P1, then the target speckle image corresponding to the reference speckle pattern P1 in the target speckle image group is combined with the selected fine matching template group match.
  • the fine matching template group is used for multi-template matching, and there are only k matching templates corresponding to the reference speckle patterns P1 to Pk, then all the target speckle image groups are matched with the selected fine matching template group.
  • the number of fine matching templates in each fine matching template group can be defined as i.
  • the fine matching template group is used for single template fine matching; when i is greater than 1, the fine matching template group is used for multiple templates.
  • Fine matching when i is greater than 1, take i equal to k as an example for description, that is, take the number of matching templates in each fine matching template group equal to the number of target speckle images in the target speckle image group as an example. Description.
  • the i target speckle images corresponding to the fine matching template group in the target speckle image group are used as the second target speckle image group, and the preset ranges before and after the primary matching template group are selected.
  • the fine matching template groups within are respectively matched with the second target speckle image group, and the fine matching template group with the highest similarity to the second target speckle image group is obtained as a secondary matching template group.
  • Step S140 Determine the depth information of the target speckle image according to the depth information of the secondary matching template group.
  • the depth information of the target speckle image can be determined according to the depth information of the fine matching template group with the highest similarity to the target speckle image.
  • the target speckle image group is coarsely matched through the coarse matching template group with a larger distance from each other, and the fine matching template group is selected according to the rough matching result, and then according to the distance between each other.
  • a smaller fine matching template group performs fine matching and obtains accurate image depth information through a smaller amount of calculation.
  • the number I of matching templates in a rough matching template group, may be equal to 1 for single-template rough matching; the number I of matching templates may be greater than 1 for multi-template rough matching.
  • the number i of matching templates in a fine matching template group, can be equal to 1 for single-template fine matching; the number i of matching templates can be greater than 1 for multi-template fine matching.
  • I can be greater than 1, i is equal to 1, for multi-template coarse matching, single template fine matching; it can also be I is greater than 1, i is greater than 1, for multi-template coarse matching, multi-template fine matching; Or if I is equal to 1, and i is greater than 1, a single-template coarse matching and multiple-template fine matching are performed.
  • I and i are greater than 1 or equal to 1, the present application is described by the following embodiments.
  • FIG. 7 shows a depth information detection method provided by an embodiment, and the method includes:
  • Step S210 Obtain a target speckle image group formed by projecting k different reference speckle patterns to the target object.
  • Step S220 Use I target speckle images corresponding to the rough matching template group in the target speckle image group as the first target speckle image group, and disperse the m rough matching template groups with the first target speckle image group respectively. Spot image group matching, obtaining a rough matching template group with the highest similarity to the first target speckle image group as a primary matching template group.
  • the rough matching template group has only one rough matching template, and the m rough matching template groups are m rough matching templates corresponding to the same reference speckle pattern at different positions.
  • the target speckle image is compared with m coarse matching templates one by one, and the coarse matching template with the highest similarity to the target speckle pattern is obtained as the primary matching template group.
  • the primary matching template group There is only one matching template in the primary matching template group.
  • the m coarse matching templates and the target speckle image can be normalized first and then numerically calculated, for example, by template matching based on grayscale Algorithm SAD algorithm (Sum of absolute differences) and MAD algorithm (Mean Absolute Differences) and other algorithms perform numerical calculations to obtain m difference results corresponding to m coarse matching templates.
  • the coarse matching template corresponding to the difference result with the smallest value is the coarse matching template with the highest similarity to the target speckle image.
  • a logical operation of XOR can be used, and the m coarse matching templates are XORed with the target speckle image to obtain the corresponding m XOR results of m rough matching templates.
  • the rough matching template corresponding to the XOR result with the smallest value is the rough matching template with the highest similarity to the target speckle image.
  • the logical AND operation can be used, and the m coarse matching templates are respectively ANDed with the target speckle image to obtain the corresponding m Roughly match the m AND results of the template.
  • the coarse matching template corresponding to the result of and with the largest value is the coarse matching template with the largest number of overlapping speckles of the target speckle image, and the coarse matching template with the highest similarity to the target speckle image.
  • the depth information of the rough matching template with the highest similarity to the target speckle image is close to the depth information of the target speckle image.
  • the reference speckle patterns respectively corresponding to the target speckle images in the first target speckle image group are the same as the reference speckle patterns respectively corresponding to the rough matching template group.
  • the first target speckle image group is the target speckle image group. In the embodiment of the present application, I is equal to k as an example for description.
  • each rough matching template group when the first target speckle image group is matched with the rough matching template group, each rough matching template group can be taken as a whole, and the first target speckle image group can be taken as a whole, and each rough matching can be calculated.
  • the similarity between the template group and the first target speckle image group; the rough matching template group with the highest similarity to the first target speckle image group is used as the primary matching template group.
  • the k coarse matching templates on the time axis T are a group of coarse matching templates, which are regarded as a three-dimensional space, which is called a voxel.
  • the k coarse matching templates T1 to Tk on the space axis S1 are a coarse matching template group, which is regarded as a three-dimensional space, which is called a voxel.
  • the k coarse matching templates T1 to Tk on the spatial axis S2 are a coarse matching template group, which is regarded as a three-dimensional space, which is called a voxel.
  • the first target speckle image group can also be regarded as a three-dimensional space, that is, voxels.
  • the characteristics of the rough matching template group on the spatial axis are more obvious, and the difference in depth can be more sensitively distinguished with slight differences.
  • the first target speckle image group when calculating the similarity between the rough matching template group and the first target speckle image group, the first target speckle image group may be used as a voxel, and each rough matching template As a voxel, the group is matched with the highest similarity through three-dimensional calculations, such as numerical operations, logical operations, or cross-correlation.
  • voxels can also be split into two-dimensional matrices or one-dimensional sequences to simplify operations. For example, when calculating the similarity between the coarse matching template group and the first target speckle image group by using a 3-dimensional cross-correlation formula, the calculation formula may be:
  • a in the formula represents the voxel formed by the rough matching template group, Is the average value of the voxel.
  • B represents the voxel formed by the first target speckle image group, Is the corresponding average value.
  • m, n, and s represent the length, width, and height of the voxel, respectively, and i, j, and k are the control variables for the length, width, and height of the voxel, respectively.
  • corr3 is the similarity coefficient of the voxel, and the value reflects the similarity between the two. It is understandable that each letter in the formula represents various meanings defined in this paragraph, and has nothing to do with the aforementioned i representing the number of matching templates, m, n representing the number of matching template groups, and so on.
  • each target speckle image in the target speckle image group can be matched with a rough matching template group for single template matching, and then the target can be obtained according to the rough matching template with the highest similarity of each target speckle image.
  • the primary matching template group with the highest pixel degree of the speckle image group can be matched with a rough matching template group for single template matching, and then the target can be obtained according to the rough matching template with the highest similarity of each target speckle image.
  • the calculation method may be the same for each target speckle image in the first target speckle image group. For any target speckle image, determine m coarse matching templates corresponding to the target speckle image in the m coarse matching template group, that is, determine m coarse speckle patterns corresponding to the target speckle image. Match the template. Then calculate the similarity between the m rough matching templates and the target speckle image, and obtain the rough matching template with the highest similarity to the target speckle image.
  • Each target speckle image in the first target speckle image group corresponds to a rough matching template with the highest similarity, so that one target speckle image corresponding to one target speckle image in the first target speckle image group has the highest similarity.
  • To determine the primary matching template group To determine the primary matching template group.
  • a rough matching template with the highest similarity of each target speckle image in the first target speckle image group may be calculated to obtain a matching template, which is used as the primary matching template group.
  • determining the primary matching template group according to one rough matching template with the highest similarity corresponding to one target speckle image in the first target speckle image group may include: obtaining one rough matching template with the highest similarity
  • the similarity coefficients corresponding to the matching templates respectively obtain I similarity coefficients.
  • the similarity coefficient representing the highest similarity is obtained, and the rough matching template corresponding to the similarity coefficient representing the highest similarity is used as the primary matching template group. That is, the primary matching template group is a rough matching template, and the similarity between the rough matching template and the corresponding target speckle image is greater than the similarity between other rough matching templates and the corresponding target speckle image.
  • the I similarity coefficients may be firstly subjected to a parallel multiplication, addition, or mean operation, so as to better distinguish the similarity.
  • determining the primary matching template group according to one rough matching template with the highest similarity corresponding to one target speckle image in the first target speckle image group may include: determining one rough matching template with the highest similarity Match the depth information corresponding to the template to obtain I depth information. Then calculate the average value of the I depth information to obtain the average depth information to reduce accidental errors caused by noise in certain places.
  • the matching template corresponding to the average depth information is used as the primary matching template group.
  • Step S230 Use i target speckle images corresponding to the fine matching template group in the target speckle image group as the second target speckle image group, and select fine matching template groups within a preset range before and after the primary matching template group , Respectively matching with the second target speckle image group, and obtaining the fine matching template group with the highest similarity with the second target speckle image group as the secondary matching template group.
  • the preset range may be a preset range, such as the first number of fine matching template groups before the primary matching template group, The second number of fine matching templates after the primary matching template group.
  • a fine matching template group within a preset range before and after the primary matching template group is selected, and the preset range can be calculated based on the similarity between the primary matching template group and the first target speckle image group.
  • the higher the similarity the closer the depth information of the target speckle image is to the primary matching template group, and the smaller the range that can be selected.
  • ⁇ 1 fine matching template groups from before and after the primary matching template group; if the similarity is [ ⁇ 1, ⁇ 2] In between, ⁇ 2 fine matching template groups are selected from the front and back of the primary matching template group; if the similarity is greater than ⁇ 2 , ⁇ 3 fine matching template groups are respectively selected from the front and back of the primary matching template group.
  • ⁇ 1 ⁇ 2 , r 1 >r 2 >r 3 are selected in order from the fine matching template group adjacent to the primary matching template group.
  • the primary matching template group is at the boundary, only one direction needs to be selected, that is, the direction of the matching template group before or after. For example, if the primary matching template group is obtained at position R11, and the similarity between the primary matching template group and the first target speckle image group is less than ⁇ 1 , then starting from R12, ⁇ 1 fine matching template group is selected in the direction of Rpb.
  • the method of performing fine matching through the selected fine matching template group is similar to the coarse matching method of the coarse matching template group.
  • the following describes the fine matching process, where the rough matching corresponds to the rough matching but is not described in detail Places can be cross-referenced.
  • the comparison with the second target speckle image group is all the n fine matching template groups.
  • the fine matching template group has only one fine matching template, and the n fine matching template groups are n fine matching templates corresponding to the same reference speckle pattern.
  • the target speckle image is compared with the n fine matching templates one by one, and the fine matching template with the highest similarity to the target speckle pattern is obtained as the secondary matching template group.
  • the secondary matching template group There is only one matching template in the secondary matching template group.
  • the fine matching enables the matching algorithm used to be more accurate than the coarse More accurate when matching.
  • the similarity is calculated by a cross-correlation method with higher accuracy.
  • a cross-correlation operation is performed on the target speckle image and n fine matching templates one by one to obtain the fine matching template with the highest similarity to the target speckle pattern.
  • the algorithm corresponding to the cross-correlation operation may be ZNCC (Zero Mean Normalization cross correlation) or NCC (Normalization cross correlation), etc., which is not limited in the embodiment of the present application.
  • the reference speckle patterns respectively corresponding to the target speckle images in the second target speckle image group are the same as the reference speckle patterns respectively corresponding to the fine matching template group.
  • the second target speckle image group is the target speckle image group. In the embodiment of the present application, i is equal to k as an example for description.
  • each fine matching template group when the second target speckle image group is matched with the selected fine matching template group, each fine matching template group may be taken as a whole, and the second target speckle image group may be taken as a whole, and each The degree of similarity between the fine matching template group and the second target speckle image group; the fine matching template group with the highest similarity to the second target speckle image group is used as the secondary matching template group.
  • each fine matching template group can be regarded as a three-dimensional space, called a voxel.
  • the second target speckle image group can also be regarded as one voxel.
  • the characteristics of the fine matching template group on the spatial axis are more obvious, and the difference in depth can be more sensitively distinguished with small differences.
  • the second target speckle image group may be used as a voxel, and each fine matching template group may be used as a voxel, Through three-dimensional calculations, such as numerical operations, logical operations or cross-correlation methods, the highest similarity is matched.
  • voxels can also be split into two-dimensional matrices or one-dimensional sequences to simplify operations. For example, when calculating the similarity between the fine matching template group and the second target speckle image group by using a 3-dimensional cross-correlation formula, the calculation formula may be:
  • a in the formula represents the voxel formed by the fine matching template group, Is the average value of the voxel.
  • B represents the voxel formed by the second target speckle image group, Is the corresponding average value.
  • m, n, and s represent the length, width, and height of the voxel, respectively, and i, j, and k are the control variables for the length, width, and height of the voxel, respectively.
  • corr3 is the similarity coefficient of the voxel, and the value reflects the similarity between the two. It is understandable that each letter in the formula represents various meanings defined in this paragraph, and has nothing to do with the aforementioned i representing the number of matching templates, m, n representing the number of matching template groups, and so on.
  • each target speckle image in the target speckle image group can be matched with the fine matching template group for single template matching, and then the target is obtained according to the fine matching template with the highest similarity of each target speckle image.
  • the secondary matching template group with the highest pixel degree of the speckle image group can be matched with the fine matching template group for single template matching, and then the target is obtained according to the fine matching template with the highest similarity of each target speckle image.
  • the calculation method may be the same for each target speckle image in the second target speckle image group.
  • determine n fine matching templates corresponding to the target speckle image in the n fine matching template groups that is, determine n fine matching templates corresponding to the same reference speckle pattern of the target speckle image.
  • the similarity between the n fine matching templates and the target speckle image is calculated separately, and the fine matching template with the highest similarity to the target speckle image is obtained.
  • the similarity calculation method described in the single template fine matching can be used, that is, a similarity calculation method with higher accuracy than the single template rough matching is used.
  • Each target speckle image in the second target speckle image group corresponds to a fine matching template with the highest similarity, so that the i target speckle images corresponding to the i target speckle images in the second target speckle image group have the highest similarity
  • the fine matching template is determined to determine the secondary matching template group.
  • a fine matching template with the highest similarity of each target speckle image in the second target speckle image group may be calculated to obtain a matching template as the primary matching template group.
  • determining the secondary matching template group according to the i precision matching templates corresponding to i target speckle images in the second target speckle image group with the highest similarity may include: obtaining i highest similarity templates The similarity coefficients corresponding to the finely matched templates respectively obtain i similarity coefficients. Then, among the i similarity coefficients, the similarity coefficient representing the highest similarity is obtained, and the fine matching template corresponding to the similarity coefficient representing the highest similarity is used as the secondary matching template group. That is, the secondary matching template group is a fine matching template, and the similarity between the fine matching template and the corresponding target speckle image is greater than the similarity between other fine matching templates and the corresponding target speckle image.
  • the i similarity coefficients may be first subjected to a bitwise multiplication, addition, or mean operation, so as to better distinguish the similarity.
  • determining the secondary matching template group according to the i highest similarity fine matching templates corresponding to i target speckle images in the second target speckle image group may include: determining i highest similarity templates The depth information corresponding to the template is precisely matched to obtain i depth information. Then calculate the average value of the i depth information to obtain the average depth information. The fine matching template corresponding to the average depth information is used as the secondary matching template group. That is, the secondary matching template group is a fine matching template.
  • Step S240 Determine the depth information of the target speckle image according to the depth information of the secondary matching template group.
  • Each secondary template group corresponds to depth information, and the determined depth information of the secondary template group can be used as the depth information of the target speckle image.
  • k different reference speckle patterns are projected to the target object to form a target speckle image group.
  • the target speckle image group is matched through the rough matching template group, and the rough matching template group with the highest similarity is obtained, which is defined as the primary matching template group.
  • the fine matching template group in the preset range before and after the primary matching template group is selected to match the target speckle image group, and the target speckle image group is obtained.
  • the precise matching template group with the highest similarity of the spot image group is determined according to the fine matching template group, and accurate image depth information is obtained through a smaller calculation amount.
  • the target object may not be a flat object, as shown in the target object in FIG. 2, the distance from the projection unit is different at different positions, so the depth information of different regions in the target speckle image may be different.
  • the component regions of the target speckle image may be subjected to coarse matching and fine matching to obtain the depth information of each region, and combine to form the depth information of the target speckle image. That is, the target speckle image is divided into multiple regions, and the region at the same position in the target speckle image group is used as an independent matching unit, and coarse matching and fine matching are performed in the manner of the foregoing embodiment.
  • each target speckle image in the target speckle image group may be divided into multiple image regions according to the same region division method. Then, the image area at the same position in all target speckle images is taken as a sub-target speckle image group to obtain multiple sub-target speckle image groups.
  • the image area at the same position means that the pixel area of each image area in the corresponding target speckle image is the same.
  • the divided image area is a rectangle, and its upper left corner pixel coordinates are (x1, y1), and the lower right corner pixel coordinates are (x2, y2), then in other target speckle images
  • the image area at the same position of the image area is a rectangular area with the upper left corner pixel coordinates (x1, y1) and the lower right corner pixel coordinates (x2, y2).
  • all rough matching templates in all rough matching template groups are divided into multiple image regions according to the same division method as the target speckle image. That is, all rough matching templates and target speckle images can find regions with the same size and the same position in the image.
  • a rough matching template group the image area at the same position of each rough matching template is regarded as a sub rough matching template group.
  • All the fine matching templates of all fine matching template groups are divided into multiple image regions according to the same division method as the target speckle image. That is, all fine matching templates and target speckle images can find regions with the same size and the same position in the image.
  • a fine matching template group the image area at the same position of each fine matching template is used as a sperm matching template group.
  • each sub-target speckle image group is matched with the sub-rough matching template group and the sub-sperm matching template group at the same position in the image.
  • the matching process refers to the matching process of the target speckle image group in the foregoing embodiment.
  • the specific reference method can be understood as that for each sub-target speckle image group, the target speckle image group in the foregoing embodiment, and the sub-rough matching template group at the same position as the sub-target speckle image group in the foregoing embodiment are substituted into the coarse matching in the foregoing embodiment
  • the template group and the fine matching template group at the same position as the sub-target speckle image group are substituted into the fine matching template group in the foregoing embodiment for matching
  • the acquired depth information is the depth information of the image region corresponding to the sub-target speckle image group.
  • each sub-target speckle image group first obtain the sub-rough matching template group with the highest similarity of each sub-target speckle image group, and then obtain the sub-rough matching template group according to the sub-rough matching template group.
  • the sperm matching image group with the highest similarity of the target speckle image group can be:
  • the sperm matching template group within the preset range is matched with all or part of the sub-target speckle image group, and the sperm matching template group with the highest similarity is obtained as the secondary sub matching template group;
  • the depth information of the secondary sub-matching template group determines the depth information of the image region corresponding to the sub-target speckle image group.
  • the number of rough matching templates in each rough matching template group is defined as I, and the number of fine matching templates in each fine matching template group is i.
  • Matching the m sub-rough matching template groups with all or part of the sub-target speckle image group respectively, and obtaining the sub-rough matching template group with the highest similarity, as the primary sub-matching template group may include: using the sub-target speckle I image regions corresponding to the rough matching template group in the image group are used as the first sub-target speckle image group, and the m sub-coarse matching template groups are matched with the first sub-target speckle image group respectively, and the The sub-rough matching template group with the highest similarity of the first sub-speckle image group is used as the primary sub-matching template group.
  • the first-level sub-matching template group includes: taking i image regions corresponding to the fine-matching template group in the sub-target speckle image group as the second sub-target speckle image group, and selecting a preset range before and after the primary sub-matching template group.
  • the sperm matching template group within is respectively matched with the second sub-target speckle image group, and the sperm matching template group with the highest similarity to the second sub-target speckle image group is obtained as the secondary sub-matching template group.
  • the depth information of the secondary sub-matching template group is used as the depth information of the image region corresponding to the sub-target speckle image group.
  • all target speckle images are images formed by projecting the reference speckle pattern onto the same target object, theoretically all target speckle images have the same depth information, so the image area corresponding to the sub-target image group in any target speckle image can be obtained In-depth information. In the same way, the depth information of other image areas in any target speckle image can be obtained, so as to obtain the depth information of each area in the target speckle image.
  • the sub-rough matching template group with the highest similarity of each sub-target speckle image group may be obtained first, and the sub-rough matching templates with the highest similarity corresponding to each sub-target speckle image group can be combined into a rough Match template group. Then, according to the rough matching template groups in the rough matching template group, the sperm matching template group is selected, and the sperm matching image group with the highest similarity to each sub-target speckle image group is obtained.
  • the matching process can be:
  • the m sub-rough matching template groups are respectively matched with all or part of the sub-target speckle image group, and the sub-rough matching template group with the highest similarity is obtained as the primary sub-matching template group .
  • each sub-target speckle image group determines the primary sub-matching template group corresponding to the same position, select the sub-prime sub-matching template group within a preset range before and after the primary sub-matching template group, respectively, and the sub-target speckle image group Match all or part of the sub-sperm matching template group with the highest similarity as the secondary sub-matching template group; determine the image area corresponding to the sub-target speckle image group according to the depth information of the secondary sub-matching template group In-depth information.
  • the depth information of the target object can also be determined according to the position of the target object in the target speckle image.
  • the matching result may be inaccurate, so it needs to be corrected.
  • the secondary sub-matching template group whose similarity is higher than the preset similarity is taken as the effective secondary sub-matching template group, and the depth information of the corresponding image area is calculated; for the secondary sub-matching template whose similarity is not greater than the preset similarity
  • the matching template group is regarded as an invalid secondary sub-matching template group for correction.
  • the depth information of the sub-matching template group is used as the The depth information of the image area corresponding to the sub-target speckle image group; if the similarity between the sub-sperm matching template group and the corresponding secondary sub-matching template group is less than or equal to the preset similarity ⁇ 1, it is considered that the depth result is not accurate enough, Temporarily use the depth information of the sub-matching template group as the depth information of the image area corresponding to the sub-target speckle image group, but further classification and estimation are required to determine whether to correct the depth information of the image area.
  • the image area is named the target image area.
  • the specific classification and estimation method can be, if there are image areas with similarity greater than ⁇ 1 in the 8 neighborhoods of the target image area, the depth information of the image areas with similarity greater than ⁇ 1 is averaged as the depth information of the target image area ; If there is no image area with similarity greater than ⁇ 1 in the 8 neighborhood, the depth information of the target image area is not modified.
  • the depth value correction method can be used, such as common image processing methods such as mean filtering and median filtering. It is understandable that the 8 neighborhoods may be 8 image areas adjacent to the target image area. Of course, the embodiment of the present application is not limited to 8 neighborhoods, and other numbers of neighborhoods may also be used.
  • Each image in the dashed frame 104 in FIG. 9 represents k target speckle images in the target speckle image group.
  • the area of the target speckle image is divided as shown by the squares in the dashed frame 104 in FIG. 9.
  • the position intervals of the image area in the image are A1, A2, A3 to A24, as shown in Fig. 10.
  • Fig. 10 shows an example of an area division method including a matching template and a target speckle image.
  • the image area at A1 of k target speckle images forms a sub-target speckle image group A1
  • the image area at A2 of k target speckle images forms a sub-target speckle image group A2, until the number of k target speckle images
  • the image area at A24 forms a sub-target speckle image group A24.
  • the sub-target speckle image group A6 formed by the image area A6 of the k target speckle images is shown at the corresponding dotted frame 104 in FIG. 9.
  • each image in the coordinate system of FIG. 9 represents each matching template, and the matching template corresponding to the same coordinate point on the space axis S is a group matching template.
  • each matching template is divided into 24 locations of A1, A2, A3 to A24 according to the same area division method as the target speckle image. Image area.
  • the image area at A1 forms a sub-rough matching template group A1
  • the image area at A2 forms a sub-rough matching template group A2
  • the image area at A24 forms a sub-rough matching template group A24.
  • each fine matching template group the image area at A1 forms a sperm matching template group A1
  • the image area at A2 forms a sperm matching template group A2
  • the image area at A24 forms a sperm matching template group A24.
  • the voxel corresponding to each spatial axis coordinate point in FIG. 9 represents the sub-matching template group formed by the image area at A6 from T1 to Tk.
  • the rough matching template group matched with it is the sub rough matching template group at the same position in the image
  • the fine matching template group matched with it is the fine matching template group at the same position in the image.
  • all sub-coarse matching template groups A6 are matched with the sub-target speckle image group A6, and the primary sub-matching template group closest to the sub-target speckle image group A6 is obtained.
  • the sub-target speckle image group A6 is matched with the sperm matching template group A6 in the preset range before and after the primary sub matching template group, and the sperm matching template group A6 with the highest similarity is obtained as the secondary sub matching template group.
  • the depth information of the secondary sub-matching template group is used as the depth information of the sub-target speckle image group A6.
  • the specific matching process refer to the matching process of the target speckle image group in the foregoing embodiment.
  • the sub-target speckle image group A6, the sub-rough matching template group A6, and the sub-target speckle image group A6 are all used to describe the location of each image area as A1.
  • the depth information of the image area at other areas in the target speckle image can be obtained, thereby obtaining the depth information of the target speckle image.
  • the depth information of the image area in each target speckle image can be corrected.
  • the depth information of the secondary sub-matching template group is used as the depth information of the image area at A6 in the target speckle image; if the similarity between the sub-target speckle image group A6 and the secondary sub-matching template group with the highest similarity is not greater than ⁇ 1, it is judged that the image area of its 8 neighborhood corresponds to Whether the similarity of is greater than ⁇ 1, that is, determine whether the similarity between the sub-target speckle image group and its corresponding secondary fine matching template group is greater than ⁇ 1 at A1 to A3, A5, A7, and A9-A11, that is, determine the sub-target Whether the similarity between the speckle image group A1 and the corresponding secondary fine matching template group is greater than ⁇ 1 at A1 to A3, A5, A7, and A9-A11, that is, determine the sub-target Whether the similarity between the speckle image group A1 and the corresponding secondary fine matching template group is greater than
  • the target speckle image group is subjected to regional matching. Since the depth information of each target speckle image is the same, any target speckle image in any target speckle image group is used to represent the depth information. Image to obtain the depth information of each image area in the target speckle image. For the target object in the target speckle image, the depth information at each different position can be determined more accurately, so that the depth information detection method can be applied to planar or non-planar target objects for depth information detection.
  • the device 400 includes: an image acquisition module 410, configured to acquire a target speckle image group formed by projecting k different reference speckle patterns to a target object; a coarse matching module 420, configured to combine m coarse speckle patterns
  • the matching template group is matched with all or part of the target speckle image group, and the rough matching template group with the highest similarity is obtained as the primary matching template group, wherein each matching template group corresponds to its own depth information, and every two The interval between adjacent rough matching template groups is R, every two adjacent rough matching template groups includes a fine matching template group, and the interval between every two adjacent fine matching template groups is r, R is greater than r, and the same rough
  • the matching template group or the same fine matching template group is formed by all or part of the k different reference speckle patterns projected to the same position of the reference screen; the fine matching module 430 is used to select the primary matching template group
  • the fine matching template groups within the preset range before and after are respectively matched with
  • the number of coarse matching templates in each coarse matching template group is defined as I, and the number of fine matching templates in each fine matching template group is i.
  • the rough matching module 420 may be configured to use 1 target speckle images corresponding to the rough matching template group in the target speckle image group as the first target speckle image group, and combine the m rough matching template groups with the The first target speckle image group is matched, and the rough matching template group with the highest similarity to the first target speckle image group is obtained as the primary matching template group.
  • the fine matching module 430 may be configured to: use i target speckle images corresponding to the fine matching template group in the target speckle image group as the second target speckle image group, and select the primary matching template group before and after the preset range
  • the fine matching template group of is respectively matched with the second target speckle image group, and the fine matching template group with the highest similarity to the second target speckle image group is obtained as a secondary matching template group.
  • I is greater than 1 and i is equal to 1, or I is greater than 1, and i is greater than 1, or I is equal to 1, and i is greater than 1.
  • the rough matching module 420 may be configured to take each rough matching template group as a whole, and the first target speckle image group as a whole, and calculate each rough matching template group and the first target speckle image group.
  • the similarity between a target speckle image group; the rough matching template group with the highest similarity to the first target speckle image group is used as the primary matching template group.
  • the coarse matching module 420 may be configured to determine, for each target speckle image in the first target speckle image group, that the m coarse matching template groups correspond to the target speckle M coarse matching templates of the image; respectively calculating the similarity between the m coarse matching templates and the target speckle image to obtain the coarse matching template with the highest similarity to the target speckle image; according to the first target speckle image One rough matching template with the highest similarity corresponding to one target speckle image in the group determines the primary matching template group.
  • the fine matching module 430 may be configured to take each selected fine matching template group as a whole, and the second target speckle image group as a whole, and calculate each fine matching template group and all The similarity between the first target speckle image group; the fine matching template group with the highest similarity to the first target speckle image group is used as the secondary matching template group.
  • the fine matching module 430 may be configured to determine, for each target speckle image in the second target speckle image group, that the n fine matching template groups correspond to the target speckle N fine matching templates of the image; respectively calculating the similarity between the n fine matching templates and the target speckle image to obtain the fine matching template with the highest similarity to the target speckle image; according to the second target speckle image
  • the i precision matching templates with the highest similarity corresponding to i target speckle images in the group determine the secondary matching template group.
  • the coupling between the modules may be electrical, mechanical or other forms of coupling.
  • each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module.
  • the above-mentioned integrated modules can be implemented in the form of hardware or software functional modules.
  • FIG. 12 shows a structural block diagram of an electronic device 600 according to an embodiment of the present application.
  • the electronic device 600 may be an electronic device capable of in-depth information recognition, such as a mobile phone, a tablet computer, or an e-book.
  • the electronic device includes a processor 610 and a memory 620, the memory is coupled to the processor, and the memory stores instructions. When the instructions are executed by the processor, the processor executes one or more of the above The method described in the embodiment.
  • the processor 610 may include one or more processing cores.
  • the processor 610 uses various interfaces and lines to connect various parts of the entire electronic device 600, and executes by running or executing instructions, programs, code sets, or instruction sets stored in the memory 620, and calling data stored in the memory 620.
  • the processor 610 may use at least one of digital signal processing (Digital Signal Processing, DSP), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA), and Programmable Logic Array (Programmable Logic Array, PLA).
  • DSP Digital Signal Processing
  • FPGA Field-Programmable Gate Array
  • PLA Programmable Logic Array
  • the processor 610 may be integrated with one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), a modem, and the like.
  • the CPU mainly processes the operating system, user interface, and application programs;
  • the GPU is used for rendering and drawing of display content;
  • the modem is used for processing wireless communication. It can be understood that the above-mentioned modem may not be integrated into the processor 610, but may be implemented by a communication chip alone.
  • the memory 620 may include random access memory (RAM) or read-only memory (Read-Only Memory).
  • the memory 620 may be used to store instructions, programs, codes, code sets or instruction sets, such as instructions or code sets used to implement the deep information detection method provided in the embodiments of the present application.
  • the memory 620 may include a storage program area and a storage data area, where the storage program area may store instructions for implementing an operating system, instructions for implementing at least one function, instructions for implementing each of the foregoing method embodiments, and the like.
  • the storage data area can also be data created by the electronic device in use (such as phone book, audio and video data, chat record data), etc.
  • the electronic device may further include a projection unit for projecting the reference speckle pattern; and an image acquisition unit for acquiring an image projected by the projection unit.
  • FIG. 13 shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application.
  • the computer-readable storage medium 700 stores program codes, and the program codes can be invoked by a processor to execute the methods described in the foregoing method embodiments.
  • the computer-readable storage medium 700 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM.
  • the computer-readable storage medium 700 includes a non-transitory computer-readable storage medium.
  • the computer-readable storage medium 700 has a storage space for the program code 710 for executing any method steps in the above methods. These program codes can be read out from or written into one or more computer program products.
  • the program code 710 may be compressed in a suitable form, for example.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Image Analysis (AREA)
  • Length Measuring Devices By Optical Means (AREA)

Abstract

A depth information detection method, an apparatus and an electronic device, related to the technical field of image processing. Wherein, the method comprising: obtaining a target speckle image group formed by projecting a k number of different reference speckle patterns onto a target object (S110); taking an m number of coarse matching template groups and respectively matching same to all of or to a portion of the target speckle image group, obtaining a coarse matching template group having the highest degree of similarity, and using same as a primary matching template group (S120); selecting precise matching template groups from a preset front/back range of the primary matching template group, and respectively matching same to all of or to a portion of the target speckle image group, obtaining a precise matching template group having the highest degree of similarity, and using same as a secondary matching template group (S130); in accordance with depth information of the secondary matching template group, determining depth information for a target speckle image (S140).

Description

深度信息检测方法、装置及电子设备In-depth information detection method, device and electronic equipment
本申请要求于2019年4月1日提交的申请号为CN201910258089.4的中国专利申请的优先权,在此通过引用将其全部内容并入本文。This application claims the priority of the Chinese patent application with the application number CN201910258089.4 filed on April 1, 2019, the entire content of which is hereby incorporated by reference.
技术领域Technical field
本申请涉及图像处理技术领域,更具体地,涉及一种深度信息检测方法、装置及电子设备。This application relates to the field of image processing technology, and more specifically, to a depth information detection method, device, and electronic equipment.
背景技术Background technique
随着科技的发展,在某些图像显示场景中,二维图像已经不能满足人们的需要。而三维立体图像因比二维图像多了深度信息而更加真实且准确,在日常生活中,对三维场景的使用愈加普遍,例如人脸支付、体感游戏、AR购物等。With the development of science and technology, in some image display scenes, two-dimensional images can no longer meet people's needs. 3D images are more real and accurate because they have more depth information than 2D images. In daily life, the use of 3D scenes is more and more common, such as face payment, motion sensing games, AR shopping, etc.
在三维场景下,需要获取图像的深度信息,而现有的获取图像的深度信息的方式计算量大,计算耗时。In a three-dimensional scene, it is necessary to obtain the depth information of the image, but the existing method of obtaining the depth information of the image is computationally intensive and time-consuming.
发明内容Summary of the invention
鉴于上述问题,本申请提出了一种深度信息检测方法、装置及电子设备,以改善上述问题。In view of the above problems, this application proposes a depth information detection method, device and electronic equipment to improve the above problems.
第一方面,本申请实施例提供了一种深度信息检测方法,所述方法包括:获取将k个不同的基准散斑图案投射到目标物体形成的目标散斑图像组;将m个粗匹配模板组分别与所述目标散斑图像组的全部或者部分匹配,获取相似度最高的粗匹配模板组,作为初级匹配模板组,其中,每个匹配模板组对应各自的深度信息,每两个相邻的粗匹配模板组间隔为R,每两个相邻的粗匹配模板组之间包括精匹配模板组,每两个相邻的精匹配模板组间隔为r,R大于r,同一个粗匹配模板组或同一个精匹配模版组均由所述k个不同的基准散斑图案的全部或者部分分别投射到同一位置的参考幕形成;选取所述初级匹配模板组前后预设范围内的精匹配模板组,分别与所述目标散斑图像组中的全部或者部分匹配,获取相似度最高的精匹配模板组,作为次级匹配模板组;根据所述次级匹配模板组的深度信息确定目标散斑图像的深度信息。In a first aspect, an embodiment of the present application provides a depth information detection method, the method includes: obtaining a target speckle image group formed by projecting k different reference speckle patterns to a target object; and matching m coarse matching templates The group is matched with all or part of the target speckle image group, and the rough matching template group with the highest similarity is obtained as the primary matching template group. Each matching template group corresponds to its own depth information, and every two adjacent ones The interval of the rough matching template group is R, every two adjacent rough matching template groups include a fine matching template group, and the interval between every two adjacent fine matching template groups is r, R is greater than r, the same rough matching template The group or the same fine matching template group is formed by all or part of the k different reference speckle patterns respectively projected to the reference screen at the same position; the fine matching templates within the preset range before and after the primary matching template group are selected Groups, respectively matching all or part of the target speckle image group, obtaining the fine matching template group with the highest similarity as the secondary matching template group; determining the target speckle according to the depth information of the secondary matching template group The depth information of the image.
第二方面,本申请实施例提供了一种深度信息检测装置,所述装置包括:图像获取模块,用于获取将k个不同的基准散斑图案投射到目标物体形成的目标散斑图像组;粗匹配模块,用于将m个粗匹配模板组分别与所述目标散斑图像组的全部或者部分匹配,获取相似度最高的粗匹配模板组,作为初级匹配模板组,其中,每个匹配模板组对应各自的深度信息,每两个相邻的粗匹配模板组间隔为R,每两个相邻的粗匹配模板组之间包括精匹配模板组,每两个相邻的精匹配模板组间隔为r,R大于r,同一个粗匹配模板组或同一个精匹配模版组均由所述k个不同的基准散斑图案的全部或者部分分别投射到同一位置的参考幕形成;精匹配模块,用于选取所述初级匹配模板组前后预设范围内的精匹配模板组,分别与所述目标散斑图像组中的全部或者部分匹配,获取相似度最高的精匹配模板组,作为次级匹配模板组;深度信息确定模块,用于根据所述次级匹配模板组的深度信息确定目标散斑图像的深度信息。In a second aspect, an embodiment of the present application provides a depth information detection device, the device includes: an image acquisition module configured to acquire a target speckle image group formed by projecting k different reference speckle patterns to a target object; The rough matching module is used to match the m rough matching template groups with all or part of the target speckle image group respectively, and obtain the rough matching template group with the highest similarity as the primary matching template group, where each matching template The groups correspond to their respective depth information. The interval between every two adjacent rough matching template groups is R, every two adjacent rough matching template groups includes a fine matching template group, and every two adjacent fine matching template groups are separated Is r, R is greater than r, the same rough matching template group or the same fine matching template group is formed by all or part of the k different reference speckle patterns projected to the same position of the reference screen; the fine matching module, Used to select the fine matching template group within the preset range before and after the primary matching template group, respectively match all or part of the target speckle image group, and obtain the fine matching template group with the highest similarity as the secondary matching Template group; a depth information determination module for determining the depth information of the target speckle image according to the depth information of the secondary matching template group.
第三方面,本申请实施例提供了一种电子设备,包括存储器以及处理器,所述存储器耦接到所述处理器,所述存储器存储指令,当所述指令由所述处理器执行时,所述处理器执行上述的方法。In a third aspect, an embodiment of the present application provides an electronic device, including a memory and a processor, the memory is coupled to the processor, and the memory stores instructions. When the instructions are executed by the processor, The processor executes the above-mentioned method.
附图说明Description of the drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly describe the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed in the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
图1示出了本申请实施例提供的匹配模板获取系统的结构示意图。Fig. 1 shows a schematic structural diagram of a matching template obtaining system provided by an embodiment of the present application.
图2至图4示出了匹配模板获取中投影的不同示意图。Figures 2 to 4 show different schematic diagrams of projections in the matching template acquisition.
图5示出了本申请实施例提供的散斑移动示意图。FIG. 5 shows a schematic diagram of speckle movement provided by an embodiment of the present application.
图6示出了本申请一实施例提供的深度信息检测方法的流程图。Fig. 6 shows a flowchart of a depth information detection method provided by an embodiment of the present application.
图7示出了本申请另一实施例提供的深度信息检测方法的流程图。Fig. 7 shows a flowchart of a depth information detection method provided by another embodiment of the present application.
图8示出了本申请实施例提供的匹配模板的一种示意图。FIG. 8 shows a schematic diagram of a matching template provided by an embodiment of the present application.
图9示出了本申请实施例提供的匹配模板与目标散斑图像区域划分的一种示意图。FIG. 9 shows a schematic diagram of the matching template and the target speckle image area division provided by an embodiment of the present application.
图10示出了本申请实施例提供的一种具体的区域划分方式示意图。FIG. 10 shows a schematic diagram of a specific area division method provided by an embodiment of the present application.
图11示出了本申请实施例提供的深度信息检测装置的功能模块图。Fig. 11 shows a functional block diagram of a depth information detection device provided by an embodiment of the present application.
图12示出了本申请实施例提供的电子设备的结构框图。Fig. 12 shows a structural block diagram of an electronic device provided by an embodiment of the present application.
图13是本申请实施例的用于保存或者携带实现根据本申请实施例的深度信息检测方法的程序代码的存储介质。Fig. 13 is a storage medium for storing or carrying program codes for implementing the depth information detection method according to the embodiment of the present application.
具体实施方式detailed description
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。In order to enable those skilled in the art to better understand the solutions of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
在人脸支付、体感游戏以及AR购物等各种领域,都需要获取图像的深度信息。例如,在人脸支付领域,需要获取人脸图像中人脸的深度信息,以精确匹配进行支付验证的人脸是否为注册的人脸。In various fields such as face payment, somatosensory games, and AR shopping, it is necessary to obtain the depth information of the image. For example, in the field of face payment, it is necessary to obtain the depth information of the face in the face image to accurately match whether the face for payment verification is a registered face.
单目散斑测量法可以作为一种获取图像深度信息的方法。通常的,单目散斑测量法可以分为时间相关和空间相关。时间相关一般指在已知纵深的空间上移动等距的参考幕,发射器向参考幕投射带有散斑形态的图案,采集器记录这些位置的散斑形态,从而记录到对应已知纵深的空间上移动等距的参考幕在各个位置的散斑形态。利用散斑在空间每个位置形态不一样的特性,当目标对象(如人脸支付中的人脸)放置于此维度中,与在这组时间序列上各个位置上不同形态的散斑进行相似度匹配,即可搜索出目标对象的深度信息。空间相关一般指只使用一幅参考幕散斑图和向目标物体投射带有散斑形态后的散斑图,仅这两幅图像作相似度匹配,对比出目标对象相对参考幕散斑图在每个坐标位置的偏移量,再借助外部的几何三角关系而得到目标对象的深度图,获得目标对象的深度信息。Monocular speckle measurement can be used as a method to obtain image depth information. Generally, monocular speckle measurement can be divided into time correlation and space correlation. Time correlation generally refers to moving an equidistant reference screen in a space with a known depth. The transmitter projects a pattern with speckle patterns on the reference screen, and the collector records the speckle patterns at these positions, thereby recording the corresponding known depth. The speckle pattern of the equidistant reference screen in each position is moved in space. Taking advantage of the different shape of speckles at each position in space, when the target object (such as the face in face payment) is placed in this dimension, it is similar to speckles of different shapes at each position in this set of time series The degree of matching can search for the depth information of the target object. Spatial correlation generally refers to only using a reference screen speckle image and projecting a speckle image with a speckle shape to the target object. Only the two images are matched for similarity to compare the target object relative to the reference screen speckle image. The offset of each coordinate position is used to obtain the depth map of the target object with the help of the external geometric triangle relationship, and obtain the depth information of the target object.
上述的方法中,时间相关方法由于需要加载所有的散斑图像,与所有的散斑图像进行匹配,加之各种复杂形式的互相关匹配函数,导致计算非常耗时,不适合快速的测量方式,如在人脸支付场景中要求的快速匹配的需求。而空间相关方法只用两幅图像,需要计算每个坐标位置的偏移量,计算耗时。并且,计算时仅使用小尺寸的窗口会带来大量误匹配,而使用大窗口又会导致空间分辨率下降,当测量对象表面复杂时,精度则更低。Among the above methods, the time correlation method needs to load all speckle images and match them with all speckle images, and in addition to various complex forms of cross-correlation matching functions, the calculation is very time-consuming and not suitable for fast measurement methods. Such as the requirement of fast matching required in face payment scenarios. The spatial correlation method only uses two images, and needs to calculate the offset of each coordinate position, which is time-consuming. In addition, using only a small window in the calculation will bring about a large number of mismatches, while using a large window will result in a decrease in spatial resolution. When the surface of the measurement object is complex, the accuracy will be lower.
因此,本申请实施例提出了一种深度信息检测方法,以增加基准模板组的方式,先通过粗匹配找出目标物体大概的深度信息,再进行精匹配,通过部分的精匹配图像与目标散斑图像匹配,在较小的计算量的方式下,获得目标物体的准确的深度信息。Therefore, an embodiment of the present application proposes a depth information detection method. By increasing the reference template group, the approximate depth information of the target object is found through coarse matching, and then the fine matching is performed. The partial fine matching image is scattered with the target. Spot image matching can obtain accurate depth information of the target object with a small amount of calculation.
图1示出了一种匹配模板获取系统,用于获取深度信息检测所使用的匹配模板。如图1所示,该匹配模板获取系统包括投影单元、图像采集单元以及存储单元。Figure 1 shows a matching template acquisition system for acquiring a matching template used for depth information detection. As shown in Figure 1, the matching template acquisition system includes a projection unit, an image acquisition unit and a storage unit.
其中,投影单元可以包括光源、准直镜头和衍射光学元件等器件,用于投射图案。该投影单元可以用于投射一种图案,也可以用于投射密度和/或形状不完全相同的多种图案。Among them, the projection unit may include a light source, a collimating lens, a diffractive optical element and other devices for projecting patterns. The projection unit can be used to project one pattern, and can also be used to project multiple patterns with different densities and/or shapes.
可选的,该投影单元可以是可见光投影仪。可选的,该投影单元可以是红外激光模组,其光源可以是VCSEL阵列激光,用于投射红外的图案。当投影单元的光源为VCSEL阵列激光时,可以通过可连续投影变化的密度和/或形状的VCSEL阵列激光用于投射不同的图案;也可以通过多个VCSEL阵列激光组合,用于发射出不同密度和/或形状的图案;或者可以通过多片衍射光学元件改变相对位置,用于发射不同的图案。Optionally, the projection unit may be a visible light projector. Optionally, the projection unit may be an infrared laser module, and its light source may be a VCSEL array laser for projecting infrared patterns. When the light source of the projection unit is a VCSEL array laser, the VCSEL array laser with variable density and/or shape can be continuously projected to project different patterns; it can also be combined with multiple VCSEL array lasers to emit different densities And/or the shape of the pattern; or the relative position can be changed by multiple diffractive optical elements for emitting different patterns.
投影单元投射的图案的具体形状和密度在本申请实施例中并不限定,以同一图案投射到离投影单元不同距离时,可以实现成像不同为宜。例如,散斑的特性是散乱的圆斑点,满足匹配需要的无规律的杂乱信息,同一散斑图案从投影单元进行投射时,在离投影单元不同距离处成像不同,从而在不同位置都能获得独一无二的散斑图像,因此,本申请实施例中,投影单元可以用于投射散斑图案,以散斑图案为例进行说明。投影单元的具体光源在本申请实施例中并不限定,通过相应的图像采集单元可以采集到光源投射出的散斑图案即可,如通过红外图像采集设备采集红外光源投射的散斑图像,通过可见光图像采集设备采集可见光光源投射的散斑图像等。The specific shape and density of the pattern projected by the projection unit are not limited in the embodiments of the present application. When the same pattern is projected to different distances from the projection unit, different imaging can be achieved. For example, the characteristic of speckle is scattered round spots, which meets the irregular messy information required for matching. When the same speckle pattern is projected from the projection unit, the image is different at different distances from the projection unit, so that it can be obtained at different positions A unique speckle image. Therefore, in the embodiment of the present application, the projection unit can be used to project the speckle pattern, and the speckle pattern is taken as an example for description. The specific light source of the projection unit is not limited in the embodiments of the present application. The speckle pattern projected by the light source can be collected by the corresponding image acquisition unit. For example, the speckle image projected by the infrared light source is collected by the infrared image acquisition device. The visible light image acquisition device collects speckle images projected by the visible light source, etc.
图像采集单元与投影单元保持一定的基线距离,可以是记录投影单元所发射图案波长的图像传感器,用于采集投影单元投射的散斑图案的图像,可以包括感光元件、滤光片和镜头等。该图像采集单元可以是对应光源类型的图像传感器,如投影单元的光源为红外光,图像采集单元为红外光图像采集设备;若光源为可见光,图像采集单元为可见光图像采集设备等。图像采集单元与投影单元之间的位置关系在本申请实施例中并不限定,例如,投影单元水平放置、水平投影,图像采集单元与投影单元放置于同一水平高度。The image acquisition unit maintains a certain baseline distance from the projection unit. It can be an image sensor that records the wavelength of the pattern emitted by the projection unit. It is used to collect the image of the speckle pattern projected by the projection unit. It can include photosensitive elements, filters, and lenses. The image acquisition unit may be an image sensor corresponding to the type of light source. For example, the light source of the projection unit is infrared light, and the image acquisition unit is an infrared light image acquisition device; if the light source is visible light, the image acquisition unit is a visible light image acquisition device. The positional relationship between the image acquisition unit and the projection unit is not limited in the embodiment of the present application. For example, the projection unit is placed horizontally and projected horizontally, and the image acquisition unit and the projection unit are placed at the same level.
存储单元与图像采集单元连接,用于存储图像采集单元获取的散斑图案,作为匹配模板,该存储单元可以是FLASH、ROM或者硬盘的任意一种。The storage unit is connected to the image acquisition unit, and is used to store the speckle pattern acquired by the image acquisition unit as a matching template. The storage unit can be any of FLASH, ROM or hard disk.
本申请实施例中,匹配模板获取系统还可以包括处理单元,与图像采集单元、投影单元以及存储单元电连接。该处理单元的平台可以为ASIC、FPGA和DSP的一种,用于对采集的图像进行处理,也可以用于控制投影单元的投影以及图像采集单元的图像采集。可选的,该处理单元可以包括控制器用于进行控制,如通过同步时序电路和异步时序电路进行控制;也可以包括深度处理器,用于进行深度信息获取的处理。In the embodiment of the present application, the matching template acquisition system may further include a processing unit, which is electrically connected to the image acquisition unit, the projection unit, and the storage unit. The platform of the processing unit can be one of ASIC, FPGA and DSP, which is used to process the collected images, and can also be used to control the projection of the projection unit and the image collection of the image acquisition unit. Optionally, the processing unit may include a controller for performing control, such as control by a synchronous sequential circuit and an asynchronous sequential circuit; and may also include a depth processor for performing depth information acquisition processing.
该系统中各个单元之间可以是相互彼此独立的,也可以是集成在一起的。例如,该系统可以是手机、平板电脑以及笔记本电脑等集成了投影单元、图像采集单元、存储单元以及处理单元的电子设备。The units in the system can be independent of each other or integrated. For example, the system may be an electronic device that integrates a projection unit, an image acquisition unit, a storage unit, and a processing unit, such as a mobile phone, a tablet computer, and a notebook computer.
通过该匹配模板获取系统可以获取用于图像深度信息检测的匹配模板。在获取匹配模板时,如图2所示,可以在投影单元的投影方向上(如图2中箭头所示),放置一参考幕,参考幕放置于投影单元的深度轴,并使参考幕与投影单元之间的距离变化,如依次变大或者依次变小。图像采集单元获取参考幕与投影单元之间不同距离的时候,投影单元投射的散斑图案在参考幕的成像。其中,参考幕为用于承载散斑图案的投影平面,投影单元投出的图像可以在参考幕成像,图像采集单元通过对参考幕进行图像采集,可以获取到投影单元投射的图案在参考幕所成图像,该图像可以用作匹配模板。可以理解的,图2仅为示例性说明,并没有画出在所有位置的参考幕。The matching template obtaining system can obtain the matching template for image depth information detection. When obtaining the matching template, as shown in Figure 2, a reference screen can be placed in the projection direction of the projection unit (as shown by the arrow in Figure 2). The reference screen is placed on the depth axis of the projection unit, and the reference screen and The distance between the projection units changes, such as increasing or decreasing sequentially. When the image acquisition unit acquires different distances between the reference screen and the projection unit, the speckle pattern projected by the projection unit is imaged on the reference screen. Among them, the reference screen is the projection plane used to carry the speckle pattern, the image projected by the projection unit can be imaged on the reference screen, and the image acquisition unit can acquire the pattern projected by the projection unit on the reference screen by collecting images on the reference screen. Into an image, which can be used as a matching template. It can be understood that FIG. 2 is only an exemplary illustration, and the reference screen at all positions is not drawn.
例如图3所示,R11、R12至Rpb分别为在投影方向上等距排布的位置点,R11、R12至Rpb每两个相邻的位置点之间间距为r。R11、R21、R31以此类推至Rp1,该p个位置点中,每两个相邻的位置点之间间距为R。参考幕在R11、R12至Rpb分别对应的各个位置时,投影单元投射的散斑图像在每个位置点的参考幕成像,图像采集单元采集每个位置点处散斑图像在参考幕上的成像。如,参考幕在位置点R11时,图像采集单元采集投影单元投影到参考幕上的图像;参考幕在R12时,图像采集单元采集投影单元投影到参考幕上的图像;直至参考幕在位置点Rpb时,图像采集单元采集投影单元投影到参考幕上的图像。定义在每个位置点采集的散斑图案投射到参考幕的图像为散斑图像,从而获得一系列等间距的散斑图像,散斑图像之间的间距表示该散斑图像成像的参考幕之间的间距。如在R11处的参考幕上所成的散斑图像,与在R12处的参考幕上所成的散斑图像之间的间距,为R11位置点与R12位置点之间的距离。For example, as shown in FIG. 3, R11, R12 to Rpb are respectively equidistantly arranged position points in the projection direction, and the distance between every two adjacent position points of R11, R12 to Rpb is r. R11, R21, R31 and so on are deduced to Rp1, among the p position points, the distance between every two adjacent position points is R. When the reference screen is at each position corresponding to R11, R12 to Rpb, the speckle image projected by the projection unit is imaged on the reference screen at each position, and the image acquisition unit collects the imaging of the speckle image at each position on the reference screen . For example, when the reference screen is at the position point R11, the image acquisition unit collects the image projected on the reference screen by the projection unit; when the reference screen is at R12, the image acquisition unit collects the image projected on the reference screen by the projection unit; until the reference screen is at the position point In Rpb, the image acquisition unit collects the image projected on the reference screen by the projection unit. It is defined that the image projected to the reference screen by the speckle pattern collected at each position is a speckle image, so as to obtain a series of equidistant speckle images, and the distance between the speckle images represents the reference screen imaged by the speckle image. The spacing between. For example, the distance between the speckle image formed on the reference screen at R11 and the speckle image formed on the reference screen at R12 is the distance between the R11 position point and the R12 position point.
作为一种实施方式,若参考幕与投影单元之间的距离较小,如小于某一最小预设阈值,则使参考幕与投影单元之间距离依次变大,并在距离变大过程中采集图像。As an implementation manner, if the distance between the reference screen and the projection unit is small, such as less than a certain minimum preset threshold, the distance between the reference screen and the projection unit is increased sequentially, and the collection is performed as the distance increases. image.
在该实施方式中,使投影单元与参考幕之间距离依次变大的方式可以是,将参考幕在投影方向上,依次向远离投影单元的方向移动,形成一系列等距的参考幕,获取每个位置处散斑图案在参考幕的成像,获得一系列等间距的图像。如在图3所示的场景下,将参考幕从R11移动到R12直至移动到Rpb,投影单元投射的散斑图像在每个位置点的参考幕成像,图像采集单元采集每个位置点处散斑图像在参考幕上的成像,获得b*p个等间距的散斑图像。In this embodiment, the way to increase the distance between the projection unit and the reference screen in sequence may be to move the reference screen in the projection direction and move away from the projection unit to form a series of equidistant reference screens. The speckle pattern at each position is imaged on the reference screen to obtain a series of equally spaced images. For example, in the scene shown in Figure 3, the reference screen is moved from R11 to R12 to Rpb, the speckle image projected by the projection unit is imaged on the reference screen at each position, and the image acquisition unit collects scatter at each position. The speckle image is imaged on the reference screen to obtain b*p equidistant speckle images.
在该实施方式中,使投影单元与参考幕之间距离依次变大的方式也可以是,将投影单元在投影方向上,依次向远离参考幕的方向等间距移动,形成一系列等距的参考幕,获取每个位置处参考幕在参考幕的成像,获得一系列等间距的图像。如投影单元以及图像采集单元与参考幕之间的放置如图4所示,将投影单元以及图像采集单元同时从如图4所示的R11处移动到R12、R13直至移动到Rpb,投影单元在每个位置点投射的散斑图像在参考幕成像,图像采集单元采集投影单元在每个位置点处投射的散斑图像在参考幕上的成像,b*p个间距为r的散斑图像。In this embodiment, the way to increase the distance between the projection unit and the reference screen in sequence may also be to move the projection unit in the projection direction to the direction away from the reference screen at equal intervals to form a series of equidistant reference screens. Screen, obtain the imaging of the reference screen on the reference screen at each position, and obtain a series of equally spaced images. For example, the placement of the projection unit and the image acquisition unit and the reference screen is shown in Figure 4. Move the projection unit and the image acquisition unit from R11 to R12, R13 and Rpb at the same time as shown in Figure 4. The projection unit is in The speckle image projected at each position point is imaged on the reference screen, and the image acquisition unit collects the imaging of the speckle image projected by the projection unit at each position point on the reference screen, b*p speckle images with a spacing of r.
作为一种实施方式,若参考幕与投影单元之间的距离较大,如大于某一最大预设阈值,则使参考幕与投影单元之间距离依次变小,并在距离变小过程中采集图像。As an implementation manner, if the distance between the reference screen and the projection unit is large, such as greater than a certain maximum preset threshold, the distance between the reference screen and the projection unit is sequentially reduced, and the collection is performed as the distance decreases. image.
在该实施方式中,使投影单元与参考幕之间距离依次变小的方式可以是,将参考幕依次向投影单元移动,形成一系列等距的参考幕。例如图3所示的场景下,将参考幕从Rpb移动到Rp(b-1)直至移动到R11,投影单元投射的散斑图像在每个位置点的参考幕成像,图像采集单元采集每个位置点处参考幕上的散斑图像,获得b*p个等间距的散斑图像。In this embodiment, the way to sequentially reduce the distance between the projection unit and the reference screen may be to move the reference screen to the projection unit in sequence to form a series of equidistant reference screens. For example, in the scene shown in Figure 3, the reference screen is moved from Rpb to Rp(b-1) to R11, the speckle image projected by the projection unit is imaged on the reference screen at each position, and the image acquisition unit collects each Refer to the speckle image on the screen at the position point to obtain b*p equidistant speckle images.
在该实施方式中,使投影单元与参考幕之间距离依次变小的方式也可以是,将投影单元依次向参考幕移动,形成一系列等间距的参考幕。例如图4所示的场景下,将图像采集单元以及投影单元同时从Rpb移动到Rp(b-1)直至移动到R11,投影单元在每个位置点投射的散斑图像在参考幕成像,图像采集单元采集投影单元在每个位置点处投射的散斑图像在参考幕上的成像,获得b*p个间距为r的散斑图像。可以理解的,当参考幕与投影单元之间相对位移变化,散斑图像中的散斑也会左右移动。在本申请实施例中,每两个相邻位置点之间的间距选取标准可以是,使散斑移动距离小于或等于散斑的半径。也就是说,参考幕与投影单元之间距离每增大或减小r时,使参考幕上的散斑的移动距离小于或等于散斑的半径,参考幕与投影单元之间的距离增大r以及减小r散斑分别所在的两个位置之间具有交集。例如图5示出了一种散斑的移动示例,图5中实线圆101表示在参考幕某位置点处时,一个散斑在该参考幕的成 像。当该参考幕与投影单元之间距离减小,散斑会向左发生位移,如图5中虚线圆102所示;当该参考幕与投影单元之间距离增大,散斑会向右发生位移,如图5中虚线圆103所示。每两个相邻位置点之间的间距选取标准为,当参考幕与投影单元之间距离减小r时,实线圆101移动到虚线圆102的位置处,实线圆101到虚线圆102的移动距离小于该实线圆101的半径;当参考幕与投影单元之间距离增大r时,实线圆101移动到虚线圆103的位置处,实线圆101到虚线圆103的移动距离小于该实线圆101的半径。实线圆101和虚线圆102具有交集,同时实线圆101和虚线圆103也具有交集。In this embodiment, the way to sequentially reduce the distance between the projection unit and the reference screen may also be to move the projection unit to the reference screen in sequence to form a series of equally spaced reference screens. For example, in the scene shown in Figure 4, the image acquisition unit and the projection unit are moved from Rpb to Rp(b-1) to R11 at the same time. The speckle image projected by the projection unit at each position point is imaged on the reference screen. The acquisition unit acquires the imaging of the speckle image projected by the projection unit at each position point on the reference screen, and obtains b*p speckle images with a spacing of r. It can be understood that when the relative displacement between the reference screen and the projection unit changes, the speckles in the speckle image will also move left and right. In the embodiment of the present application, the criterion for selecting the distance between every two adjacent position points may be such that the moving distance of the speckle is less than or equal to the radius of the speckle. That is to say, every time the distance between the reference screen and the projection unit increases or decreases by r, the moving distance of the speckle on the reference screen is less than or equal to the radius of the speckle, and the distance between the reference screen and the projection unit increases There is an intersection between the two positions where r and the reduced r speckle are located. For example, Fig. 5 shows an example of the movement of a speckle. In Fig. 5, the solid circle 101 represents the image of a speckle on the reference screen when it is at a certain position on the reference screen. When the distance between the reference screen and the projection unit decreases, the speckle will shift to the left, as shown by the dotted circle 102 in Figure 5; when the distance between the reference screen and the projection unit increases, the speckle will shift to the right The displacement is shown by the dotted circle 103 in FIG. 5. The selection criterion for the distance between every two adjacent points is that when the distance between the reference screen and the projection unit decreases by r, the solid circle 101 moves to the position of the dotted circle 102, and the solid circle 101 to the dashed circle 102 The moving distance of is smaller than the radius of the solid circle 101; when the distance between the reference screen and the projection unit increases by r, the solid circle 101 moves to the position of the dashed circle 103, and the moving distance of the solid circle 101 to the dashed circle 103 It is smaller than the radius of the solid circle 101. The solid circle 101 and the dashed circle 102 have an intersection, and the solid circle 101 and the dashed circle 103 also have an intersection.
通过该匹配模板获取系统可以获取多模板用于多模板匹配,也可以获取单模板用于单模板匹配。其中,定义从投射单元投射的散斑图案为基准散斑图案。单模板为一种基准散斑图案进行投影时,获取的一套匹配模板;多模板为多种不同的基准散斑图案进行投影时,获取的多套匹配模板。其中,不同的基准散斑图案,可以是散斑图案的形状不同,也可以是散斑图案的密度不同,或者是散斑图案的形状和密度均不相同。Through the matching template obtaining system, multiple templates can be obtained for multi-template matching, or a single template can be obtained for single-template matching. Among them, the speckle pattern projected from the projection unit is defined as the reference speckle pattern. A single template is a set of matching templates obtained when a reference speckle pattern is projected; a multi-template is a set of matching templates obtained when multiple different reference speckle patterns are projected. Among them, different reference speckle patterns may have different shapes of speckle patterns, different densities of speckle patterns, or different shapes and densities of speckle patterns.
获取单模板时,将一种基准散斑图案从投影单元进行投射,图像采集单元获取参考幕与投影单元之间不同距离的时候,投影单元投射的散斑图案在参考幕的成像,获得对应该基准散斑图案的一系列匹配模板。例如图2及图3所示,将基准散斑图案P1从投影单元投射,采集基准散斑图案P1分别投射到R11、R12、R13至Rpb处的参考幕时所成的图像,获得b*p个匹配模板,作为对应基准散斑图案P1的一套匹配模板。When a single template is acquired, a reference speckle pattern is projected from the projection unit. When the image acquisition unit acquires different distances between the reference screen and the projection unit, the speckle pattern projected by the projection unit is imaged on the reference screen to obtain the corresponding A series of matching templates for the reference speckle pattern. For example, as shown in Figures 2 and 3, the reference speckle pattern P1 is projected from the projection unit, and the images formed when the reference speckle pattern P1 is projected onto the reference screens at R11, R12, R13 to Rpb, respectively, are obtained to obtain b*p A matching template as a set of matching templates corresponding to the reference speckle pattern P1.
获取多模板时,将多种不同的基准散斑图案从投影单元进行投射,获取在于投影单元不同距离的各个位置处,不同的基准散斑图案在参考幕的成像,以每种基准散斑图案在不同位置处所成的像,作为对应该基准散斑图案的一套模板,获得对应多种不同的基准散斑图案的多套匹配模板。其中,该多套匹配模板中包括多组匹配模板,每组匹配模板为不同的基准散斑图案投射到同一位置处所成图像。可以理解的,在本申请实施例中,也可以从多模板中选取一套匹配模板作为单模板。When acquiring multiple templates, a variety of different reference speckle patterns are projected from the projection unit, and the images of different reference speckle patterns on the reference screen are obtained at various positions at different distances from the projection unit. The images formed at different positions are used as a set of templates corresponding to the reference speckle patterns, and multiple sets of matching templates corresponding to multiple different reference speckle patterns are obtained. Wherein, the multiple sets of matching templates include multiple sets of matching templates, and each set of matching templates is an image formed by projecting a different reference speckle pattern onto the same position. It is understandable that in the embodiment of the present application, a set of matching templates can also be selected from multiple templates as a single template.
作为一种实施方式,可以以获取单模板的方式,分别获取对应不同基准散斑图案的单模板,作为多模板。例如,k个不同的基准散斑图案包括P1、P2、P3至Pk,将基准散斑图案P1从投影单元投射,获取对应P1的一套匹配模板;将基准散斑图案P2从投影单元投射,获取对应P2的一套匹配模板;将基准散斑图案P3从投影单元投射,获取对应P3的一套匹配模板;直至将基准散斑图案Pk从投影单元投射,获取对应Pk的一套匹配模板,从而获得对应k个不同的基准散斑图案P1、P2、P3至Pk的k套匹配模板。该k套模板中包括b*p组匹配模板,每组匹配模板包括P1、P2、P3至Pk分别投射在同一位置处的k个匹配模板。其中,P1、P2、P3至Pk投影在R11处的参考幕形成的图像为一组匹配模板,P1、P2、P3至Pk投影在R12处的参考幕形成的图像为一组匹配模板,P1、P2、P3至Pk投影在R13处的参考幕形成的图像为一组匹配模板,以此类推,共形成b*p组匹配模板。As an implementation manner, single templates corresponding to different reference speckle patterns may be obtained in a manner of obtaining single templates, as multiple templates. For example, k different reference speckle patterns include P1, P2, P3 to Pk, project the reference speckle pattern P1 from the projection unit to obtain a set of matching templates corresponding to P1; project the reference speckle pattern P2 from the projection unit, Obtain a set of matching templates corresponding to P2; project the reference speckle pattern P3 from the projection unit to obtain a set of matching templates corresponding to P3; until the reference speckle pattern Pk is projected from the projection unit to obtain a set of matching templates corresponding to Pk, Thus, k sets of matching templates corresponding to k different reference speckle patterns P1, P2, P3 to Pk are obtained. The k sets of templates include b*p matching templates, and each matching template includes k matching templates P1, P2, P3 to Pk respectively projected at the same position. Among them, the images formed by P1, P2, P3 to Pk projected on the reference screen at R11 are a set of matching templates, and the images formed by P1, P2, P3 to Pk projected on the reference screen at R12 are a set of matching templates, P1, The images formed by P2, P3 to Pk projected on the reference screen at R13 are a set of matching templates, and so on, forming a b*p set of matching templates.
作为另一种实施方式,在距离投影单元的不同距离的每个位置处,分别投射不同的基准散斑图案,获得在该位置处对应不同基准散斑图案的不同匹配模板。例如k个不同的基准散斑图案包括P1、P2、P3至Pk,图3所示,当参考幕在R11处时,分别投射基准散斑图案P1、P2、P3至Pk,获取P1、P2、P3至Pk中的每一个在R11处的参考幕的成像,获得在R11处的一组匹配模板,包括分别对应P1、P2、P3至Pk的k个匹配模板;当参考幕在R12处时,分别投射基准散斑图案P1、P2、P3至Pk,获取P1、P2、P3至Pk中的每一个在R12处的参考幕的成像,获得在R12处的一组匹配模板,包括分别对应P1、P2、P3至Pk的k个匹配模板;直至参考幕在Rpb处时,分别投射基准散斑图案P1、P2、P3至Pk,获取P1、P2、P3至Pk中的每一个在Rpb处的参考幕的成像,获得在Rpb的一组匹配模板,包括分别对应P1、P2、P3至Pk的k个匹配模板。从而分别在R11至Rpb的b*p组匹配模板。该b*p组匹配模板包括k套匹配模板,分别对应k个不同的基准散斑图案P1、P2、P3至Pk。As another implementation manner, different reference speckle patterns are respectively projected at each position at different distances from the projection unit, and different matching templates corresponding to different reference speckle patterns at that position are obtained. For example, the k different reference speckle patterns include P1, P2, P3 to Pk. As shown in Figure 3, when the reference screen is at R11, the reference speckle patterns P1, P2, P3 to Pk are respectively projected to obtain P1, P2, Each of P3 to Pk is imaged at the reference screen at R11 to obtain a set of matching templates at R11, including k matching templates corresponding to P1, P2, P3 to Pk; when the reference screen is at R12, Project the reference speckle patterns P1, P2, P3 to Pk respectively, obtain the imaging of the reference screen at R12 for each of P1, P2, P3 to Pk, and obtain a set of matching templates at R12, including corresponding P1, K matching templates of P2, P3 to Pk; until the reference screen is at Rpb, project the reference speckle patterns P1, P2, P3 to Pk respectively, and obtain the reference of each of P1, P2, P3 to Pk at Rpb The imaging of the scene, obtain a set of matching templates in Rpb, including k matching templates corresponding to P1, P2, P3 to Pk. So as to match the template in the b*p group of R11 to Rpb respectively. The b*p group of matching templates includes k sets of matching templates, corresponding to k different reference speckle patterns P1, P2, P3 to Pk, respectively.
在本申请实施例中,可以从单模板中选取精匹配模板用于精匹配,选取粗匹配模板用于粗匹配。其中,粗匹配模板彼此之间的间距大于精匹配模板彼此之间的间距。例如,从单模板中,以R作为间距,等间距地选取模板,作为一套粗匹配模板,以其余模板作为精匹配模板。具体的,以图2及3所示的场景为例,可以分别选取在R11、R21、R31、R41、以此类推至Rp1的p个位置处分别形成的匹配模板,作为一套粗匹配模板,其余匹配模板作为精匹配模板。其中,相邻的粗匹配模板之间,包括(b-1)个精匹配模板,例如,R11处的粗匹配模板与R21处的粗匹配模板,包括分别在R12至R1b的(b-1)个位置处的(b-1)个精匹配模板。In the embodiment of the present application, a fine matching template may be selected from a single template for fine matching, and a coarse matching template may be selected for coarse matching. Wherein, the distance between the coarse matching templates is greater than the distance between the fine matching templates. For example, from a single template, use R as the spacing, and select templates at equal intervals as a set of coarse matching templates, and use the remaining templates as fine matching templates. Specifically, taking the scenarios shown in Figures 2 and 3 as an example, matching templates formed at p positions of R11, R21, R31, R41, and so on to Rp1, respectively, can be selected as a set of rough matching templates. The remaining matching templates are used as fine matching templates. Among them, adjacent rough matching templates include (b-1) fine matching templates. For example, the rough matching template at R11 and the rough matching template at R21 include (b-1) at R12 to R1b, respectively. (B-1) fine matching templates at positions.
在本申请实施例中,可以从多模板中选取精匹配模板组用于精匹配,选取粗匹配模板组用于粗匹配。其中,粗匹配模板组彼此之间的间距大于精匹配模板组彼此之间的间距,同一个粗匹配模板组中的匹配模板选取于同一组匹配模板,同一个精匹配模板组中的匹配模板选取于同一组匹配模板。例如,从多模板中,以R作为间距,等间距地选取多组匹配模板,作为多个粗匹配模板组,以其余组匹配模板作为多 个精匹配模板组。具体的,以图2及图3所示的场景为例,可以分别选取在R11、R21、R31、R41、以此类推至Rp1的p个位置处分别形成的p组匹配模板,作为p个粗匹配模板组;其余组匹配模板作为精匹配模板组。其中,相邻的粗匹配模板组之间,包括(b-1)个精匹配模板组,例如,R11处的粗匹配模板组与R21处的粗匹配模板组之间,包括分别在R12至R1b的(b-1)个位置处的(b-1)个精匹配模板组。In the embodiment of the present application, a fine matching template group may be selected from multiple templates for fine matching, and a coarse matching template group may be selected for coarse matching. Among them, the spacing between the coarse matching template groups is greater than the spacing between the fine matching template groups, the matching templates in the same coarse matching template group are selected from the same set of matching templates, and the matching templates in the same fine matching template group are selected Match templates in the same group. For example, from a multi-template, using R as the spacing, multiple sets of matching templates are selected at equal intervals as multiple rough matching template groups, and the remaining sets of matching templates are used as multiple fine matching template groups. Specifically, taking the scenes shown in Figure 2 and Figure 3 as examples, p sets of matching templates formed at p positions of R11, R21, R31, R41, and so on to Rp1, respectively, can be selected as p rough Matching template group; other matching templates are used as fine matching template groups. Among them, the adjacent rough matching template groups include (b-1) fine matching template groups. For example, the rough matching template group at R11 and the rough matching template group at R21 include R12 to R1b respectively. (B-1) precise matching template groups at (b-1) positions.
在本申请实施例中,各个粗匹配模板组的匹配模板的数量相同,分别对应的基准散斑图案相同,如每个粗匹配模板组对应的基准散斑图案都为P1、P2、P3至Pk;各个精匹配模板组的匹配模板的数量相同,分别对应的基准散斑图案相同,如每个精匹配模板组对应的基准散斑图案都为P1、P2、P3至Pk。选取的粗匹配模板组中,每个粗匹配模板组的匹配模板的数量不限定为等于一组匹配模板中匹配模板的数量,如在如图2所示的场景下选取的粗匹配模板组,一个粗匹配模板组中的匹配模板的数量不限定为等于k。选取的精匹配模板组中,每个精匹配模板组的匹配模板的数量不限定为等于一组匹配模板中匹配模板的数量,如在如图2所示的场景下选取的精匹配模板组,一个精匹配模板组中的匹配模板的数量不限定为等于k。每个精匹配模板组的匹配模板的数量可以不同于粗匹配模板组的匹配模板的数量。在本申请实施例中,在生成匹配模板时,可以只生成用于粗匹配的粗匹配模板以及用于精匹配的精匹配模板;或者在获取匹配模板时,可以只获取用于粗匹配的粗匹配模板以及用于精匹配的精匹配模板。In the embodiment of the present application, the number of matching templates in each rough matching template group is the same, and the corresponding reference speckle patterns are the same. For example, the reference speckle patterns corresponding to each rough matching template group are P1, P2, P3 to Pk ; The number of matching templates in each fine matching template group is the same, and the corresponding reference speckle patterns are the same. For example, the reference speckle patterns corresponding to each fine matching template group are P1, P2, P3 to Pk. In the selected rough matching template group, the number of matching templates in each rough matching template group is not limited to be equal to the number of matching templates in a set of matching templates, such as the selected rough matching template group in the scenario shown in Figure 2. The number of matching templates in a rough matching template group is not limited to k. In the selected fine matching template group, the number of matching templates in each fine matching template group is not limited to be equal to the number of matching templates in a set of matching templates, such as the fine matching template group selected in the scenario shown in Figure 2. The number of matching templates in a fine matching template group is not limited to k. The number of matching templates in each fine matching template group may be different from the number of matching templates in the rough matching template group. In the embodiment of the present application, when generating the matching template, only the coarse matching template for coarse matching and the fine matching template for fine matching may be generated; or when the matching template is obtained, only the coarse matching template for coarse matching may be obtained. Matching template and fine matching template for fine matching.
可以理解的,当一个粗匹配模板组中匹配模板的数量为1,则粗匹配模板组可以视为单模板匹配中的粗匹配模板;当一个精匹配模板组中匹配模板的数量为1,则精匹配模板组可以视为单模板匹配中的精匹配模板。It is understandable that when the number of matching templates in a coarse matching template group is 1, the coarse matching template group can be regarded as the coarse matching template in single template matching; when the number of matching templates in a fine matching template group is 1, then The fine matching template group can be regarded as the fine matching template in single template matching.
在本申请实施例中,可以为每个位置点定义深度信息,深度信息之间的变化关系与位置点之间的变化关系对应。例如图2至图4所示的场景下,以x作为一个深度单位,定义R11的深度信息为x0,则R12的深度信息为(x0-x),R13的深度信息为(x0-2x),R14的深度信息为(x0-3x),直至Rpb的深度信息为(x0-(p*b-1)x)。又如,定义一个位置点的深度信息为深度0,这个位置点之前的各个位置点,从相邻的位置点起依次为深度1单位,2单位,3单位,以此类推;在单位之后的各个位置点,从相邻的位置点起依次为-1单位,-2单位,以此类推。或者直接以位置点之间的间距r作为深度信息的一个单位,或者直接以每个位置点离投影单元的距离作为该位置点的深度信息。从而,本申请实施例中,每个匹配模板以及每组匹配模板对应深度信息,每个匹配模板对应的深度信息为获取该匹配模板的位置的深度信息;每组匹配模板对应的深度信息为获取该组匹配模板的位置对应的深度信息。同理,选定的粗匹配模板、精匹配模板、粗匹配模板组、精匹配模板组都具有对应的位置的深度信息。In the embodiment of the present application, depth information can be defined for each location point, and the change relationship between the depth information corresponds to the change relationship between the location points. For example, in the scenes shown in Figures 2 to 4, with x as a depth unit, the depth information of R11 is defined as x0, then the depth information of R12 is (x0-x), and the depth information of R13 is (x0-2x), The depth information of R14 is (x0-3x), and the depth information of Rpb is (x0-(p*b-1)x). For another example, define the depth information of a location point as depth 0, and each location point before this location point is depth 1 unit, 2 unit, 3 unit, and so on from the adjacent location point; Each position point is -1 unit, -2 unit, and so on from the adjacent position point. Or directly use the distance r between the position points as a unit of depth information, or directly use the distance of each position point from the projection unit as the depth information of the position point. Therefore, in this embodiment of the present application, each matching template and each group of matching templates corresponds to depth information, and the depth information corresponding to each matching template is the depth information of the location where the matching template is obtained; the depth information corresponding to each group of matching templates is the acquisition The depth information corresponding to the position of the set of matching templates. In the same way, the selected coarse matching template, fine matching template, coarse matching template group, and fine matching template group all have depth information of corresponding positions.
本申请实施例中,可以通过匹配模板获取系统获得的匹配模板进行图像的深度信息检测。如图6示出了本申请实施例提供的深度信息检测方法。该方法可以应用于电子设备。该电子设备可以是手机、平板电脑、个人电脑以及其他包括可用于深度信息检测的智能设备。该深度信息检测方法也可以用于深度信息检测系统,该深度信息检测系统可以包括如图1所示的投影单元、图像采集单元、存储单元以及处理单元,或者该深度信息检测系统与匹配模板获取系统为同一个系统。其中,被测量深度的目标物体需要置于最近和最远的参考幕对应的距离范围之间且在采集单元的视场范围内,即有效的测量区。In the embodiment of the present application, the depth information detection of the image can be performed through the matching template obtained by the matching template acquisition system. Fig. 6 shows a depth information detection method provided by an embodiment of the present application. This method can be applied to electronic devices. The electronic device can be a mobile phone, a tablet computer, a personal computer, and other smart devices that can be used for in-depth information detection. The depth information detection method can also be used in a depth information detection system. The depth information detection system may include a projection unit, an image acquisition unit, a storage unit, and a processing unit as shown in FIG. 1, or the depth information detection system and matching template acquisition The system is the same system. Among them, the target object of the measured depth needs to be placed between the distance range corresponding to the nearest and the farthest reference screen and within the field of view of the acquisition unit, that is, the effective measurement area.
在本申请实施例的举例说明过程中,通常以k个基准散斑图案P1、P2、P3至Pk分别投射至R11、R21、R31以此类推至Rp1形成的p组匹配模板作为多模板粗匹配的p个粗匹配模板组,以k个基准散斑图案P1、P2、P3至Pk分别投射至R11至Rpb形成的b*p组匹配模板中,除粗匹配模板组以外的其他组匹配模板组作为多模板精匹配的多个精匹配模板组,以基准散斑图案P1投射至R11、R21、R31以此类推至Rp1形成的p个匹配模板作为单模板粗匹配的p个粗匹配模板,以基准散斑图案P1投射至R11至Rpb形成的b*p个匹配模板中,除粗匹配模板以外的其他匹配模板作为单模板精匹配的多个精匹配模板。当然可以理解的,在实际使用过程中,多模板匹配中,粗匹配模板组的数量以及一个粗匹配模板组中匹配模板的数量并不限定,精匹配模板组的数量以及一个精匹配模板组中匹配模板的数量并不限定;单模板匹配中,粗匹配模板的数量并不限定,精匹配模板的数量并不限定。In the exemplification process of the embodiments of the present application, usually k reference speckle patterns P1, P2, P3 to Pk are respectively projected to R11, R21, R31, and so on to the p set of matching templates formed by Rp1 as the multi-template rough matching The p rough matching template groups of, and k reference speckle patterns P1, P2, P3 to Pk are respectively projected into the b*p group of matching templates formed by R11 to Rpb, and the other groups except the rough matching template group As the multiple fine matching template groups for multi-template fine matching, the p matching templates formed by projecting the reference speckle pattern P1 to R11, R21, R31 and so on to Rp1 are used as the p coarse matching templates of single template coarse matching, and The reference speckle pattern P1 is projected into the b*p matching templates formed by R11 to Rpb, and the matching templates except the rough matching template are used as multiple fine matching templates of single template fine matching. Of course, it is understandable that in actual use, in multi-template matching, the number of coarse matching template groups and the number of matching templates in a coarse matching template group are not limited. The number of fine matching template groups and the number of fine matching template groups are not limited. The number of matching templates is not limited; in single template matching, the number of rough matching templates is not limited, and the number of fine matching templates is not limited.
请参见图6,该深度信息检测方法可以包括:Referring to Fig. 6, the depth information detection method may include:
步骤S110:获取将k个不同的基准散斑图案投射到目标物体形成的目标散斑图像组。Step S110: Obtain a target speckle image group formed by projecting k different reference speckle patterns to the target object.
当需要检测某一目标物体在图像上的深度信息时,可以将k个不同的基准散斑图案投射到目标物体形成的k个图像,作为目标散斑图像组,定义其中每一个图像为目标散斑图像。其中,该k个不同的基准散斑图案与获取匹配模板组时的基准散斑图案相同。When it is necessary to detect the depth information of a target object on the image, k different reference speckle patterns can be projected to the k images formed by the target object as a target speckle image group, and each image is defined as the target speckle image group. Spot image. Wherein, the k different reference speckle patterns are the same as the reference speckle patterns when the matching template group is obtained.
例如,检测人脸的深度信息,则将P1、P2、P3至Pk的k个不同的基准散斑图案分别投射到人脸,再分别采集各个基准散斑图案投射到人脸时的图像,获得k个图像,该k个图像中的每个图像,包括基准散斑图案投射到人脸形成的目标散斑图像。可选的,若采集到的图像中仅仅包括散斑图案投射形成的目标散斑图像,则将采集到的k个图像作为目标散斑图像组;若采集到的图像中还包括目标物体的图像,则将采集到的k个图像进行图像处理,获取基准散斑图案投射形成的目标散斑图像,作为目标散斑图像 组。For example, to detect the depth information of a human face, k different reference speckle patterns of P1, P2, P3 to Pk are respectively projected on the human face, and then the images when each reference speckle pattern is projected onto the human face are collected to obtain k images, each of the k images includes a target speckle image formed by projecting a reference speckle pattern onto a human face. Optionally, if the captured image only includes the target speckle image formed by the projection of the speckle pattern, the k captured images are used as the target speckle image group; if the captured image also includes the image of the target object , Image processing is performed on the collected k images, and the target speckle image formed by projection of the reference speckle pattern is obtained as the target speckle image group.
本申请实施例中,可以是由进行深度信息检测的设备将k个不同的基准散斑图案投射到目标物体形成目标散斑图像组;也可以是,其他设备将k个不同的基准散斑图案投射到目标物体形成目标散斑图像组,进行深度信息检测的设备从其他设备获取该目标散斑图像组。另外,预处理也可以由进行深度信息检测的设备进行或者由其他设备进行,本申请实施例中并不限定。In the embodiment of the present application, the device for detecting depth information may project k different reference speckle patterns onto the target object to form a target speckle image group; it may also be that other devices combine k different reference speckle patterns Projecting to the target object forms a target speckle image group, and the device for depth information detection obtains the target speckle image group from other devices. In addition, the preprocessing may also be performed by a device that performs depth information detection or by other devices, which is not limited in the embodiment of the present application.
步骤S120:将m个粗匹配模板组分别与所述目标散斑图像组的全部或者部分匹配,获取相似度最高的粗匹配模板组,作为初级匹配模板组。Step S120: The m rough matching template groups are respectively matched with all or part of the target speckle image group, and the rough matching template group with the highest similarity is obtained as the primary matching template group.
其中,每组匹配模板对应各自的深度信息,每两个相邻的粗匹配模板组间隔为R,每两个相邻的粗匹配模板组之间包括精匹配模板组,每两个相邻的精匹配模板组间隔为r,R大于r,同一个粗匹配模板组或同一个精匹配模版组均由所述k个不同的基准散斑图案的全部或者部分分别投射到同一位置的参考幕形成。可选的,R可以是r的正整数倍,该正整数大于1。Among them, each group of matching templates corresponds to its own depth information, the interval between every two adjacent rough matching template groups is R, and every two adjacent rough matching template groups includes a fine matching template group, and every two adjacent rough matching template groups include a fine matching template group. The interval of the fine matching template group is r, R is greater than r. The same rough matching template group or the same fine matching template group is formed by all or part of the k different reference speckle patterns projected to the reference screen at the same position. . Optionally, R may be a positive integer multiple of r, and the positive integer is greater than 1.
定义粗匹配模板组的数量为m。将m个粗匹配模板组分别与目标散斑图像组的全部或者部分匹配。m可以等于或小于p,本申请实施例中以m等于p为例进行说明。Define the number of rough matching template groups as m. The m rough matching template groups are respectively matched with all or part of the target speckle image group. m may be equal to or less than p. In the embodiment of the present application, m is equal to p as an example for description.
其中,本申请实施例中的一个粗匹配模板组可以包括多个匹配模板,用于多模板粗匹配,也可以是用于单模板匹配的一个粗匹配模板。另外,在本步骤中,目标散斑图像组的全部或者部分,即目标散斑图像组中与粗匹配模板组匹配模板数量相同的、且对应相同基准散斑图案的目标散斑图像。如,粗匹配模板组用于单模板匹配,每个粗匹配模板组只有一个对应基准散斑图案P1的匹配模板,则将目标散斑图像组中对应基准散斑图案P1的目标散斑图像与m个粗匹配模板组匹配。若粗匹配模板组用于多模板匹配,每个粗匹配模板组有k个对应基准散斑图案P1至Pk的匹配模板,则将目标散斑图像组中的全部目标散斑图像与m个粗匹配模板组匹配。Wherein, a rough matching template group in the embodiment of the present application may include multiple matching templates for multi-template rough matching, or one rough matching template for single template matching. In addition, in this step, all or part of the target speckle image group, that is, the target speckle images in the target speckle image group that have the same number of matching templates as the rough matching template group and correspond to the same reference speckle pattern. For example, the rough matching template group is used for single template matching, and each rough matching template group has only one matching template corresponding to the reference speckle pattern P1, then the target speckle image corresponding to the reference speckle pattern P1 in the target speckle image group is combined with Matching of m rough matching template groups. If the coarse matching template group is used for multi-template matching, and each coarse matching template group has k matching templates corresponding to the reference speckle patterns P1 to Pk, then all target speckle images in the target speckle image group are combined with m coarse speckle images. Match template group matches.
具体的,可以定义每个粗匹配模板组中的粗匹配模板数量为I,当I等于1,该粗匹配模板组用于单模板粗匹配;当I大于1,该粗匹配模板组用于多模板粗匹配。在本申请实施例中,当I大于1,以I等于k为例进行说明,即以每个粗匹配模板组中匹配模板的数量等于目标散斑图像组中目标散斑图像的数量为例进行说明。Specifically, the number of rough matching templates in each rough matching template group can be defined as I. When I is equal to 1, the rough matching template group is used for single-template rough matching; when I is greater than 1, the rough matching template group is used for multiple rough matching. Rough template matching. In the embodiment of the present application, when I is greater than 1, I is equal to k as an example for description, that is, the number of matching templates in each rough matching template group is equal to the number of target speckle images in the target speckle image group. Description.
则在本步骤中,可以是,以所述目标散斑图像组中对应粗匹配模板组的I个目标散斑图像作为第一目标散斑图像组,将所述m个粗匹配模板组分别与所述第一目标散斑图像组匹配,获取与所述第一目标散斑图像组相似度最高的粗匹配模板组,作为初级匹配模板组。Then in this step, it may be that one target speckle image corresponding to the rough matching template group in the target speckle image group is used as the first target speckle image group, and the m rough matching template groups are respectively combined with The first target speckle image group is matched, and the rough matching template group with the highest similarity to the first target speckle image group is acquired as a primary matching template group.
由于粗匹配模板组之间间距为R,间距较大,将目标散斑图像组的全部或者部分与粗匹配模板组进行粗匹配,获得的相似度最高的粗匹配模板组可以确定一个较为大概的、不太精确的深度信息。因此,在本申请实施例中,可以通过彼此之间间距较小的精匹配模板组进一步进行匹配,获取更加精确的深度信息。Since the distance between the rough matching template groups is R, the distance is relatively large. If all or part of the target speckle image group is roughly matched with the rough matching template group, a rough matching template group with the highest similarity can be determined. , Less precise depth information. Therefore, in the embodiment of the present application, the fine matching template group with a small distance between each other can be further matched to obtain more accurate depth information.
步骤S130:选取所述初级匹配模板组前后预设范围内的精匹配模板组,分别与所述目标散斑图像组中的全部或者部分匹配,获取相似度最高的精匹配模板组,作为次级匹配模板组。Step S130: Select the fine matching template group within the preset range before and after the primary matching template group, and respectively match all or part of the target speckle image group, and obtain the fine matching template group with the highest similarity as the secondary Match template group.
定义与散斑图像组相似度最高的粗匹配模板为初级匹配模板组。由于初级匹配模板组可以确定目标散斑图像组一个大概的深度信息,根据物体固有的性质,其更为精确的深度信息通常在该大概的深度信息范围内波动。因此,为了减少计算量,可以从该初级匹配模板组前后进行精匹配模板组的选取。The rough matching template with the highest similarity to the speckle image group is defined as the primary matching template group. Since the primary matching template group can determine an approximate depth information of the target speckle image group, according to the inherent properties of the object, its more accurate depth information usually fluctuates within the approximate depth information range. Therefore, in order to reduce the amount of calculation, the fine matching template group can be selected from before and after the primary matching template group.
其中,初级匹配模板组前后,即初级匹配模板组对应的位置之前的位置以及之后的位置。初级匹配模板组前的精匹配模板组,即在初级匹配模板组的位置之前的位置对应的精匹配模板组;初级匹配模板组后的精匹配模板组,即在初级匹配模板组的位置之后的位置对应的精匹配模板组。例如,对于R21位置处的初级匹配模板组,之前的精匹配模板组为R1p、R1(p-1)、R1(p-2)以此往前类推的精匹配模板组;之后的精匹配模板组为R22、R23、R24以此往后类推的精匹配模板组。Among them, before and after the primary matching template group, that is, the position before and after the position corresponding to the primary matching template group. The fine matching template group before the primary matching template group, that is, the fine matching template group corresponding to the position before the position of the primary matching template group; the fine matching template group after the primary matching template group, that is, the position after the primary matching template group The precise matching template group corresponding to the position. For example, for the primary matching template set at the position of R21, the previous fine matching template set is R1p, R1(p-1), R1(p-2) and then the fine matching template set by analogy; the subsequent fine matching template The group is the fine matching template group of R22, R23, R24 and so on.
本申请实施例中的一个精匹配模板组可以包括多个匹配模板,用于多模板精匹配,也可以是用于单模板匹配的一个精匹配模板。另外,在本步骤中,目标散斑图像组的全部或者部分,即目标散斑图像组中与精匹配模板组匹配模板数量相同的、且对应相同基准散斑图案的目标散斑图像。如,精匹配模板组用于单模板匹配,只有一个对应基准散斑图案P1的匹配模板,则将目标散斑图像组中对应基准散斑图案P1的目标散斑图像与选取的精匹配模板组匹配。若精匹配模板组用于多模板匹配,只有k个对应基准散斑图案P1至Pk的匹配模板,则将目标散斑图像组的全部与选取的精匹配模板组匹配。A fine matching template group in the embodiment of the present application may include multiple matching templates for multi-template fine matching, or one fine matching template for single template matching. In addition, in this step, all or part of the target speckle image group, that is, the target speckle images in the target speckle image group that have the same number of matching templates as the fine matching template group and correspond to the same reference speckle pattern. For example, the fine matching template group is used for single template matching, and there is only one matching template corresponding to the reference speckle pattern P1, then the target speckle image corresponding to the reference speckle pattern P1 in the target speckle image group is combined with the selected fine matching template group match. If the fine matching template group is used for multi-template matching, and there are only k matching templates corresponding to the reference speckle patterns P1 to Pk, then all the target speckle image groups are matched with the selected fine matching template group.
具体的,可以定义每个精匹配模板组的精匹配模板数量为i,当i等于1,该精匹配模板组用于单模板精匹配;当i大于1,该精匹配模板组用于多模板精匹配。在本申请实施例中,当i大于1,以i等于k为例进行说明,即以每个精匹配模板组中匹配模板的数量等于目标散斑图像组中目标散斑图像的数量为例进行说明。Specifically, the number of fine matching templates in each fine matching template group can be defined as i. When i is equal to 1, the fine matching template group is used for single template fine matching; when i is greater than 1, the fine matching template group is used for multiple templates. Fine matching. In the embodiment of this application, when i is greater than 1, take i equal to k as an example for description, that is, take the number of matching templates in each fine matching template group equal to the number of target speckle images in the target speckle image group as an example. Description.
则在本步骤中,可以是,以所述目标散斑图像组中对应精匹配模板组的i个目标散斑图像作为第二 目标散斑图像组,选取所述初级匹配模板组前后预设范围内的精匹配模板组,分别与所述第二目标散斑图像组匹配,获取与所述第二目标散斑图像组相似度最高的精匹配模板组,作为次级匹配模板组。Then, in this step, the i target speckle images corresponding to the fine matching template group in the target speckle image group are used as the second target speckle image group, and the preset ranges before and after the primary matching template group are selected The fine matching template groups within are respectively matched with the second target speckle image group, and the fine matching template group with the highest similarity to the second target speckle image group is obtained as a secondary matching template group.
步骤S140:根据所述次级匹配模板组的深度信息确定目标散斑图像的深度信息。Step S140: Determine the depth information of the target speckle image according to the depth information of the secondary matching template group.
由于基准散斑图案投射到不同距离处,形成的图像不同,因此,与目标散斑图像组相似度最高的精匹配模板组距离投影单元的距离,最接近目标物体与投影单元之间的距离,因此,可以根据与目标散斑图像相似度最高的精匹配模板组的深度信息确定目标散斑图像的深度信息。Since the reference speckle pattern is projected to different distances, the formed images are different, therefore, the distance between the precision matching template group with the highest similarity to the target speckle image group from the projection unit is the closest to the distance between the target object and the projection unit, Therefore, the depth information of the target speckle image can be determined according to the depth information of the fine matching template group with the highest similarity to the target speckle image.
在本申请实施例中提供的方案中,先通过彼此之间距离更大的粗匹配模板组对目标散斑图像组进行粗匹配,根据粗匹配结果选取精匹配模板组,再根据彼此之间距离更小的精匹配模板组进行精匹配,通过更小的计算量获得精确的图像深度信息。In the solution provided in the embodiment of the present application, the target speckle image group is coarsely matched through the coarse matching template group with a larger distance from each other, and the fine matching template group is selected according to the rough matching result, and then according to the distance between each other. A smaller fine matching template group performs fine matching and obtains accurate image depth information through a smaller amount of calculation.
在本申请实施例中,一个粗匹配模板组中,匹配模板的数量I可以等于1,用于单模板粗匹配;匹配模板的数量I可以大于1,用于多模板粗匹配。一个精匹配模板组中,匹配模板的数量i可以等于1,用于单模板精匹配;匹配模板的数量i可以大于1,用于多模板精匹配。因此,在匹配过程中,可以是I大于1,i等于1,进行多模板粗匹配,单模板精匹配;也可以是I大于1,i大于1,进行多模板粗匹配,多模板精匹配;或者是I等于1,i大于1,进行单模板粗匹配,多模板精匹配。对于I以及i大于1或者等于1的不同情况,本申请通过下述的实施例进行说明。In the embodiment of the present application, in a rough matching template group, the number I of matching templates may be equal to 1 for single-template rough matching; the number I of matching templates may be greater than 1 for multi-template rough matching. In a fine matching template group, the number i of matching templates can be equal to 1 for single-template fine matching; the number i of matching templates can be greater than 1 for multi-template fine matching. Therefore, in the matching process, I can be greater than 1, i is equal to 1, for multi-template coarse matching, single template fine matching; it can also be I is greater than 1, i is greater than 1, for multi-template coarse matching, multi-template fine matching; Or if I is equal to 1, and i is greater than 1, a single-template coarse matching and multiple-template fine matching are performed. For the different situations where I and i are greater than 1 or equal to 1, the present application is described by the following embodiments.
如图7示出了一个实施例提供的深度信息检测方法,该方法包括:FIG. 7 shows a depth information detection method provided by an embodiment, and the method includes:
步骤S210:获取将k个不同的基准散斑图案投射到目标物体形成的目标散斑图像组。Step S210: Obtain a target speckle image group formed by projecting k different reference speckle patterns to the target object.
步骤S220:以所述目标散斑图像组中对应粗匹配模板组的I个目标散斑图像作为第一目标散斑图像组,将所述m个粗匹配模板组分别与所述第一目标散斑图像组匹配,获取与所述第一目标散斑图像组相似度最高的粗匹配模板组,作为初级匹配模板组。Step S220: Use I target speckle images corresponding to the rough matching template group in the target speckle image group as the first target speckle image group, and disperse the m rough matching template groups with the first target speckle image group respectively. Spot image group matching, obtaining a rough matching template group with the highest similarity to the first target speckle image group as a primary matching template group.
当I等于1时,粗匹配模板组仅有一个粗匹配模板,m个粗匹配模板组为m个在不同位置处对应相同基准散斑图案的粗匹配模板。第一目标散斑图像组中仅有一个目标散图像。该步骤中,将目标散斑图像与m个粗匹配模板一一比对,获取与该目标散斑图案相似度最高的粗匹配模板,作为初级匹配模板组。该初级匹配模板组中只有一个匹配模板。When I is equal to 1, the rough matching template group has only one rough matching template, and the m rough matching template groups are m rough matching templates corresponding to the same reference speckle pattern at different positions. There is only one target speckle image in the first target speckle image group. In this step, the target speckle image is compared with m coarse matching templates one by one, and the coarse matching template with the highest similarity to the target speckle pattern is obtained as the primary matching template group. There is only one matching template in the primary matching template group.
可选的,计算目标散斑图像与粗匹配模板之间的相似度时,可以将m个粗匹配模板以及目标散斑图像先做归一化再做数值运算,例如通过基于灰度的模板匹配算法SAD算法(绝对误差和算法,Sum of absolute differences)以及MAD算法(平均绝对差算法,Mean Absolute Differences)等算法进行数值运算,得到分别对应m个粗匹配模板的m个差分结果。其中数值最小的差分结果所对应的粗匹配模板,为与目标散斑图像相似度最高的粗匹配模板。Optionally, when calculating the similarity between the target speckle image and the coarse matching template, the m coarse matching templates and the target speckle image can be normalized first and then numerically calculated, for example, by template matching based on grayscale Algorithm SAD algorithm (Sum of absolute differences) and MAD algorithm (Mean Absolute Differences) and other algorithms perform numerical calculations to obtain m difference results corresponding to m coarse matching templates. Among them, the coarse matching template corresponding to the difference result with the smallest value is the coarse matching template with the highest similarity to the target speckle image.
可选的,计算目标散斑图像与粗匹配模板之间的相似度时,可以采用作异或的逻辑运算,将m个粗匹配模板分别与目标散斑图像做异或的逻辑运算,得到对应m个粗匹配模板的m个异或结果。其中数值最小的异或结果所对应的粗匹配模板,为与目标散斑图像相似度最高的粗匹配模板。Optionally, when calculating the similarity between the target speckle image and the coarse matching template, a logical operation of XOR can be used, and the m coarse matching templates are XORed with the target speckle image to obtain the corresponding m XOR results of m rough matching templates. The rough matching template corresponding to the XOR result with the smallest value is the rough matching template with the highest similarity to the target speckle image.
可选的,计算目标散斑图像与粗匹配模板之间的相似度时,可以采用作与的逻辑运算,将m个粗匹配模板分别与目标散斑图像作与的逻辑运算,得到对应m个粗匹配模板的m个与结果。其中数值最大的与的结果所对应的粗匹配模板,为与目标散斑图像散斑重合个数最多的粗匹配模板,是与目标散斑图像相似度最高的粗匹配模板。Optionally, when calculating the similarity between the target speckle image and the coarse matching template, the logical AND operation can be used, and the m coarse matching templates are respectively ANDed with the target speckle image to obtain the corresponding m Roughly match the m AND results of the template. Among them, the coarse matching template corresponding to the result of and with the largest value is the coarse matching template with the largest number of overlapping speckles of the target speckle image, and the coarse matching template with the highest similarity to the target speckle image.
其中,与目标散斑图像相似度最高的粗匹配模板的深度信息,接近目标散斑图像的深度信息。Among them, the depth information of the rough matching template with the highest similarity to the target speckle image is close to the depth information of the target speckle image.
当I大于1时,第一目标散斑图像组中目标散斑图像分别对应的基准散斑图案与粗匹配模板组分别对应的基准散斑图案相同。当I等于k时,第一目标散斑图像组即为目标散斑图像组。本申请实施例以I等于k为例进行说明。When I is greater than 1, the reference speckle patterns respectively corresponding to the target speckle images in the first target speckle image group are the same as the reference speckle patterns respectively corresponding to the rough matching template group. When I is equal to k, the first target speckle image group is the target speckle image group. In the embodiment of the present application, I is equal to k as an example for description.
在一种实施方式中,第一目标散斑图像组与粗匹配模板组匹配时,可以以每个粗匹配模板组作为一个整体,以第一目标散斑图像组作为整体,计算每个粗匹配模板组与所述第一目标散斑图像组之间的相似度;将与所述第一目标散斑图像组相似度最高的粗匹配模板组,作为初级匹配模板组。In one embodiment, when the first target speckle image group is matched with the rough matching template group, each rough matching template group can be taken as a whole, and the first target speckle image group can be taken as a whole, and each rough matching can be calculated. The similarity between the template group and the first target speckle image group; the rough matching template group with the highest similarity to the first target speckle image group is used as the primary matching template group.
具体的,如图8所示,空间轴S的每个位置处,在时间轴T上的k个粗匹配模板为一个粗匹配模板组,视为一个立体的空间,称为体素。如空间轴S1处的k个粗匹配模板T1至Tk为一个粗匹配模板组,视为一个立体的空间,称为体素。空间轴S2处的k个粗匹配模板T1至Tk为一个粗匹配模板组,视为一个立体的空间,称为体素。对应的,第一目标散斑图像组也可以视为一个立体空间,即体素。该粗匹配模板组在空间轴上的特征更为明显,有微小的差别就能够较敏感地区分不同深度。Specifically, as shown in FIG. 8, at each position of the space axis S, the k coarse matching templates on the time axis T are a group of coarse matching templates, which are regarded as a three-dimensional space, which is called a voxel. For example, the k coarse matching templates T1 to Tk on the space axis S1 are a coarse matching template group, which is regarded as a three-dimensional space, which is called a voxel. The k coarse matching templates T1 to Tk on the spatial axis S2 are a coarse matching template group, which is regarded as a three-dimensional space, which is called a voxel. Correspondingly, the first target speckle image group can also be regarded as a three-dimensional space, that is, voxels. The characteristics of the rough matching template group on the spatial axis are more obvious, and the difference in depth can be more sensitively distinguished with slight differences.
在该实施方式中,计算粗匹配模板组与所述第一目标散斑图像组之间的相似度时,可以以所述第一目标散斑图像组作为一个体素,以每个粗匹配模板组作为一个体素,通过3维计算,如数值运算、逻辑运算或互相关等方法匹配出最高的相似度。另外,体素也可以拆分为二维矩阵,还可以拆分为一维序列,来简化运算。例如,通过3维互相关公式计算粗匹配模板组与所述第一目标散斑图像组之间的相似度时, 计算公式可以是:In this embodiment, when calculating the similarity between the rough matching template group and the first target speckle image group, the first target speckle image group may be used as a voxel, and each rough matching template As a voxel, the group is matched with the highest similarity through three-dimensional calculations, such as numerical operations, logical operations, or cross-correlation. In addition, voxels can also be split into two-dimensional matrices or one-dimensional sequences to simplify operations. For example, when calculating the similarity between the coarse matching template group and the first target speckle image group by using a 3-dimensional cross-correlation formula, the calculation formula may be:
Figure PCTCN2019113434-appb-000001
Figure PCTCN2019113434-appb-000001
其中,该公式中的A代表粗匹配模板组形成的体素,
Figure PCTCN2019113434-appb-000002
为该体素的平均值。B代表第一目标散斑图像组形成的体素,
Figure PCTCN2019113434-appb-000003
为对应的平均值。m、n、s分别代表体素的长、宽和高,i、j、k分别为体素长、宽和高的控制变量。corr3为该体素的相似系数,数值大小反应两者的相似度高低。可以理解的,该公式中的各个字母表示本段中定义的各种意义,与前述表示匹配模板数量的i、表示匹配模板组数量的m、n等并无关系。
Among them, A in the formula represents the voxel formed by the rough matching template group,
Figure PCTCN2019113434-appb-000002
Is the average value of the voxel. B represents the voxel formed by the first target speckle image group,
Figure PCTCN2019113434-appb-000003
Is the corresponding average value. m, n, and s represent the length, width, and height of the voxel, respectively, and i, j, and k are the control variables for the length, width, and height of the voxel, respectively. corr3 is the similarity coefficient of the voxel, and the value reflects the similarity between the two. It is understandable that each letter in the formula represents various meanings defined in this paragraph, and has nothing to do with the aforementioned i representing the number of matching templates, m, n representing the number of matching template groups, and so on.
在另一种实施方式中,可以将目标散斑图像组中的每个目标散斑图像与粗匹配模板组进行单模板匹配,再根据各个目标散斑图像相似度最高的粗匹配模板,获取目标散斑图像组像素度最高的初级匹配模板组。In another embodiment, each target speckle image in the target speckle image group can be matched with a rough matching template group for single template matching, and then the target can be obtained according to the rough matching template with the highest similarity of each target speckle image. The primary matching template group with the highest pixel degree of the speckle image group.
具体的,在该实施方式中,可以是,对于第一目标散斑图像组中的每个目标散斑图像而言,计算方式相同。对于任意一个目标散斑图像,确定所述m个粗匹配模板组中对应该目标散斑图像的m个粗匹配模板,即确定与该目标散斑图像对应相同的基准散斑图案的m个粗匹配模板。再分别计算该m个粗匹配模板与该目标散斑图像的相似度,获得与该目标散斑图像相似度最高的粗匹配模板。Specifically, in this embodiment, the calculation method may be the same for each target speckle image in the first target speckle image group. For any target speckle image, determine m coarse matching templates corresponding to the target speckle image in the m coarse matching template group, that is, determine m coarse speckle patterns corresponding to the target speckle image. Match the template. Then calculate the similarity between the m rough matching templates and the target speckle image, and obtain the rough matching template with the highest similarity to the target speckle image.
第一目标散斑图像组中每个目标散斑图像对应一个相似度最高的粗匹配模板,从而可以根据所述第一目标散斑图像组中I个目标散斑图像对应的I个相似度最高的粗匹配模板,确定初级匹配模板组。Each target speckle image in the first target speckle image group corresponds to a rough matching template with the highest similarity, so that one target speckle image corresponding to one target speckle image in the first target speckle image group has the highest similarity. To determine the primary matching template group.
具体的,可以将第一目标散斑图像组中各个目标散斑图像相似度最高的粗匹配模板计算获取一个匹配模板,作为初级匹配模板组。Specifically, a rough matching template with the highest similarity of each target speckle image in the first target speckle image group may be calculated to obtain a matching template, which is used as the primary matching template group.
可选的,根据所述第一目标散斑图像组中I个目标散斑图像对应的I个相似度最高的粗匹配模板,确定初级匹配模板组,可以包括:获取I个相似度最高的粗匹配模板分别对应的相似度系数,获得I个相似度系数。再获取该I个相似度系数中,表示相似度最高的相似度系数,以该表示相似度最高的相似度系数对应的粗匹配模板作为初级匹配模板组。即该初级匹配模板组为一个粗匹配模板,该粗匹配模板与对应的目标散斑图像之间的相似度大于其他粗匹配模板与对应的目标散斑图像之间的相似度。其中,在获取该I个相似度系数中表示相似度最高的相似度系数之前,可以先将该I个相似度系数做对位的乘法或加法或均值运算,以便更好的区分相似度。Optionally, determining the primary matching template group according to one rough matching template with the highest similarity corresponding to one target speckle image in the first target speckle image group may include: obtaining one rough matching template with the highest similarity The similarity coefficients corresponding to the matching templates respectively obtain I similarity coefficients. Then, among the I similarity coefficients, the similarity coefficient representing the highest similarity is obtained, and the rough matching template corresponding to the similarity coefficient representing the highest similarity is used as the primary matching template group. That is, the primary matching template group is a rough matching template, and the similarity between the rough matching template and the corresponding target speckle image is greater than the similarity between other rough matching templates and the corresponding target speckle image. Wherein, before obtaining the similarity coefficient representing the highest similarity among the I similarity coefficients, the I similarity coefficients may be firstly subjected to a parallel multiplication, addition, or mean operation, so as to better distinguish the similarity.
可选的,根据所述第一目标散斑图像组中I个目标散斑图像对应的I个相似度最高的粗匹配模板,确定初级匹配模板组,可以包括:确定I个相似度最高的粗匹配模板分别对应的深度信息,获得I个深度信息。再计算该I个深度信息的平均值,获得平均深度信息,以减少某一些地方的噪声带来的偶然性误差。以该平均深度信息对应的匹配模板作为所述初级匹配模板组。Optionally, determining the primary matching template group according to one rough matching template with the highest similarity corresponding to one target speckle image in the first target speckle image group may include: determining one rough matching template with the highest similarity Match the depth information corresponding to the template to obtain I depth information. Then calculate the average value of the I depth information to obtain the average depth information to reduce accidental errors caused by noise in certain places. The matching template corresponding to the average depth information is used as the primary matching template group.
步骤S230:以所述目标散斑图像组中对应精匹配模板组的i个目标散斑图像作为第二目标散斑图像组,选取所述初级匹配模板组前后预设范围内的精匹配模板组,分别与所述第二目标散斑图像组匹配,获取与所述第二目标散斑图像组相似度最高的精匹配模板组,作为次级匹配模板组。Step S230: Use i target speckle images corresponding to the fine matching template group in the target speckle image group as the second target speckle image group, and select fine matching template groups within a preset range before and after the primary matching template group , Respectively matching with the second target speckle image group, and obtaining the fine matching template group with the highest similarity with the second target speckle image group as the secondary matching template group.
可选的,选取所述初级匹配模板组前后预设范围内的精匹配模板组,该预设范围可以是预先设置的一个范围区间,如初级匹配模板组前第一数量的精匹配模板组,初级匹配模板组后第二数量的精匹配模板。Optionally, selecting a fine matching template group within a preset range before and after the primary matching template group, the preset range may be a preset range, such as the first number of fine matching template groups before the primary matching template group, The second number of fine matching templates after the primary matching template group.
可选的,选取所述初级匹配模板组前后预设范围内的精匹配模板组,该预设范围可以根据初级匹配模板组与第一目标散斑图像组的相似度进行计算。相似度越高,说明目标散斑图像的深度信息越接近该初级匹配模板组,可以选取越小的范围。具体的,若初级匹配模板组与第一目标散斑图像组的相似度小于θ 1,从该初级匹配模板组的前后分别选择γ 1个精匹配模板组;若相似度在[θ1,θ2]之间,从该初级匹配模板组的前后分别选择γ 2个精匹配模板组;若相似度大于θ 2,从该初级匹配模板组的前后分别选择γ 3个精匹配模板组。其中,θ 12,r 1>r 2>r 3,从与初级匹配模板组相邻的精匹配模板组开始依次选取。可以理解的,若初级匹配模板组在边界的情况,则只需选一个方向,即前或后有匹配模板组的方向。例如,若初级匹配模板组在R11位置处获得,初级匹配模板组与第一目标散斑图像组的相似度小于θ 1,则从R12开始,往Rpb的方向选取γ 1个精匹配 模板组。 Optionally, a fine matching template group within a preset range before and after the primary matching template group is selected, and the preset range can be calculated based on the similarity between the primary matching template group and the first target speckle image group. The higher the similarity, the closer the depth information of the target speckle image is to the primary matching template group, and the smaller the range that can be selected. Specifically, if the similarity between the primary matching template group and the first target speckle image group is less than θ 1 , select γ 1 fine matching template groups from before and after the primary matching template group; if the similarity is [θ1, θ2] In between, γ 2 fine matching template groups are selected from the front and back of the primary matching template group; if the similarity is greater than θ 2 , γ 3 fine matching template groups are respectively selected from the front and back of the primary matching template group. Among them, θ 12 , r 1 >r 2 >r 3 are selected in order from the fine matching template group adjacent to the primary matching template group. It is understandable that if the primary matching template group is at the boundary, only one direction needs to be selected, that is, the direction of the matching template group before or after. For example, if the primary matching template group is obtained at position R11, and the similarity between the primary matching template group and the first target speckle image group is less than θ 1 , then starting from R12, γ 1 fine matching template group is selected in the direction of Rpb.
在本申请实施例中,通过选取的精匹配模板组进行精匹配的方式与粗匹配模板组粗匹配的方式相似,以下对精匹配的过程进行描述,其中与粗匹配对应的却未详细描述的地方,可以相互参照。In the embodiment of the present application, the method of performing fine matching through the selected fine matching template group is similar to the coarse matching method of the coarse matching template group. The following describes the fine matching process, where the rough matching corresponds to the rough matching but is not described in detail Places can be cross-referenced.
定义选取的初级匹配模板组前后预设范围内的精匹配模板组的数量为n。以下描述过程中与第二目标散斑图像组进行比对的均为该n个精匹配模板组。Define the number of fine matching template groups in the preset range before and after the selected primary matching template group as n. In the following description process, the comparison with the second target speckle image group is all the n fine matching template groups.
当i等于1时,精匹配模板组仅有一个精匹配模板,n个精匹配模板组为n个对应相同基准散斑图案的精匹配模板。第二目标散斑图像组中仅有一个目标散图像。该步骤中,将目标散斑图像与n个精匹配模板一一比对,获取与该目标散斑图案相似度最高的精匹配模板,作为次级匹配模板组。该次级匹配模板组中只有一个匹配模板。When i is equal to 1, the fine matching template group has only one fine matching template, and the n fine matching template groups are n fine matching templates corresponding to the same reference speckle pattern. There is only one target speckle image in the second target speckle image group. In this step, the target speckle image is compared with the n fine matching templates one by one, and the fine matching template with the highest similarity to the target speckle pattern is obtained as the secondary matching template group. There is only one matching template in the secondary matching template group.
可选的,在精匹配时,由于要更精确地确定与目标散斑图像的相似度,以更精确地确定目标散斑图像的深度信息,因此,精匹配使所使用的匹配算法可以比粗匹配时更精确。例如,本申请实施例中,通过精确度更高的互相关的方式计算相似度。将目标散斑图像与n个精匹配模板一一进行互相关运算,获取与该目标散斑图案相似度最高的精匹配模板。该互相关运算对应的算法可以是ZNCC(Zero Mean Normalization cross correlation,零均值归一化交叉相关)或NCC(归一化交叉相关,Normalization cross correlation)等,在本申请实施例中并不限定。Optionally, during the fine matching, since the similarity with the target speckle image must be determined more accurately to determine the depth information of the target speckle image more accurately, the fine matching enables the matching algorithm used to be more accurate than the coarse More accurate when matching. For example, in the embodiment of the present application, the similarity is calculated by a cross-correlation method with higher accuracy. A cross-correlation operation is performed on the target speckle image and n fine matching templates one by one to obtain the fine matching template with the highest similarity to the target speckle pattern. The algorithm corresponding to the cross-correlation operation may be ZNCC (Zero Mean Normalization cross correlation) or NCC (Normalization cross correlation), etc., which is not limited in the embodiment of the present application.
当i大于1时,第二目标散斑图像组中目标散斑图像分别对应的基准散斑图案与精匹配模板组分别对应的基准散斑图案相同。当i等于k时,第二目标散斑图像组即为目标散斑图像组。本申请实施例以i等于k为例进行说明。When i is greater than 1, the reference speckle patterns respectively corresponding to the target speckle images in the second target speckle image group are the same as the reference speckle patterns respectively corresponding to the fine matching template group. When i is equal to k, the second target speckle image group is the target speckle image group. In the embodiment of the present application, i is equal to k as an example for description.
在一种实施方式中,第二目标散斑图像组与选取的精匹配模板组匹配时,可以以每个精匹配模板组作为一个整体,以第二目标散斑图像组作为整体,计算每个精匹配模板组与所述第二目标散斑图像组之间的相似度;将与所述第二目标散斑图像组相似度最高的精匹配模板组,作为次级匹配模板组。In one embodiment, when the second target speckle image group is matched with the selected fine matching template group, each fine matching template group may be taken as a whole, and the second target speckle image group may be taken as a whole, and each The degree of similarity between the fine matching template group and the second target speckle image group; the fine matching template group with the highest similarity to the second target speckle image group is used as the secondary matching template group.
具体的,可以将每个精匹配模板组看作一个立体的空间,称为体素。对应的,第二目标散斑图像组也可以看作一个体素。该精匹配模板组在空间轴上的特征更为明显,有微小的差别就能够较敏感地区分不同深度。Specifically, each fine matching template group can be regarded as a three-dimensional space, called a voxel. Correspondingly, the second target speckle image group can also be regarded as one voxel. The characteristics of the fine matching template group on the spatial axis are more obvious, and the difference in depth can be more sensitively distinguished with small differences.
计算精匹配模板组与所述第二目标散斑图像组之间的相似度时,可以以所述第二目标散斑图像组作为一个体素,以每个精匹配模板组作为一个体素,通过3维计算,如数值运算、逻辑运算或互相关等方法匹配出最高的相似度。另外,体素也可以拆分为二维矩阵,还可以拆分为一维序列,来简化运算。例如,通过3维互相关公式计算精匹配模板组与所述第二目标散斑图像组之间的相似度时,计算公式可以是:When calculating the similarity between the fine matching template group and the second target speckle image group, the second target speckle image group may be used as a voxel, and each fine matching template group may be used as a voxel, Through three-dimensional calculations, such as numerical operations, logical operations or cross-correlation methods, the highest similarity is matched. In addition, voxels can also be split into two-dimensional matrices or one-dimensional sequences to simplify operations. For example, when calculating the similarity between the fine matching template group and the second target speckle image group by using a 3-dimensional cross-correlation formula, the calculation formula may be:
Figure PCTCN2019113434-appb-000004
Figure PCTCN2019113434-appb-000004
其中,该公式中的A代表精匹配模板组形成的体素,
Figure PCTCN2019113434-appb-000005
为该体素的平均值。B代表第二目标散斑图像组形成的体素,
Figure PCTCN2019113434-appb-000006
为对应的平均值。m、n、s分别代表体素的长、宽和高,i、j、k分别为体素长、宽和高的控制变量。corr3为该体素的相似系数,数值大小反应两者的相似度高低。可以理解的,该公式中的各个字母表示本段中定义的各种意义,与前述表示匹配模板数量的i、表示匹配模板组数量的m、n等并无关系。
Among them, A in the formula represents the voxel formed by the fine matching template group,
Figure PCTCN2019113434-appb-000005
Is the average value of the voxel. B represents the voxel formed by the second target speckle image group,
Figure PCTCN2019113434-appb-000006
Is the corresponding average value. m, n, and s represent the length, width, and height of the voxel, respectively, and i, j, and k are the control variables for the length, width, and height of the voxel, respectively. corr3 is the similarity coefficient of the voxel, and the value reflects the similarity between the two. It is understandable that each letter in the formula represents various meanings defined in this paragraph, and has nothing to do with the aforementioned i representing the number of matching templates, m, n representing the number of matching template groups, and so on.
在另一种实施方式中,可以将目标散斑图像组中的每个目标散斑图像与精匹配模板组进行单模板匹配,再根据各个目标散斑图像相似度最高的精匹配模板,获取目标散斑图像组像素度最高的次级匹配模板组。In another embodiment, each target speckle image in the target speckle image group can be matched with the fine matching template group for single template matching, and then the target is obtained according to the fine matching template with the highest similarity of each target speckle image. The secondary matching template group with the highest pixel degree of the speckle image group.
具体的,在该实施方式中,可以是,对于第二目标散斑图像组中的每个目标散斑图像而言,计算方式相同。对于任意一个目标散斑图像,确定n个精匹配模板组中对应该目标散斑图像的n个精匹配模板,即确定与该目标散斑图像对应相同基准散斑图案的n个精匹配模板。再分别计算该n个精匹配模板与该目标散斑图像的相似度,获得与该目标散斑图像相似度最高的精匹配模板。其中,计算目标散斑图像与精匹配模板之间的相似度时,可以使用前述单模板精匹配时描述的相似度计算方式,即采用比单模板粗匹配精度更高的相似度计算方法。Specifically, in this embodiment, the calculation method may be the same for each target speckle image in the second target speckle image group. For any target speckle image, determine n fine matching templates corresponding to the target speckle image in the n fine matching template groups, that is, determine n fine matching templates corresponding to the same reference speckle pattern of the target speckle image. The similarity between the n fine matching templates and the target speckle image is calculated separately, and the fine matching template with the highest similarity to the target speckle image is obtained. Wherein, when calculating the similarity between the target speckle image and the fine matching template, the similarity calculation method described in the single template fine matching can be used, that is, a similarity calculation method with higher accuracy than the single template rough matching is used.
第二目标散斑图像组中每个目标散斑图像对应一个相似度最高的精匹配模板,从而可以根据所述第二目标散斑图像组中i个目标散斑图像对应的i个相似度最高的精匹配模板,确定次级匹配模板组。Each target speckle image in the second target speckle image group corresponds to a fine matching template with the highest similarity, so that the i target speckle images corresponding to the i target speckle images in the second target speckle image group have the highest similarity The fine matching template is determined to determine the secondary matching template group.
具体的,在该实施方式中,可以将第二目标散斑图像组中各个目标散斑图像相似度最高的精匹配模板计算获取一个匹配模板,作为初级匹配模板组。Specifically, in this embodiment, a fine matching template with the highest similarity of each target speckle image in the second target speckle image group may be calculated to obtain a matching template as the primary matching template group.
可选的,根据所述第二目标散斑图像组中i个目标散斑图像对应的i个相似度最高的精匹配模板,确定次级匹配模板组,可以包括:获取i个相似度最高的精匹配模板分别对应的相似度系数,获得i个相似度系数。再获取该i个相似度系数中,表示相似度最高的相似度系数,以该表示相似度最高的相似度系数对应的精匹配模板作为次级匹配模板组。即该次级匹配模板组为一个精匹配模板,该精匹配模板与对应的目标散斑图像之间的相似度大于其他精匹配模板与对应的目标散斑图像之间的相似度。其中,在获取该i个相似度系数中表示相似度最高的相似度系数之前,可以先将该i个相似度系数做对位的乘法或加法或均值运算,以便更好的区分相似度。Optionally, determining the secondary matching template group according to the i precision matching templates corresponding to i target speckle images in the second target speckle image group with the highest similarity may include: obtaining i highest similarity templates The similarity coefficients corresponding to the finely matched templates respectively obtain i similarity coefficients. Then, among the i similarity coefficients, the similarity coefficient representing the highest similarity is obtained, and the fine matching template corresponding to the similarity coefficient representing the highest similarity is used as the secondary matching template group. That is, the secondary matching template group is a fine matching template, and the similarity between the fine matching template and the corresponding target speckle image is greater than the similarity between other fine matching templates and the corresponding target speckle image. Wherein, before obtaining the similarity coefficient representing the highest similarity among the i similarity coefficients, the i similarity coefficients may be first subjected to a bitwise multiplication, addition, or mean operation, so as to better distinguish the similarity.
可选的,根据所述第二目标散斑图像组中i个目标散斑图像对应的i个相似度最高的精匹配模板,确定次级匹配模板组,可以包括:确定i个相似度最高的精匹配模板分别对应的深度信息,获得i个深度信息。再计算该i个深度信息的平均值,获得平均深度信息。以该平均深度信息对应的精匹配模板作为所述次级匹配模板组。即该次级匹配模板组为一个精匹配模板。Optionally, determining the secondary matching template group according to the i highest similarity fine matching templates corresponding to i target speckle images in the second target speckle image group may include: determining i highest similarity templates The depth information corresponding to the template is precisely matched to obtain i depth information. Then calculate the average value of the i depth information to obtain the average depth information. The fine matching template corresponding to the average depth information is used as the secondary matching template group. That is, the secondary matching template group is a fine matching template.
步骤S240:根据所述次级匹配模板组的深度信息确定目标散斑图像的深度信息。Step S240: Determine the depth information of the target speckle image according to the depth information of the secondary matching template group.
每个次级模板组对应有深度信息,则可以确定的次级模板组的深度信息作为目标散斑图像的深度信息。Each secondary template group corresponds to depth information, and the determined depth information of the secondary template group can be used as the depth information of the target speckle image.
本申请实施例中,将k个不同的基准散斑图案投射到目标物体形成目标散斑图像组。先通过粗匹配模板组对该目标散斑图像组进行匹配,获得相似度最高的粗匹配模板组,定义为初级匹配模板组。再从相对于粗匹配模板组,彼此之间距离更近的精匹配模板组中选取初级匹配模板组前后预设范围内的精匹配模板组与目标散斑图像组进行匹配,获得与该目标散斑图像组相似度最高的精匹配模板组。根据该精匹配模板组确定目标散斑图像的深度信息,通过更小的计算量获得精确的图像深度信息。In the embodiment of the present application, k different reference speckle patterns are projected to the target object to form a target speckle image group. First, the target speckle image group is matched through the rough matching template group, and the rough matching template group with the highest similarity is obtained, which is defined as the primary matching template group. Then, from the fine matching template groups that are closer to each other than the coarse matching template group, the fine matching template group in the preset range before and after the primary matching template group is selected to match the target speckle image group, and the target speckle image group is obtained. The precise matching template group with the highest similarity of the spot image group. The depth information of the target speckle image is determined according to the fine matching template group, and accurate image depth information is obtained through a smaller calculation amount.
进一步的,由于目标物体可能并不是平面物体,如图2中目标物体所示,在不同位置离投影单元的距离不同,因此在目标散斑图像中的不同区域深度信息可能不同。在本申请实施例中,可以将目标散斑图像组分区域进行粗匹配以及精匹配,获取每个区域的深度信息,组合形成目标散斑图像的深度信息。也就是说,将目标散斑图像划分为多个区域,目标散斑图像组中相同位置的区域作为一个独立的匹配单位,按照前述实施例的方式进行粗匹配以及精匹配。Further, since the target object may not be a flat object, as shown in the target object in FIG. 2, the distance from the projection unit is different at different positions, so the depth information of different regions in the target speckle image may be different. In the embodiment of the present application, the component regions of the target speckle image may be subjected to coarse matching and fine matching to obtain the depth information of each region, and combine to form the depth information of the target speckle image. That is, the target speckle image is divided into multiple regions, and the region at the same position in the target speckle image group is used as an independent matching unit, and coarse matching and fine matching are performed in the manner of the foregoing embodiment.
具体的,可以将目标散斑图像组中的每个目标散斑图像按照相同的区域划分方式,划分为多个图像区域。再以所有目标散斑图像中同一位置的图像区域作为一个子目标散斑图像组,获得多个子目标散斑图像组。其中,同一位置的图像区域,表示各个图像区域在相应的目标散斑图像中的像素区域相同。例如,在某一目标散斑图像中,划分的某一图像区域为矩形,其左上角像素坐标为(x1,y1),右下角像素坐标为(x2,y2),则在其他目标散斑图像中,该图像区域相同位置的图像区域为:左上角像素坐标为(x1,y1)、右下角像素坐标为(x2,y2)的矩形区域。Specifically, each target speckle image in the target speckle image group may be divided into multiple image regions according to the same region division method. Then, the image area at the same position in all target speckle images is taken as a sub-target speckle image group to obtain multiple sub-target speckle image groups. Wherein, the image area at the same position means that the pixel area of each image area in the corresponding target speckle image is the same. For example, in a certain target speckle image, the divided image area is a rectangle, and its upper left corner pixel coordinates are (x1, y1), and the lower right corner pixel coordinates are (x2, y2), then in other target speckle images In the image area, the image area at the same position of the image area is a rectangular area with the upper left corner pixel coordinates (x1, y1) and the lower right corner pixel coordinates (x2, y2).
再将所有粗匹配模板组的所有粗匹配模板按照与目标散斑图像相同的划分方式划分为多个图像区域。即所有粗匹配模板以及目标散斑图像都可以找到大小相同、在图像中位置相同的区域。在一个粗匹配模板组中,各个粗匹配模板相同位置的图像区域作为一个子粗匹配模板组。Then, all rough matching templates in all rough matching template groups are divided into multiple image regions according to the same division method as the target speckle image. That is, all rough matching templates and target speckle images can find regions with the same size and the same position in the image. In a rough matching template group, the image area at the same position of each rough matching template is regarded as a sub rough matching template group.
将所有精匹配模板组的所有精匹配模板按照与目标散斑图像相同的划分方式划分为多个图像区域。即所有精匹配模板以及目标散斑图像都可以找到大小相同、在图像中位置相同的区域。在一个精匹配模板组中,各个精匹配模板相同位置的图像区域作为一个子精匹配模板组。All the fine matching templates of all fine matching template groups are divided into multiple image regions according to the same division method as the target speckle image. That is, all fine matching templates and target speckle images can find regions with the same size and the same position in the image. In a fine matching template group, the image area at the same position of each fine matching template is used as a sperm matching template group.
遍历目标散斑图像中的各个区域进行匹配,即将每个子目标散斑图像组进行粗匹配以及精匹配。其中,每个子目标散斑图像组与在图像中相同位置的子粗匹配模板组以及子精匹配模板组匹配,匹配过程参照前述实施例中目标散斑图像组的匹配过程。具体参照方式可以理解为,对于每个子目标散斑图像组,代入前述实施例中目标散斑图像组、与子目标散斑图像组相同位置的子粗匹配模板组代入前述实施例中的粗匹配模板组、与子目标散斑图像组相同位置的精匹配模板组代入前述实施例中的精匹配模板组进行匹配,获取到的深度信息为该子目标散斑图像组对应图像区域的深度信息。下面对该匹配过程进行简要描述,需要强调的是,分区域的匹配方式中,具体的匹配过程可以参照前述实施例。Traverse each area in the target speckle image for matching, that is, perform coarse matching and fine matching for each sub-target speckle image group. Wherein, each sub-target speckle image group is matched with the sub-rough matching template group and the sub-sperm matching template group at the same position in the image. The matching process refers to the matching process of the target speckle image group in the foregoing embodiment. The specific reference method can be understood as that for each sub-target speckle image group, the target speckle image group in the foregoing embodiment, and the sub-rough matching template group at the same position as the sub-target speckle image group in the foregoing embodiment are substituted into the coarse matching in the foregoing embodiment The template group and the fine matching template group at the same position as the sub-target speckle image group are substituted into the fine matching template group in the foregoing embodiment for matching, and the acquired depth information is the depth information of the image region corresponding to the sub-target speckle image group. The matching process will be briefly described below. It should be emphasized that, in the sub-region matching mode, the specific matching process can refer to the foregoing embodiment.
在一种实施方式中,可以是对于每一个子目标散斑图像组,先获取每个子目标散斑图像组相似度最高的子粗匹配模板组,再根据该子粗匹配模板组获取与该子目标散斑图像组相似度最高的子精匹配图像组。具体的,对于每一个子目标散斑图像组,匹配过程可以是:In an embodiment, for each sub-target speckle image group, first obtain the sub-rough matching template group with the highest similarity of each sub-target speckle image group, and then obtain the sub-rough matching template group according to the sub-rough matching template group. The sperm matching image group with the highest similarity of the target speckle image group. Specifically, for each sub-target speckle image group, the matching process can be:
将m个子粗匹配模板组分别与所述子目标散斑图像组的全部或者部分匹配,获取相似度最高的子粗匹配模板组,作为初级子匹配模板组;选取所述初级子匹配模板组前后预设范围内的子精匹配模板组, 分别与所述子目标散斑图像组中的全部或者部分匹配,获取相似度最高的子精匹配模板组,作为次级子匹配模板组;根据所述次级子匹配模板组的深度信息确定该子目标散斑图像组对应的图像区域的深度信息。Match the m sub-rough matching template groups with all or part of the sub-target speckle image group respectively, and obtain the sub-rough matching template group with the highest similarity as the primary sub-matching template group; before and after selecting the primary sub-matching template group The sperm matching template group within the preset range is matched with all or part of the sub-target speckle image group, and the sperm matching template group with the highest similarity is obtained as the secondary sub matching template group; The depth information of the secondary sub-matching template group determines the depth information of the image region corresponding to the sub-target speckle image group.
其中,定义每个粗匹配模板组的粗匹配模板数量为I,每个精匹配模板组的精匹配模板数量为i。将m个子粗匹配模板组分别与所述子目标散斑图像组的全部或者部分匹配,获取相似度最高的子粗匹配模板组,作为初级子匹配模板组可以包括:以所述子目标散斑图像组中对应粗匹配模板组的I个图像区域作为第一子目标散斑图像组,将所述m个子粗匹配模板组分别与所述第一子目标散斑图像组匹配,获取与所述第一子散斑图像组相似度最高的子粗匹配模板组,作为初级子匹配模板组。选取所述初级子匹配模板组前后预设范围内的子精匹配模板组,分别与所述子目标散斑图像组中的全部或者部分匹配,获取相似度最高的子精匹配模板组,作为次级子匹配模板组,包括:以所述子目标散斑图像组中对应精匹配模板组的i个图像区域作为第二子目标散斑图像组,选取所述初级子匹配模板组前后预设范围内的子精匹配模板组,分别与所述第二子目标散斑图像组匹配,获取与所述第二子目标散斑图像组相似度最高的子精匹配模板组,作为次级子匹配模板组。以次级子匹配模板组的深度信息作为该子目标散斑图像组对应的图像区域的深度信息。Among them, the number of rough matching templates in each rough matching template group is defined as I, and the number of fine matching templates in each fine matching template group is i. Matching the m sub-rough matching template groups with all or part of the sub-target speckle image group respectively, and obtaining the sub-rough matching template group with the highest similarity, as the primary sub-matching template group, may include: using the sub-target speckle I image regions corresponding to the rough matching template group in the image group are used as the first sub-target speckle image group, and the m sub-coarse matching template groups are matched with the first sub-target speckle image group respectively, and the The sub-rough matching template group with the highest similarity of the first sub-speckle image group is used as the primary sub-matching template group. Select the sperm matching template group within the preset range before and after the primary sub-matching template group, and respectively match all or part of the sub-target speckle image group, and obtain the sperm-sperm matching template group with the highest similarity as the secondary The first-level sub-matching template group includes: taking i image regions corresponding to the fine-matching template group in the sub-target speckle image group as the second sub-target speckle image group, and selecting a preset range before and after the primary sub-matching template group The sperm matching template group within is respectively matched with the second sub-target speckle image group, and the sperm matching template group with the highest similarity to the second sub-target speckle image group is obtained as the secondary sub-matching template group. The depth information of the secondary sub-matching template group is used as the depth information of the image region corresponding to the sub-target speckle image group.
由于所有目标散斑图像为基准散斑图案投射到同一目标物体所成图像,理论上所有目标散斑图像的深度信息相同,因此可以获得任意目标散斑图像中对应该子目标图像组的图像区域的深度信息。同理,可以获得任意目标散斑图像中其他图像区域的深度信息,从而获得目标散斑图像中各个区域的深度信息。Since all target speckle images are images formed by projecting the reference speckle pattern onto the same target object, theoretically all target speckle images have the same depth information, so the image area corresponding to the sub-target image group in any target speckle image can be obtained In-depth information. In the same way, the depth information of other image areas in any target speckle image can be obtained, so as to obtain the depth information of each area in the target speckle image.
在另一种实施方式中,可以先获取各个子目标散斑图像组相似度最高的子粗匹配模板组,将各个子目标散斑图像组对应的相似度最高的子粗匹配模板组合成一个粗匹配模板组。再根据该粗匹配模板组中各个子粗匹配模板组,选取子精匹配模板组,获取与各个子目标散斑图像组相似度最高的子精匹配图像组。匹配过程可以是:In another embodiment, the sub-rough matching template group with the highest similarity of each sub-target speckle image group may be obtained first, and the sub-rough matching templates with the highest similarity corresponding to each sub-target speckle image group can be combined into a rough Match template group. Then, according to the rough matching template groups in the rough matching template group, the sperm matching template group is selected, and the sperm matching image group with the highest similarity to each sub-target speckle image group is obtained. The matching process can be:
对于每一个子目标散斑图像组,将m个子粗匹配模板组分别与所述子目标散斑图像组的全部或者部分匹配,获取相似度最高的子粗匹配模板组,作为初级子匹配模板组。获得所有子目标散斑图像组相似度最高的子粗匹配模板组,合成初级匹配模板组。For each sub-target speckle image group, the m sub-rough matching template groups are respectively matched with all or part of the sub-target speckle image group, and the sub-rough matching template group with the highest similarity is obtained as the primary sub-matching template group . Obtain the sub-rough matching template group with the highest similarity of all sub-target speckle image groups, and synthesize the primary matching template group.
对于每一个子目标散斑图像组,确定对应相同位置的初级子匹配模板组,选取该初级子匹配模板组前后预设范围内的子精匹配模板组,分别与所述子目标散斑图像组中的全部或者部分匹配,获取相似度最高的子精匹配模板组,作为次级子匹配模板组;根据所述次级子匹配模板组的深度信息确定该子目标散斑图像组对应的图像区域的深度信息。For each sub-target speckle image group, determine the primary sub-matching template group corresponding to the same position, select the sub-prime sub-matching template group within a preset range before and after the primary sub-matching template group, respectively, and the sub-target speckle image group Match all or part of the sub-sperm matching template group with the highest similarity as the secondary sub-matching template group; determine the image area corresponding to the sub-target speckle image group according to the depth information of the secondary sub-matching template group In-depth information.
根据所有子目标散斑图像组获得目标散斑图像中所有图像区域的深度信息,从而获得目标散斑图像的深度信息。另外,还可以根据目标物体在目标散斑图像中的位置,确定目标物体的深度信息。Obtain the depth information of all image areas in the target speckle image according to all sub-target speckle image groups, thereby obtaining the depth information of the target speckle image. In addition, the depth information of the target object can also be determined according to the position of the target object in the target speckle image.
进一步的,在匹配过程中,可能匹配结果并不准确,所以需要进行修正。具体的,将相似度高于预设相似度的次级子匹配模板组作为有效的次级子匹配模板组,计算相应图像区域的深度信息;对相似度不大于预设相似度的次级子匹配模板组,作为无效的次级子匹配模板组,进行修正。Furthermore, during the matching process, the matching result may be inaccurate, so it needs to be corrected. Specifically, the secondary sub-matching template group whose similarity is higher than the preset similarity is taken as the effective secondary sub-matching template group, and the depth information of the corresponding image area is calculated; for the secondary sub-matching template whose similarity is not greater than the preset similarity The matching template group is regarded as an invalid secondary sub-matching template group for correction.
具体的,对于每个子精匹配模板组,若其与对应的次级子匹配模板组之间的相似度大于预设相似度β1,认为深度结果准确,以该子匹配模板组的深度信息作为该子目标散斑图像组对应的图像区域的深度信息;若该子精匹配模板组与对应的次级子匹配模板组之间的相似度小于或等于预设相似度β1,认为深度结果不够准确,暂时以该子匹配模板组的深度信息作为该子目标散斑图像组对应的图像区域的深度信息,但是需要进一步分类并估计,确定是否对该图像区域的深度信息进行更正。为了描述方便,命名该图像区域为目标图像区域。Specifically, for each sub-sperm matching template group, if the similarity between it and the corresponding secondary sub-matching template group is greater than the preset similarity β1, the depth result is considered to be accurate, and the depth information of the sub-matching template group is used as the The depth information of the image area corresponding to the sub-target speckle image group; if the similarity between the sub-sperm matching template group and the corresponding secondary sub-matching template group is less than or equal to the preset similarity β1, it is considered that the depth result is not accurate enough, Temporarily use the depth information of the sub-matching template group as the depth information of the image area corresponding to the sub-target speckle image group, but further classification and estimation are required to determine whether to correct the depth information of the image area. For the convenience of description, the image area is named the target image area.
具体的分类并估计的方式可以是,若该目标图像区域的8邻域内有相似度大于β1的图像区域,将相似度大于β1的图像区域的深度信息做平均,作为该目标图像区域的深度信息;若8邻域内没有相似度大于β1的图像区域,不修改该目标图像区域的深度信息。对一些基于相似度修正方式无法修正的问题,可以采用基于深度值修正方式,如可以是均值滤波、中值滤波等常见的图像处理手法。可以理解的,该8邻域可以是该目标图像区域相邻的8个图像区域。当然,本申请实施例中并不限定为8邻域,也可以是其他数量的邻域。The specific classification and estimation method can be, if there are image areas with similarity greater than β1 in the 8 neighborhoods of the target image area, the depth information of the image areas with similarity greater than β1 is averaged as the depth information of the target image area ; If there is no image area with similarity greater than β1 in the 8 neighborhood, the depth information of the target image area is not modified. For some problems that cannot be corrected based on the similarity correction method, the depth value correction method can be used, such as common image processing methods such as mean filtering and median filtering. It is understandable that the 8 neighborhoods may be 8 image areas adjacent to the target image area. Of course, the embodiment of the present application is not limited to 8 neighborhoods, and other numbers of neighborhoods may also be used.
本申请实施例通过一个具体的图像区域划分例子进行说明。The embodiment of the present application is described through a specific example of image area division.
如图9中虚线框104中的各个图像表示目标散斑图像组中的k个目标散斑图像,目标散斑图像的区域划分如图9虚线框104中各个方格所示,划分的多个图像区域在图像中的位置区间分别为A1,A2,A3至A24,如图10所示。图10示出了一种包括匹配模板以及目标散斑图像的区域划分方式实例。k个目标散斑图像的A1处图像区域形成一个子目标散斑图像组A1,k个目标散斑图像的A2处图像区域形成一个子目标散斑图像组A2,直至k个目标散斑图像的A24处图像区域形成一个子目标散斑图像组A24。如图9中对应虚线框104处示出了k个目标散斑图像的A6处图像区域形成的子目标散斑图像组A6。Each image in the dashed frame 104 in FIG. 9 represents k target speckle images in the target speckle image group. The area of the target speckle image is divided as shown by the squares in the dashed frame 104 in FIG. 9. The position intervals of the image area in the image are A1, A2, A3 to A24, as shown in Fig. 10. Fig. 10 shows an example of an area division method including a matching template and a target speckle image. The image area at A1 of k target speckle images forms a sub-target speckle image group A1, and the image area at A2 of k target speckle images forms a sub-target speckle image group A2, until the number of k target speckle images The image area at A24 forms a sub-target speckle image group A24. The sub-target speckle image group A6 formed by the image area A6 of the k target speckle images is shown at the corresponding dotted frame 104 in FIG. 9.
如图9的坐标系中各个图像表示各个匹配模板,对应空间轴S上同一个坐标点的匹配模板为一个组匹配模板。如图9及图10中各个匹配模板中的方格所示,将每个匹配模板按照与目标散斑图像相同的区域划分方式,划分为位置区间分别为A1,A2,A3至A24的24个图像区域。从而,每个粗匹配模板组中,A1处图像区域形成一个子粗匹配模板组A1,A2处图像区域形成一个子粗匹配模板组A2,直至A24处图像区域形成一个子粗匹配模板组A24。每个精匹配模板组中,A1处图像区域形成一个子精匹配模板组A1,A2处图像区域形成一个子精匹配模板组A2,直至A24处图像区域形成一个子精匹配模板组A24。图9中对应每个空间轴坐标点的体素,表示T1至Tk的A6处的图像区域形成的子匹配模板组。Each image in the coordinate system of FIG. 9 represents each matching template, and the matching template corresponding to the same coordinate point on the space axis S is a group matching template. As shown by the squares in each matching template in Figure 9 and Figure 10, each matching template is divided into 24 locations of A1, A2, A3 to A24 according to the same area division method as the target speckle image. Image area. Thus, in each rough matching template group, the image area at A1 forms a sub-rough matching template group A1, the image area at A2 forms a sub-rough matching template group A2, and the image area at A24 forms a sub-rough matching template group A24. In each fine matching template group, the image area at A1 forms a sperm matching template group A1, the image area at A2 forms a sperm matching template group A2, and the image area at A24 forms a sperm matching template group A24. The voxel corresponding to each spatial axis coordinate point in FIG. 9 represents the sub-matching template group formed by the image area at A6 from T1 to Tk.
对于每个子目标散斑图像组,与其进行匹配的粗匹配模板组为图像中相同位置的子粗匹配模板组,与其进行匹配的精匹配模板组为图像中相同位置的精匹配模板组。例如,与子目标散斑图像组A6匹配的是所有的子粗匹配模板组A6,获得与子目标散斑图像组A6最相近的初级子匹配模板组。再将子目标散斑图像组A6与初级子匹配模板组前后预设范围内的子精匹配模板组A6进行匹配,获取相似度最高的子精匹配模板组A6,作为次级子匹配模板组。以该次级子匹配模板组的深度信息作为该子目标散斑图像组A6的深度信息。具体匹配过程参见前述实施例中目标散斑图像组的匹配过程。For each sub-target speckle image group, the rough matching template group matched with it is the sub rough matching template group at the same position in the image, and the fine matching template group matched with it is the fine matching template group at the same position in the image. For example, all sub-coarse matching template groups A6 are matched with the sub-target speckle image group A6, and the primary sub-matching template group closest to the sub-target speckle image group A6 is obtained. Then the sub-target speckle image group A6 is matched with the sperm matching template group A6 in the preset range before and after the primary sub matching template group, and the sperm matching template group A6 with the highest similarity is obtained as the secondary sub matching template group. The depth information of the secondary sub-matching template group is used as the depth information of the sub-target speckle image group A6. For the specific matching process, refer to the matching process of the target speckle image group in the foregoing embodiment.
由于所有目标散斑图像为基准散斑图案投射到同一目标物体所成图像,理论上所有目标散斑图像的深度信息相同,因此可以获得目标散斑图像中A6处图像区域的深度信息。可以理解的,子目标散斑图像组A6、子粗匹配模板组A6以及子目标散斑图像组A6中的A6均为用于便于描述各个图像区域所在位置为A1。Since all target speckle images are images formed by projecting the reference speckle pattern onto the same target object, theoretically all target speckle images have the same depth information, so the depth information of the image area at A6 in the target speckle image can be obtained. It is understandable that the sub-target speckle image group A6, the sub-rough matching template group A6, and the sub-target speckle image group A6 are all used to describe the location of each image area as A1.
同理,可以获得目标散斑图像中其他区域处的图像区域的深度信息,从而获得目标散斑图像的深度信息。In the same way, the depth information of the image area at other areas in the target speckle image can be obtained, thereby obtaining the depth information of the target speckle image.
可选的,可以对每个目标散斑图像中图像区域的深度信息进行修正。以目标散斑图像中A6处图像区域为例,若子目标散斑图像组A6与相似度最高的次级子匹配模板组之间相似度大于β1,则以该次级子匹配模板组的深度信息作为目标散斑图像中A6处图像区域的深度信息;若子目标散斑图像组A6与相似度最高的次级子匹配模板组之间相似度不大于β1,则判断其8邻域的图像区域对应的相似度是否大于β1,即分别判断A1至A3、A5、A7以及A9-A11处,子目标散斑图像组与其对应的次级精匹配模板组之间相似度是否大于β1,即判断子目标散斑图像组A1与其对应的次级精匹配模板组之间相似度是否大于β1,判断子目标散斑图像组A2与其对应的次级精匹配模板组之间相似度是否大于β1等。将其中相似度大于β1的图像区域的深度信息求平均值,作为目标散斑图像中A6处图像区域的深度信息。Optionally, the depth information of the image area in each target speckle image can be corrected. Taking the image area at A6 in the target speckle image as an example, if the similarity between the sub-target speckle image group A6 and the secondary sub-matching template group with the highest similarity is greater than β1, then the depth information of the secondary sub-matching template group is used As the depth information of the image area at A6 in the target speckle image; if the similarity between the sub-target speckle image group A6 and the secondary sub-matching template group with the highest similarity is not greater than β1, it is judged that the image area of its 8 neighborhood corresponds to Whether the similarity of is greater than β1, that is, determine whether the similarity between the sub-target speckle image group and its corresponding secondary fine matching template group is greater than β1 at A1 to A3, A5, A7, and A9-A11, that is, determine the sub-target Whether the similarity between the speckle image group A1 and the corresponding secondary fine matching template group is greater than β1, and determining whether the similarity between the sub-target speckle image group A2 and the corresponding secondary fine matching template group is greater than β1, etc. The depth information of the image regions with similarity greater than β1 is averaged as the depth information of the image region A6 in the target speckle image.
在本申请实施例中,将目标散斑图像组进行分区域匹配,由于各个目标散斑图像的深度信息一致,以任意目标散斑图像组中任意一个目标散斑图像为用于表示深度信息的图像,获得该目标散斑图像中每个图像区域的深度信息。对于目标散斑图像中的目标物体,可以更精确地确定其在各个不同位置的深度信息,使该深度信息检测方法可以适用于平面或非平面的目标物体进行深度信息检测。In the embodiment of the present application, the target speckle image group is subjected to regional matching. Since the depth information of each target speckle image is the same, any target speckle image in any target speckle image group is used to represent the depth information. Image to obtain the depth information of each image area in the target speckle image. For the target object in the target speckle image, the depth information at each different position can be determined more accurately, so that the depth information detection method can be applied to planar or non-planar target objects for depth information detection.
本申请实施例还提供了一种深度信息检测装置400。请参见图11,该装置400包括:图像获取模块410,用于获取将k个不同的基准散斑图案投射到目标物体形成的目标散斑图像组;粗匹配模块420,用于将m个粗匹配模板组分别与所述目标散斑图像组的全部或者部分匹配,获取相似度最高的粗匹配模板组,作为初级匹配模板组,其中,每个匹配模板组对应各自的深度信息,每两个相邻的粗匹配模板组间隔为R,每两个相邻的粗匹配模板组之间包括精匹配模板组,每两个相邻的精匹配模板组间隔为r,R 大于r,同一个粗匹配模板组或同一个精匹配模版组均由所述k个不同的基准散斑图案的全部或者部分分别投射到同一位置的参考幕形成;精匹配模块430,用于选取所述初级匹配模板组前后预设范围内的精匹配模板组,分别与所述目标散斑图像组中的全部或者部分匹配,获取相似度最高的精匹配模板组,作为次级匹配模板组;深度信息确定模块440,用于根据所述次级匹配模板组的深度信息确定目标散斑图像的深度信息。The embodiment of the present application also provides a depth information detection device 400. Referring to FIG. 11, the device 400 includes: an image acquisition module 410, configured to acquire a target speckle image group formed by projecting k different reference speckle patterns to a target object; a coarse matching module 420, configured to combine m coarse speckle patterns The matching template group is matched with all or part of the target speckle image group, and the rough matching template group with the highest similarity is obtained as the primary matching template group, wherein each matching template group corresponds to its own depth information, and every two The interval between adjacent rough matching template groups is R, every two adjacent rough matching template groups includes a fine matching template group, and the interval between every two adjacent fine matching template groups is r, R is greater than r, and the same rough The matching template group or the same fine matching template group is formed by all or part of the k different reference speckle patterns projected to the same position of the reference screen; the fine matching module 430 is used to select the primary matching template group The fine matching template groups within the preset range before and after are respectively matched with all or part of the target speckle image group, and the fine matching template group with the highest similarity is obtained as the secondary matching template group; the depth information determining module 440, It is used to determine the depth information of the target speckle image according to the depth information of the secondary matching template group.
具体的,定义每个粗匹配模板组的粗匹配模板数量为I,每个精匹配模板组的精匹配模板数量为i。粗匹配模块420可以用于以所述目标散斑图像组中对应粗匹配模板组的I个目标散斑图像作为第一目标散斑图像组,将所述m个粗匹配模板组分别与所述第一目标散斑图像组匹配,获取与所述第一目标散斑图像组相似度最高的粗匹配模板组,作为初级匹配模板组。精匹配模块430可以用于:以所述目标散斑图像组中对应精匹配模板组的i个目标散斑图像作为第二目标散斑图像组,选取所述初级匹配模板组前后预设范围内的精匹配模板组,分别与所述第二目标散斑图像组匹配,获取与所述第二目标散斑图像组相似度最高的精匹配模板组,作为次级匹配模板组。Specifically, the number of coarse matching templates in each coarse matching template group is defined as I, and the number of fine matching templates in each fine matching template group is i. The rough matching module 420 may be configured to use 1 target speckle images corresponding to the rough matching template group in the target speckle image group as the first target speckle image group, and combine the m rough matching template groups with the The first target speckle image group is matched, and the rough matching template group with the highest similarity to the first target speckle image group is obtained as the primary matching template group. The fine matching module 430 may be configured to: use i target speckle images corresponding to the fine matching template group in the target speckle image group as the second target speckle image group, and select the primary matching template group before and after the preset range The fine matching template group of is respectively matched with the second target speckle image group, and the fine matching template group with the highest similarity to the second target speckle image group is obtained as a secondary matching template group.
其中,可以是I大于1且i等于1;或者是I大于1,i大于1;或者是I等于1,i大于1。Among them, it can be that I is greater than 1 and i is equal to 1, or I is greater than 1, and i is greater than 1, or I is equal to 1, and i is greater than 1.
可选的,当I大于1,粗匹配模块420可以用于以每个粗匹配模板组作为整体,以所述第一目标散斑图像组作为整体,计算每个粗匹配模板组与所述第一目标散斑图像组之间的相似度;将与所述第一目标散斑图像组相似度最高的粗匹配模板组,作为初级匹配模板组。Optionally, when I is greater than 1, the rough matching module 420 may be configured to take each rough matching template group as a whole, and the first target speckle image group as a whole, and calculate each rough matching template group and the first target speckle image group. The similarity between a target speckle image group; the rough matching template group with the highest similarity to the first target speckle image group is used as the primary matching template group.
可选的,当I大于1,粗匹配模块420可以用于对于所述第一目标散斑图像组中的每个目标散斑图像,确定所述m个粗匹配模板组中对应该目标散斑图像的m个粗匹配模板;分别计算该m个粗匹配模板与该目标散斑图像的相似度,获得与该目标散斑图像相似度最高的粗匹配模板;根据所述第一目标散斑图像组中I个目标散斑图像对应的I个相似度最高的粗匹配模板,确定初级匹配模板组。Optionally, when I is greater than 1, the coarse matching module 420 may be configured to determine, for each target speckle image in the first target speckle image group, that the m coarse matching template groups correspond to the target speckle M coarse matching templates of the image; respectively calculating the similarity between the m coarse matching templates and the target speckle image to obtain the coarse matching template with the highest similarity to the target speckle image; according to the first target speckle image One rough matching template with the highest similarity corresponding to one target speckle image in the group determines the primary matching template group.
可选的,当i大于1,精匹配模块430可以用于以选取的每个精匹配模板组作为整体,以所述第二目标散斑图像组作为整体,计算每个精匹配模板组与所述第一目标散斑图像组之间的相似度;将与所述第一目标散斑图像组相似度最高的精匹配模板组,作为次级匹配模板组。Optionally, when i is greater than 1, the fine matching module 430 may be configured to take each selected fine matching template group as a whole, and the second target speckle image group as a whole, and calculate each fine matching template group and all The similarity between the first target speckle image group; the fine matching template group with the highest similarity to the first target speckle image group is used as the secondary matching template group.
可选的,当i大于1,精匹配模块430可以用于对于所述第二目标散斑图像组中的每个目标散斑图像,确定所述n个精匹配模板组中对应该目标散斑图像的n个精匹配模板;分别计算该n个精匹配模板与该目标散斑图像的相似度,获得与该目标散斑图像相似度最高的精匹配模板;根据所述第二目标散斑图像组中i个目标散斑图像对应的i个相似度最高的精匹配模板,确定次级匹配模板组。Optionally, when i is greater than 1, the fine matching module 430 may be configured to determine, for each target speckle image in the second target speckle image group, that the n fine matching template groups correspond to the target speckle N fine matching templates of the image; respectively calculating the similarity between the n fine matching templates and the target speckle image to obtain the fine matching template with the highest similarity to the target speckle image; according to the second target speckle image The i precision matching templates with the highest similarity corresponding to i target speckle images in the group determine the secondary matching template group.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述装置和模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and conciseness of the description, the specific working process of the device and module described above can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
在本申请所提供的几个实施例中,模块相互之间的耦合可以是电性,机械或其它形式的耦合。In the several embodiments provided in this application, the coupling between the modules may be electrical, mechanical or other forms of coupling.
另外,在本申请各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module. The above-mentioned integrated modules can be implemented in the form of hardware or software functional modules.
请参考图12,其示出了本申请实施例提供的一种电子设备600的结构框图。该电子设备600可以是手机、平板电脑、电子书等能够进行深度信息识别的电子设备。该电子设备包括处理器610以及存储器620,所述存储器耦接到所述处理器,所述存储器存储指令,当所述指令由所述处理器执行时,所述处理器执行上述一个或多个实施例所描述的方法。Please refer to FIG. 12, which shows a structural block diagram of an electronic device 600 according to an embodiment of the present application. The electronic device 600 may be an electronic device capable of in-depth information recognition, such as a mobile phone, a tablet computer, or an e-book. The electronic device includes a processor 610 and a memory 620, the memory is coupled to the processor, and the memory stores instructions. When the instructions are executed by the processor, the processor executes one or more of the above The method described in the embodiment.
处理器610可以包括一个或者多个处理核。处理器610利用各种接口和线路连接整个电子设备600内的各个部分,通过运行或执行存储在存储器620内的指令、程序、代码集或指令集,以及调用存储在存储器620内的数据,执行电子设备600的各种功能和处理数据。可选地,处理器610可以采用数字信号处理(Digital Signal Processing,DSP)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)、可编程逻辑阵列(Programmable Logic Array,PLA)中的至少一种硬件形式来实现。处理器610可集成中央处理器(Central Processing Unit,CPU)、图像处理器(Graphics Processing Unit,GPU)和调制解调器等中的一种或几种的组合。其中,CPU主要处理操作系统、用户界面和应用程序等;GPU用于负责显示内容的渲染和绘制;调制解调器用于处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器610中,单独通过一块通信芯片进行实现。The processor 610 may include one or more processing cores. The processor 610 uses various interfaces and lines to connect various parts of the entire electronic device 600, and executes by running or executing instructions, programs, code sets, or instruction sets stored in the memory 620, and calling data stored in the memory 620. Various functions and processing data of the electronic device 600. Optionally, the processor 610 may use at least one of digital signal processing (Digital Signal Processing, DSP), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA), and Programmable Logic Array (Programmable Logic Array, PLA). A kind of hardware form to realize. The processor 610 may be integrated with one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), a modem, and the like. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is used for rendering and drawing of display content; the modem is used for processing wireless communication. It can be understood that the above-mentioned modem may not be integrated into the processor 610, but may be implemented by a communication chip alone.
存储器620可以包括随机存储器(Random Access Memory,RAM),也可以包括只读存储器(Read-Only Memory)。存储器620可用于存储指令、程序、代码、代码集或指令集,如用于实现本申请实施例提供的深度信息检测方法的指令或代码集。存储器620可包括存储程序区和存储 数据区,其中,存储程序区可存储用于实现操作系统的指令、用于实现至少一个功能的指令、用于实现上述各个方法实施例的指令等。存储数据区还可以电子设备在使用中所创建的数据(比如电话本、音视频数据、聊天记录数据)等。The memory 620 may include random access memory (RAM) or read-only memory (Read-Only Memory). The memory 620 may be used to store instructions, programs, codes, code sets or instruction sets, such as instructions or code sets used to implement the deep information detection method provided in the embodiments of the present application. The memory 620 may include a storage program area and a storage data area, where the storage program area may store instructions for implementing an operating system, instructions for implementing at least one function, instructions for implementing each of the foregoing method embodiments, and the like. The storage data area can also be data created by the electronic device in use (such as phone book, audio and video data, chat record data), etc.
可选的,该电子设备还可以包括投影单元用于投射基准散斑图案;包括图像采集单元,用于采集投影单元投射形成的图像。Optionally, the electronic device may further include a projection unit for projecting the reference speckle pattern; and an image acquisition unit for acquiring an image projected by the projection unit.
请参考图13,其示出了本申请实施例提供的一种计算机可读存储介质的结构框图。该计算机可读存储介质700中存储有程序代码,所述程序代码可被处理器调用执行上述方法实施例中所描述的方法。Please refer to FIG. 13, which shows a structural block diagram of a computer-readable storage medium provided by an embodiment of the present application. The computer-readable storage medium 700 stores program codes, and the program codes can be invoked by a processor to execute the methods described in the foregoing method embodiments.
计算机可读存储介质700可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。可选地,计算机可读存储介质700包括非易失性计算机可读介质(non-transitory computer-readable storage medium)。计算机可读存储介质700具有执行上述方法中的任何方法步骤的程序代码710的存储空间。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。程序代码710可以例如以适当形式进行压缩。The computer-readable storage medium 700 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 700 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 700 has a storage space for the program code 710 for executing any method steps in the above methods. These program codes can be read out from or written into one or more computer program products. The program code 710 may be compressed in a suitable form, for example.
最后应说明的是:以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不驱使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the application, not to limit them; although the application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: The technical solutions recorded in the foregoing embodiments are modified, or some of the technical features are equivalently replaced; these modifications or replacements do not drive the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims (20)

  1. 一种深度信息检测方法,其特征在于,所述方法包括:A depth information detection method, characterized in that the method includes:
    获取将k个不同的基准散斑图案投射到目标物体形成的目标散斑图像组;Acquiring a target speckle image group formed by projecting k different reference speckle patterns onto the target object;
    将m个粗匹配模板组分别与所述目标散斑图像组的全部或者部分匹配,获取相似度最高的粗匹配模板组,作为初级匹配模板组,其中,每个匹配模板组对应各自的深度信息,每两个相邻的粗匹配模板组间隔为R,每两个相邻的粗匹配模板组之间包括精匹配模板组,每两个相邻的精匹配模板组间隔为r,R大于r,同一个粗匹配模板组或同一个精匹配模版组均由所述k个不同的基准散斑图案的全部或者部分分别投射到同一位置的参考幕形成;Match the m rough matching template groups with all or part of the target speckle image group respectively, and obtain the rough matching template group with the highest similarity as the primary matching template group, wherein each matching template group corresponds to its own depth information , The interval between every two adjacent rough matching template groups is R, every two adjacent rough matching template groups includes a fine matching template group, and the interval between every two adjacent fine matching template groups is r, R is greater than r , The same rough matching template group or the same fine matching template group is formed by all or part of the k different reference speckle patterns respectively projected to the reference screen at the same position;
    选取所述初级匹配模板组前后预设范围内的精匹配模板组,分别与所述目标散斑图像组中的全部或者部分匹配,获取相似度最高的精匹配模板组,作为次级匹配模板组;Select the fine matching template group within the preset range before and after the primary matching template group, and respectively match all or part of the target speckle image group, and obtain the fine matching template group with the highest similarity as the secondary matching template group ;
    根据所述次级匹配模板组的深度信息确定目标散斑图像的深度信息。The depth information of the target speckle image is determined according to the depth information of the secondary matching template group.
  2. 根据权利要求1所述的方法,其特征在于,每个粗匹配模板组的粗匹配模板数量为I,每个精匹配模板组的精匹配模板数量为i,所述将m个粗匹配模板组分别与所述目标散斑图像组的全部或者部分匹配,获取相似度最高的粗匹配模板组,作为初级匹配模板组,包括:以所述目标散斑图像组中对应粗匹配模板组的I个目标散斑图像作为第一目标散斑图像组,将所述m个粗匹配模板组分别与所述第一目标散斑图像组匹配,获取与所述第一目标散斑图像组相似度最高的粗匹配模板组,作为初级匹配模板组;The method according to claim 1, wherein the number of coarse matching templates in each coarse matching template group is I, the number of fine matching templates in each fine matching template group is i, and the m coarse matching template groups are Respectively match all or part of the target speckle image group, and obtain the rough matching template group with the highest similarity as the primary matching template group, including: using one of the corresponding rough matching template groups in the target speckle image group The target speckle image is used as the first target speckle image group, the m coarse matching template groups are matched with the first target speckle image group respectively, and the one with the highest similarity to the first target speckle image group is obtained The rough matching template group is used as the primary matching template group;
    所述选取所述初级匹配模板组前后预设范围内的精匹配模板组,分别与所述目标散斑图像组中的全部或者部分匹配,获取相似度最高的精匹配模板组,作为次级匹配模板组,包括:以所述目标散斑图像组中对应精匹配模板组的i个目标散斑图像作为第二目标散斑图像组,选取所述初级匹配模板组前后预设范围内的精匹配模板组,分别与所述第二目标散斑图像组匹配,获取与所述第二目标散斑图像组相似度最高的精匹配模板组,作为次级匹配模板组。The selection of the fine matching template group within a preset range before and after the primary matching template group is matched with all or part of the target speckle image group, and the fine matching template group with the highest similarity is obtained as the secondary matching The template group includes: taking i target speckle images corresponding to the fine matching template group in the target speckle image group as the second target speckle image group, and selecting fine matching within a preset range before and after the primary matching template group The template groups are respectively matched with the second target speckle image group, and the fine matching template group with the highest similarity to the second target speckle image group is obtained as a secondary matching template group.
  3. 根据权利要求2所述的方法,其特征在于,I大于1,i等于1。The method according to claim 2, wherein I is greater than 1, and i is equal to 1.
  4. 根据权利要求2所述的方法,其特征在于,I大于1,i大于1。The method according to claim 2, wherein I is greater than 1, and i is greater than 1.
  5. 根据权利要求3或4所述的方法,其特征在于,所述将所述m个粗匹配模板组分别与所述第一目标散斑图像组匹配,获取与所述第一目标散斑图像组相似度最高的粗匹配模板组,作为初级匹配模板组,包括:The method according to claim 3 or 4, wherein the m rough matching template groups are respectively matched with the first target speckle image group to obtain the first target speckle image group The rough matching template group with the highest similarity, as the primary matching template group, includes:
    以每个粗匹配模板组作为整体,以所述第一目标散斑图像组作为整体,计算每个粗匹配模板组与所述第一目标散斑图像组之间的相似度;Taking each rough matching template group as a whole and taking the first target speckle image group as a whole, calculating the similarity between each rough matching template group and the first target speckle image group;
    将与所述第一目标散斑图像组相似度最高的粗匹配模板组,作为初级匹配模板组。The rough matching template group with the highest similarity to the first target speckle image group is used as the primary matching template group.
  6. 根据权利要求5所述的方法,其特征在于,所述以所述第一目标散斑图像组作为整体,计算每个粗匹配模板组与所述第一目标散斑图像组之间的相似度,包括:The method of claim 5, wherein the first target speckle image group is taken as a whole to calculate the similarity between each rough matching template group and the first target speckle image group ,include:
    以所述第一目标散斑图像组作为一个体素,以每个粗匹配模板组作为一个体素,将每个粗匹配模板组与所述第一目标散斑图像组进行三维计算,获取每个粗匹配模板组与所述第一目标散斑图像组之间的相似度,其中,所述三维计算包括:数值运算或逻辑运算。Taking the first target speckle image group as a voxel and each rough matching template group as a voxel, three-dimensional calculations are performed on each rough matching template group and the first target speckle image group to obtain each The similarity between a group of rough matching templates and the first target speckle image group, wherein the three-dimensional calculation includes: numerical operation or logical operation.
  7. 根据权利要求3或4所述的方法,其特征在于,所述将所述m个粗匹配模板组分别与所述第一目标散斑图像组匹配,获取与所述第一目标散斑图像组相似度最高的粗匹配模板组,作为初级匹配模板组,包括:The method according to claim 3 or 4, wherein the m rough matching template groups are respectively matched with the first target speckle image group to obtain the first target speckle image group The rough matching template group with the highest similarity, as the primary matching template group, includes:
    对于所述第一目标散斑图像组中的每个目标散斑图像,For each target speckle image in the first target speckle image group,
    确定所述m个粗匹配模板组中对应该目标散斑图像的m个粗匹配模板;Determining m coarse matching templates corresponding to the target speckle image in the m coarse matching template group;
    分别计算该m个粗匹配模板与该目标散斑图像的相似度,获得与该目标散斑图像相似度最高的粗匹配模板;Calculate the similarity between the m coarse matching templates and the target speckle image respectively, and obtain the coarse matching template with the highest similarity to the target speckle image;
    根据所述第一目标散斑图像组中I个目标散斑图像对应的I个相似度最高的粗匹配模板,确定初级匹配模板组。Determine the primary matching template group according to one rough matching template with the highest similarity corresponding to one target speckle image in the first target speckle image group.
  8. 根据权利要求7所述的方法,其特征在于,所述根据所述第一目标散斑图像组中I个目标散斑图像对应的I个相似度最高的粗匹配模板,确定初级匹配模板组,包括:获取I个相似度最高的粗匹配模板分别对应的相似度系数,获得I个相似度系数;The method according to claim 7, characterized in that, the primary matching template group is determined according to one rough matching template with the highest similarity corresponding to one target speckle image in the first target speckle image group, Including: obtaining the similarity coefficients corresponding to the rough matching templates with the highest similarity, and obtaining I similarity coefficients;
    获取该I个相似度系数中,以表示相似最高的相似度系数对应的粗匹配模板作为初级匹配模板组。Among the I similarity coefficients, the rough matching template corresponding to the similarity coefficient representing the highest similarity is used as the primary matching template group.
  9. 根据权利要求7所述的方法,其特征在于,所述根据所述第一目标散斑图像组中I个目标散斑图像对应的I个相似度最高的粗匹配模板,确定初级匹配模板组,包括:确定I个相似度最高的粗匹配模板分别对应的深度信息,获得I个深度信息;The method according to claim 7, characterized in that, the primary matching template group is determined according to one rough matching template with the highest similarity corresponding to one target speckle image in the first target speckle image group, Including: determining the depth information corresponding to each rough matching template with the highest similarity, and obtaining one depth information;
    计算所述I个深度信息的平均值,获得平均深度信息,以所述平均深度信息对应的匹配模板作为所 述初级匹配模板组。The average value of the I pieces of depth information is calculated to obtain the average depth information, and the matching template corresponding to the average depth information is used as the primary matching template group.
  10. 根据权利要求2所述的方法,其特征在于,I等于1,i大于1。The method according to claim 2, wherein I is equal to 1, and i is greater than 1.
  11. 根据权利要求4或10所述的方法,其特征在于,所述分别与所述第二目标散斑图像组匹配,获取与所述第二目标散斑图像组相似度最高的精匹配模板组,作为次级匹配模板组,包括:The method according to claim 4 or 10, wherein the matching with the second target speckle image group respectively to obtain the fine matching template group with the highest similarity to the second target speckle image group, As a secondary matching template group, it includes:
    以选取的每个精匹配模板组作为整体,以所述第二目标散斑图像组作为整体,计算每个精匹配模板组与所述第二目标散斑图像组之间的相似度;Taking each selected fine matching template group as a whole, and taking the second target speckle image group as a whole, calculating the similarity between each fine matching template group and the second target speckle image group;
    将与所述第二目标散斑图像组相似度最高的精匹配模板组,作为次级匹配模板组。The fine matching template group with the highest similarity to the second target speckle image group is used as the secondary matching template group.
  12. 根据权利要求11所述的方法,其特征在于,所述以选取的每个精匹配模板组作为整体,以所述第二目标散斑图像组作为整体,计算每个精匹配模板组与所述第二目标散斑图像组之间的相似度,包括:The method according to claim 11, wherein each selected fine matching template group is taken as a whole, and the second target speckle image group is taken as a whole, and each fine matching template group is calculated with respect to the The similarity between the second target speckle image group includes:
    以所述第二目标散斑图像组作为一个体素,以每个精匹配模板组作为一个体素,将每个精匹配模板组与所述第二目标散斑图像组进行三维计算,获取每个精匹配模板组与所述第二目标散斑图像组之间的相似度,其中,所述三维计算包括:互相关运算。Using the second target speckle image group as a voxel, and each fine matching template group as a voxel, perform three-dimensional calculations on each fine matching template group and the second target speckle image group to obtain each The similarity between a group of fine matching templates and the second target speckle image group, wherein the three-dimensional calculation includes: a cross-correlation operation.
  13. 根据权利要求6或12所述的方法,其特征在于,每个体素拆分为二维矩阵,或者拆分为一维序列进行计算。The method according to claim 6 or 12, wherein each voxel is split into a two-dimensional matrix, or split into a one-dimensional sequence for calculation.
  14. 根据权利要求4或10所述的方法,其特征在于,选取的精匹配模板组的数量为n,所述分别与所述第二目标散斑图像组匹配,获取与所述第二目标散斑图像组相似度最高的精匹配模板组,作为次级匹配模板组,包括:The method according to claim 4 or 10, wherein the number of selected fine matching template groups is n, and the matching is respectively matched with the second target speckle image group, and the second target speckle image group is obtained. The fine matching template group with the highest image group similarity, as the secondary matching template group, includes:
    对于所述第二目标散斑图像组中的每个目标散斑图像,For each target speckle image in the second target speckle image group,
    确定n个精匹配模板组中对应该目标散斑图像的n个精匹配模板;Determine n fine matching templates corresponding to the target speckle image in the n fine matching template groups;
    分别计算该n个精匹配模板与该目标散斑图像的相似度,获得与该目标散斑图像相似度最高的精匹配模板;Respectively calculating the similarity between the n fine matching templates and the target speckle image, and obtaining the fine matching template with the highest similarity to the target speckle image;
    根据所述第二目标散斑图像组中i个目标散斑图像对应的i个相似度最高的精匹配模板,确定次级匹配模板组。Determine the secondary matching template group according to the i precision matching templates with the highest similarity corresponding to the i target speckle images in the second target speckle image group.
  15. 根据权利要求14所述的方法,其特征在于,所述根据所述第二目标散斑图像组中i个目标散斑图像对应的i个相似度最高的精匹配模板,确定次级匹配模板组,包括:获取i个相似度最高的精匹配模板分别对应的相似度系数,获得i个相似度系数;The method according to claim 14, wherein the secondary matching template group is determined according to the i fine matching templates with the highest similarity corresponding to the i target speckle images in the second target speckle image group , Including: obtaining the similarity coefficients corresponding to the i precision matching templates with the highest similarity, and obtaining i similarity coefficients;
    在所述i个相似度系数中,以表示相似度最高的相似度系数对应的精匹配模板作为次级匹配模板组。Among the i similarity coefficients, the fine matching template corresponding to the similarity coefficient representing the highest similarity is used as the secondary matching template group.
  16. 根据权利要求14所述的方法,其特征在于,所述根据所述第二目标散斑图像组中i个目标散斑图像对应的i个相似度最高的精匹配模板,确定次级匹配模板组,包括:确定i个相似度最高的精匹配模板分别对应的深度信息,获得i个深度信息;The method according to claim 14, wherein the secondary matching template group is determined according to the i fine matching templates with the highest similarity corresponding to the i target speckle images in the second target speckle image group , Including: determining the depth information corresponding to the i precision matching templates with the highest similarity, and obtaining i depth information;
    计算所述i个深度信息的平均值,获得平均深度信息,以所述平均深度信息对应的精匹配模板作为所述次级匹配模板。Calculate the average value of the i pieces of depth information to obtain average depth information, and use the fine matching template corresponding to the average depth information as the secondary matching template.
  17. 根据权利要求1至16任一项所述的方法,其特征在于,R为r的正整数倍。The method according to any one of claims 1 to 16, wherein R is a positive integer multiple of r.
  18. 一种深度信息检测装置,其特征在于,所述装置包括:A depth information detection device, characterized in that the device includes:
    图像获取模块,用于获取将k个不同的基准散斑图案投射到目标物体形成的目标散斑图像组;An image acquisition module for acquiring a target speckle image group formed by projecting k different reference speckle patterns to the target object;
    粗匹配模块,用于将m个粗匹配模板组分别与所述目标散斑图像组的全部或者部分匹配,获取相似度最高的粗匹配模板组,作为初级匹配模板组,其中,每个匹配模板组对应各自的深度信息,每两个相邻的粗匹配模板组间隔为R,每两个相邻的粗匹配模板组之间包括精匹配模板组,每两个相邻的精匹配模板组间隔为r,R大于r,同一个粗匹配模板组或同一个精匹配模版组均由所述k个不同的基准散斑图案的全部或者部分分别投射到同一位置的参考幕形成;The rough matching module is used to match the m rough matching template groups with all or part of the target speckle image group respectively, and obtain the rough matching template group with the highest similarity as the primary matching template group, where each matching template The groups correspond to their respective depth information. The interval between every two adjacent rough matching template groups is R, every two adjacent rough matching template groups includes a fine matching template group, and every two adjacent fine matching template groups are separated R, R is greater than r, the same rough matching template group or the same fine matching template group is formed by all or part of the k different reference speckle patterns projected to the same position of the reference screen;
    精匹配模块,用于选取所述初级匹配模板组前后预设范围内的精匹配模板组,分别与所述目标散斑图像组中的全部或者部分匹配,获取相似度最高的精匹配模板组,作为次级匹配模板组;The fine matching module is used to select fine matching template groups within a preset range before and after the primary matching template group, and respectively match all or part of the target speckle image group, to obtain the fine matching template group with the highest similarity, As a secondary matching template group;
    深度信息确定模块,用于根据所述次级匹配模板组的深度信息确定目标散斑图像的深度信息。The depth information determining module is configured to determine the depth information of the target speckle image according to the depth information of the secondary matching template group.
  19. 一种电子设备,其特征在于,包括存储器以及处理器,所述存储器耦接到所述处理器,所述存储器存储指令,当所述指令由所述处理器执行时,所述处理器执行如权利要求1-17任一项所述的方法。An electronic device, comprising a memory and a processor, the memory is coupled to the processor, the memory stores instructions, and when the instructions are executed by the processor, the processor executes The method of any one of claims 1-17.
  20. 一种计算机可读取存储介质,其特征在于,所述计算机可读取存储介质中存储有程序代码,所述程序代码可被处理器调用执行如权利要求1-17任一项所述的方法。A computer readable storage medium, wherein the computer readable storage medium stores program code, and the program code can be called by a processor to execute the method according to any one of claims 1-17 .
PCT/CN2019/113434 2019-04-01 2019-10-25 Depth information detection method, apparatus and electronic device WO2020199562A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910258089.4A CN110009673B (en) 2019-04-01 2019-04-01 Depth information detection method and device and electronic equipment
CN201910258089.4 2019-04-01

Publications (1)

Publication Number Publication Date
WO2020199562A1 true WO2020199562A1 (en) 2020-10-08

Family

ID=67169204

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/113434 WO2020199562A1 (en) 2019-04-01 2019-10-25 Depth information detection method, apparatus and electronic device

Country Status (2)

Country Link
CN (1) CN110009673B (en)
WO (1) WO2020199562A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110009673B (en) * 2019-04-01 2020-04-21 四川深瑞视科技有限公司 Depth information detection method and device and electronic equipment
WO2021082018A1 (en) * 2019-11-01 2021-05-06 深圳市汇顶科技股份有限公司 Speckle pattern matching method, speckle pattern matching apparatus, electronic device, and storage medium
CN113168681A (en) * 2019-11-04 2021-07-23 深圳市汇顶科技股份有限公司 Speckle image matching method, device and storage medium
CN113379817B (en) * 2021-01-12 2022-11-04 四川深瑞视科技有限公司 Depth information acquisition method, device and system based on speckles
CN113158928B (en) * 2021-04-27 2023-09-19 浙江云奕科技有限公司 Concrete test block anti-counterfeiting method based on image recognition

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103279982A (en) * 2013-05-24 2013-09-04 中国科学院自动化研究所 Robust rapid high-depth-resolution speckle three-dimensional rebuilding method
CN104596439A (en) * 2015-01-07 2015-05-06 东南大学 Speckle matching and three-dimensional measuring method based on phase information aiding
US20170023358A1 (en) * 2015-04-21 2017-01-26 Kla-Tencor Corporation Metrology target design for tilted device designs
CN110009673A (en) * 2019-04-01 2019-07-12 四川深瑞视科技有限公司 Depth information detection method, device and electronic equipment

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2390792B (en) * 2002-07-08 2005-08-31 Vision Rt Ltd Image processing system for use with a patient positioning device
CN102445165B (en) * 2011-08-05 2013-10-16 南京航空航天大学 Stereo vision measurement method based on single-frame color coding grating
US20170064548A1 (en) * 2012-08-01 2017-03-02 Secunet Security Networks Aktiengesellschaft Method of and system for gaining secure access to a service
CN103561257B (en) * 2013-11-01 2015-05-13 北京航空航天大学 Interference-free light-encoded depth extraction method based on depth reference planes
TWI519884B (en) * 2014-01-23 2016-02-01 鈺創科技股份有限公司 Device for generating depth information, method for generating depth information, and stereo camera
CN103971405A (en) * 2014-05-06 2014-08-06 重庆大学 Method for three-dimensional reconstruction of laser speckle structured light and depth information
JP6432770B2 (en) * 2014-11-12 2018-12-05 ソニー株式会社 Image processing apparatus, image processing method, and program
US10445890B2 (en) * 2015-11-30 2019-10-15 Huawei Technologies Co., Ltd. Dual camera system and image processing method for eliminating an alignment vector of an occlusion area in an image alignment vector field
CN106504194B (en) * 2016-11-03 2019-06-21 重庆邮电大学 A kind of image split-joint method based on best splicing plane and local feature
CN107990846B (en) * 2017-11-03 2020-01-31 西安电子科技大学 Active and passive combination depth information acquisition method based on single-frame structured light
CN108734776B (en) * 2018-05-23 2022-03-25 四川川大智胜软件股份有限公司 Speckle-based three-dimensional face reconstruction method and equipment
CN109544618B (en) * 2018-10-30 2022-10-25 荣耀终端有限公司 Method for obtaining depth information and electronic equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103279982A (en) * 2013-05-24 2013-09-04 中国科学院自动化研究所 Robust rapid high-depth-resolution speckle three-dimensional rebuilding method
CN104596439A (en) * 2015-01-07 2015-05-06 东南大学 Speckle matching and three-dimensional measuring method based on phase information aiding
US20170023358A1 (en) * 2015-04-21 2017-01-26 Kla-Tencor Corporation Metrology target design for tilted device designs
CN110009673A (en) * 2019-04-01 2019-07-12 四川深瑞视科技有限公司 Depth information detection method, device and electronic equipment

Also Published As

Publication number Publication date
CN110009673B (en) 2020-04-21
CN110009673A (en) 2019-07-12

Similar Documents

Publication Publication Date Title
WO2020199563A1 (en) Method, device, and system for detecting depth information
WO2020199562A1 (en) Depth information detection method, apparatus and electronic device
US11302022B2 (en) Three-dimensional measurement system and three-dimensional measurement method
US8447099B2 (en) Forming 3D models using two images
US8452081B2 (en) Forming 3D models using multiple images
US10140726B2 (en) Apparatus and method for estimating gazed position of person
CN112669362B (en) Depth information acquisition method, device and system based on speckles
US11030763B1 (en) System and method for identifying items
US20150253863A1 (en) Image Processor Comprising Gesture Recognition System with Static Hand Pose Recognition Based on First and Second Sets of Features
US10853960B2 (en) Stereo matching method and apparatus
JP5951043B2 (en) Image measuring device
US9269018B2 (en) Stereo image processing using contours
US20160245641A1 (en) Projection transformations for depth estimation
TW202022802A (en) Method of identifying foreground object in image and electronic device using the same
CN111598065A (en) Depth image acquisition method, living body identification method, apparatus, circuit, and medium
CN113424194A (en) Detecting projected infrared patterns using gaussian differences and speckle recognition
JP2017199278A (en) Detection device, detection method, and program
JP2019120590A (en) Parallax value calculation device, parallax value calculation method and program
CN116051736A (en) Three-dimensional reconstruction method, device, edge equipment and storage medium
CN111524180B (en) Object volume calculation method, device, electronic equipment and storage medium
CN113379817B (en) Depth information acquisition method, device and system based on speckles
US20190394363A1 (en) Image Processing Method, Image Processing Apparatus, Electronic Device, and Computer Readable Storage Medium
JP6344903B2 (en) Image processing apparatus, control method therefor, imaging apparatus, and program
US20240054747A1 (en) Image processing apparatus, image processing method, and storage medium
JP7487266B2 (en) Image processing device, image processing method, and program

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: 19923639

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19923639

Country of ref document: EP

Kind code of ref document: A1