WO2021035627A1 - 获取深度图的方法、装置及计算机存储介质 - Google Patents

获取深度图的方法、装置及计算机存储介质 Download PDF

Info

Publication number
WO2021035627A1
WO2021035627A1 PCT/CN2019/103343 CN2019103343W WO2021035627A1 WO 2021035627 A1 WO2021035627 A1 WO 2021035627A1 CN 2019103343 W CN2019103343 W CN 2019103343W WO 2021035627 A1 WO2021035627 A1 WO 2021035627A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
target
main image
pixel
target pixel
Prior art date
Application number
PCT/CN2019/103343
Other languages
English (en)
French (fr)
Inventor
杨志华
马东东
梁家斌
Original Assignee
深圳市大疆创新科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市大疆创新科技有限公司 filed Critical 深圳市大疆创新科技有限公司
Priority to CN201980031872.5A priority Critical patent/CN112243518A/zh
Priority to PCT/CN2019/103343 priority patent/WO2021035627A1/zh
Publication of WO2021035627A1 publication Critical patent/WO2021035627A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/50Depth or shape recovery
    • G06T7/55Depth or shape recovery from multiple images
    • G06T7/593Depth or shape recovery from multiple images from stereo images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/80Geometric correction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/50Image enhancement or restoration using two or more images, e.g. averaging or subtraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10028Range image; Depth image; 3D point clouds
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20024Filtering details
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20212Image combination
    • G06T2207/20221Image fusion; Image merging
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2210/00Indexing scheme for image generation or computer graphics
    • G06T2210/61Scene description

Definitions

  • the embodiments of the present invention provide a method, a device, and a computer storage medium for obtaining a depth map, which can obtain a depth map of a main image, and has high processing efficiency and low hardware requirements.
  • a method for obtaining a depth map including:
  • the memory is used to store program code
  • Figure 3 is a schematic diagram of sampling and projecting.
  • Figure 4 is a schematic diagram of dynamic programming optimization in eight directions.
  • Fig. 6 is another schematic block diagram of an apparatus for acquiring a depth map according to an embodiment of the present invention.
  • FIG. 7 is another schematic block diagram of an apparatus for obtaining a depth map according to an embodiment of the present invention.
  • Dense match Traditional dense matching methods mainly include PMVS, PatchMatch MVS, SGM and SGBM.
  • the PMVS algorithm is mainly divided into three steps: initial feature matching, patch generation and patch filtering.
  • the first step is to extract the corner points, namely DOG (Difference of Gaussian) and Harris corner points, and obtain matching pairs through feature matching along the epipolar line with the known poses, and then triangulate the matching pairs to obtain encrypted sparse points, and then combine each sparse point Perform patching to generate a patch, filter to see the image of the sparse point, randomly give the normal vector and depth and optimize it, project the patch to the visible image, calculate the cost between the two, and finally mainly based on the matching
  • the number of visible images whose cost meets the threshold, deletes incorrect patches, iteratively generates patches and filters patches multiple times.
  • the PMVS algorithm has a large number of iterative steps, which requires a large number of images to be loaded at one time, which consumes a lot of memory, is difficult to implement in parallel, and requires rich image textures, and weak texture regions usually cannot calculate depth.
  • the PatchMatch MVS algorithm is a depth map calculation method. The idea is to first select a main image and several sub-images, then select a scanning direction, and transfer the depth and normal vector of the scanned area to the unscanned pixels, and Coupled with a certain random disturbance, and multiple random depths and normal vectors, homography is used to find the correspondence between the main image and the image patch of the secondary image, and the matching cost of the patch is calculated, leaving the depth and the smallest cost. Normal vector, scan in multiple directions to get the depth map.
  • the PatchMatch MVS method requires serial scanning and requires rich image texture, which is difficult to implement in parallel and weak texture areas are easily missing.
  • the SGM algorithm is a disparity map calculation method. Given two images that have been subjected to epipolar correction, an initial disparity map is randomized first, and the initial disparity map is used to calculate the mutual information cost map between the two images. The mutual information matching cost between a disparity is formed to form a matching cost cube. Multi-path dynamic programming is used to filter the cost cube to obtain a new disparity map. The pyramid idea is used to gradually iterate from the high-level low-resolution disparity map to the original Resolution, the disparity map of the original resolution is calculated.
  • the SGM algorithm has a strong assumption that it can converge and calculate the correct disparity map with multiple iterations, but in fact, the convergence is unknown for some situations where the foreground and the background are very different, and the algorithm is not robust enough.
  • the SGBM algorithm is a depth map estimation method that combines the planeSweeping algorithm and multi-path dynamic programming.
  • the idea is to select a main image and several sub-images to determine the approximate depth range of the main image.
  • Through a large number of samples in the inverse depth space suppose Come out enough forward parallel planes, project these parallel planes onto other sub-images by projection, and calculate the matching cost of the patch on the plane where each pixel is located and the patch on the sub-image to form a matching cost Cube, then uses multi-path dynamic programming to filter the cost, and finally calculates all the depths corresponding to the minimum cost as the final depth map.
  • the projection matching of each pixel in the SGBM algorithm is completely parallel, but the cost of the patch of each point is relatively large, so the algorithm is not efficient.
  • FIG. 1 is a schematic flowchart of a method for obtaining a depth map according to an embodiment of the present invention. The method shown in Figure 1 includes:
  • S110 Acquire a main image and a target sub-image.
  • the method shown in FIG. 1 can be used to obtain the depth map of the main image.
  • the main image and the target sub-image can be selected according to the required resolution of the depth map.
  • the resolution of the main image and the target sub-image (collectively referred to as the original image) can be higher than the required depth
  • the resolution of the picture is at least doubled.
  • S110 may include acquiring a main image and at least one sub-image corresponding to the main image.
  • the main image may be acquired first, and then at least one sub-image corresponding to the main image is selected.
  • multiple frames of candidate sub-images may be obtained; the target sub-image that meets a preset requirement is selected from the multiple frames of candidate sub-images.
  • the multi-frame candidate sub-images may be images of adjacent frames to the main image, or the multi-frame candidate sub-images may be images of the same scene as the main image taken at other times, or the multi-frame candidate sub-images may also be It may be other images, and the present invention is not limited to this.
  • At least one secondary image can be selected according to the position and posture information of the main image.
  • At least one secondary image may be selected according to the depth range information of the main image and/or the sparse point information of the main image.
  • the multiple-frame candidate secondary image may include multiple-frame images that are closer to the main image, where the distance between the two images may be calculated according to the feature vectors of the two images, for example, two Dot product between eigenvectors.
  • the preset requirement may be that the area of the circumscribed area of the sparse point is greater than the preset area. That is to say, when selecting the target sub-image, some virtual three-dimensional points can be randomly selected, and then the three-dimensional points can be projected onto multiple frames of candidate sub-images, and the target sub-images are selected according to the order of the area size of the circumscribed area of the sparse points.
  • the preset requirement may be that the included angle between the optical axis and the optical axis of the main image is smaller than the preset angle range. That is to say, when selecting the target sub-image, the angle between the optical axis of the main image and the optical axis of each frame of candidate sub-images can be determined; the candidate corresponding to the angle within the preset angle range is determined
  • the secondary image is determined as the target secondary image. That is to say, if the angle between the optical axis of a certain frame of candidate sub-image and the optical axis of the main image is within the preset angle range, then the certain frame of candidate sub-image is taken as the target sub-image (or as the target sub-image).
  • One of the secondary images may be that the included angle between the optical axis and the optical axis of the main image is smaller than the preset angle range. That is to say, when selecting the target sub-image, the angle between the optical axis of the main image and the optical axis of each frame of candidate sub-images
  • the depth range can be the uniform depth range of the whole image or the image is divided into several sub-image blocks, each image block has an independent depth range; among them, the strong structure can include the intersection angle close to 30 degrees and sparse points The larger the area occupied, the intersection angle is the intersection angle formed by the sparse point and the image optical center.
  • the target sub-image that is closer to the main image can be obtained, so that the obtained depth map of the main image is more accurate.
  • the embodiment of the present invention may also adopt other methods to select the target secondary image, which is not limited in the present invention.
  • S120 Perform epipolar correction on the main image and the target sub-image to obtain a first corrected image corresponding to the main image and a second corrected image corresponding to the target sub-image.
  • the epipolar correction mainly needs to solve the two matrices of the first homography transformation matrix and the second homography transformation matrix, or expressed as H1 matrix and H2 matrix (collectively referred to as H matrix).
  • H matrix H1 matrix and H2 matrix
  • the position of the optical center of the image can be kept fixed, the baseline direction is taken as the x direction, and the normal direction between the optical center direction of the left picture and the plane where the baseline is located is taken as the y direction.
  • the z direction rotate the posture of the two images to the defined coordinate system.
  • the image block corresponding to the target pixel in the main image in the first corrected image may be determined in S130.
  • the main image can be collected according to a preset sampling rule to obtain the target pixel.
  • an image block composed of k1 ⁇ k2 pixels where the first position is located may be determined as the first image block.
  • k1 and k2 are positive integers greater than or equal to 2, and the two can be equal or unequal.
  • k1 k2.
  • an image block composed of 3 ⁇ 3 pixels centered on the pixel at the first position is determined as the first image block. It should be understood that the embodiment of the present invention does not limit the shape or size of the first image block.
  • the image block corresponding to the pixel in the target sub-image in the second corrected image may be determined in S130.
  • the pixel points in the target sub-image may include multiple pixels, which may be all the pixels in the target sub-image, or may be part of the pixels in the target sub-image.
  • the image block corresponding to each pixel can be obtained.
  • the pixel in the target secondary image is the second pixel
  • the image block in the corresponding second corrected image is the second image block
  • the second homography transformation matrix H2 it is possible to determine which pixel in the second corrected image the second pixel is mapped to, that is, to obtain the second position in the second corrected image to which the second pixel is mapped, and then Obtain the second image block where the second position is located.
  • the image block formed by the second position and multiple pixels around it may be determined as the second image block.
  • an image block composed of a pixel at the second position and a plurality of pixels surrounding it may be determined as the second image block.
  • the image block centered at the second position may be determined as the second image block.
  • an image block corresponding to each target pixel in the first corrected image can be obtained.
  • an image block corresponding to each pixel in the second corrected image can be obtained.
  • the process of S130 may be executed for the main image and any target sub-image, and details are not described herein again.
  • S140 Determine the characteristic information of the target pixel in the main image according to the image block in the first corrected image corresponding to the target pixel in the main image, and determine the characteristic information of the target pixel in the main image according to the difference between the target pixel in the second corrected image and the target pixel.
  • the image block corresponding to the pixel in the secondary image determines the characteristic information of the pixel in the target secondary image.
  • the feature information of the target pixel in the main image may be determined according to the image block corresponding to the target pixel in the first corrected image in the main image.
  • the multiple mapped pixels are m mapped pixels.
  • the gray value of each mapped pixel of the m mapped pixels can be obtained; the gray value of the other m-1 mapped pixels except the first pixel among the m mapped pixels is compared with the gray value of the first pixel Compare; and get the descriptor of the first pixel based on the result of the comparison.
  • the descriptor may be in the form of a binary string.
  • the gray value of a mapped pixel in the m-1 mapped pixels is smaller than the gray value of the first pixel, then this mapped pixel is marked as 1; if the other of the m-1 mapped pixels The gray value of the mapped pixel is greater than or equal to the gray value of the first pixel, then the other mapped pixel is marked as 0.
  • the label values of the m-1 mapped pixels are sequentially connected into a binary string as the descriptor of the first pixel.
  • the descriptor of the first pixel is a character string composed of m-1 binary characters.
  • the embodiment of the present invention may also use other methods to calculate the descriptor, and the descriptor may also be expressed in other forms, which will not be listed here.
  • the method of calculating the feature information of the pixel in the target sub-image is similar to the method of calculating the feature information of the target pixel in the main image.
  • the obtained feature information of the pixels in the target sub-image and the feature information of the target pixels in the main image may have the same dimensions, for example, both are character strings composed of m-1 binary characters.
  • the matching cost of the target pixel in the main image can be obtained according to the Hamming distance between the characteristic information of the target pixel in the main image and the characteristic information of the pixel in the target sub-image. Then, the depth map corresponding to the main image is determined based on the matching cost of multiple target pixels in the main image.
  • S1502 Project an object point corresponding to each target pixel point in the main image to the target sub-image according to the multiple candidate depth indication parameters, so as to determine and A plurality of projected pixels that match the target pixel in the main image;
  • the target pixels of the main image can be sampled, and the sampled object points can be projected onto each frame of the target sub-image, so that the projected pixel points are correspondingly obtained on each frame of the target image (as shown in Figure 3). Shown).
  • the matching cost obtained based on the feature information of the target pixel and the feature information of these projected pixels is used as a matching cost set.
  • multiple matching cost sets can be similarly obtained.
  • the method for calculating the matching cost can be as described above, and will not be repeated here.
  • filtering processing may be performed on multiple matching cost combinations according to a preset direction.
  • the feature information calculation module 540 may be specifically configured to: determine the mapped pixels of the pixel in the image block corresponding to the target pixel in the main image in the main image Point, and compare the color information of the mapped pixel point in the main image with the color information of the target pixel point in the main image to obtain the characteristic information of the target pixel point in the main image;
  • the pixels in the image block corresponding to the pixels in the target sub-image are mapped pixels in the target sub-image image, and the color information of the mapped pixels in the target sub-image is compared with the target sub-image
  • the color information of the pixels in the target sub-image is compared to obtain the characteristic information of the pixels in the target sub-image.
  • the target sub-image includes multiple frames of target sub-images
  • the projection unit 5502 may be specifically configured to: according to the multiple candidate depth indication parameters, the target in the main image The object point corresponding to the pixel point is projected onto each frame of the target sub-image, so as to determine a plurality of projection pixel points matching the target pixel point in the main image among the pixel points in each frame of the target sub-image.
  • the matching cost calculation unit 5503 may be specifically configured to: according to the characteristic information of each target pixel in the main image and how many target pixels in each frame of target sub-images match each target pixel in the main image.
  • the device may further include a sampling module configured to sample the main image according to a preset sampling rule to obtain target pixels of the main image.
  • a sampling module configured to sample the main image according to a preset sampling rule to obtain target pixels of the main image.
  • the depth determining unit 5504 may include:
  • the filtering unit may be specifically configured to perform filtering processing on multiple matching cost combinations of the target pixel in the main image according to a preset direction.
  • an embodiment of the present invention also provides an apparatus 70 for obtaining a depth map.
  • the device 70 includes a processor 710 and a memory 720.
  • Computer instructions are stored in the memory 720.
  • the processor 710 executes the computer instructions, the processor 710 executes the following steps: acquiring a main image and a target sub-image; performing epipolar lines on the main image and the target sub-image Rectify to obtain a first corrected image corresponding to the main image and a second corrected image corresponding to the target secondary image; determine the image block in the first corrected image corresponding to the target pixel in the main image And the image block in the second corrected image that corresponds to the pixel in the target sub-image; the main image is determined according to the image block in the first corrected image that corresponds to the target pixel in the main image
  • the feature information of the target pixel in the target sub-image is determined according to the image block in the second corrected image corresponding to the pixel in the target sub-image; the feature information of the pixel in the target sub-image is
  • the processor 710 may be specifically configured to: determine a pixel point in the first corrected image that matches a target pixel point in the main image, and determine according to the matched pixel point The image block in the first corrected image corresponding to the target pixel in the main image; the pixel in the second corrected image that matches the pixel in the target sub-image is determined, and according to the matching The pixel points in the second corrected image determine the image block corresponding to the pixel points in the target secondary image in the second corrected image.
  • the processor 710 may be specifically configured to: obtain a plurality of candidate depth indication parameters; according to the plurality of candidate depth indication parameters, calculate the object corresponding to each target pixel in the main image; The square points are projected onto the target sub-image to determine a plurality of projected pixel points matching the target pixel in the main image among the pixel points in the target sub-image; according to the target pixel in the main image Point feature information and feature information of multiple projection pixels matching the target pixel in the main image, determine multiple matching costs of the target pixel in the main image; according to the target in the main image The multiple matching costs of pixels are used to determine the depth corresponding to the target pixel in the main image from the multiple candidate depth indication parameters.
  • the processor 710 may be further configured to: obtain the range of the depth indication parameter corresponding to the main image. Therefore, the processor 710 may be configured to: perform sampling within the range of the depth indication parameter to obtain the multiple candidate depth indication parameters.
  • the processor 710 may be specifically configured to: determine the smallest matching cost from multiple matching costs of the target pixel in the main image; and assign the smallest matching cost to the candidate
  • the depth indication parameter is determined as the depth corresponding to the target pixel in the main image.
  • the depth indication parameter includes depth or inverse depth.
  • the target sub-image includes multiple frames of target sub-images
  • the processor 710 may be specifically configured to: calculate the target pixel in the main image according to the multiple candidate depth indication parameters The corresponding object point is projected to each frame of the target sub-image to determine a plurality of projection pixel points matching the target pixel in the main image among the pixel points in the target sub-image of each frame.
  • the processor 710 may also be specifically configured to: according to the characteristic information of each target pixel in the main image and a plurality of projection pixels matching each target pixel in the main image in each frame of the target sub-image The feature information of the point determines multiple matching cost sets for each target pixel in the main image, where each matching cost set corresponds to a candidate depth indicator parameter; for each of the multiple matching cost sets The matching costs of are merged to obtain the multiple matching costs.
  • the processor 710 may be further configured to sample the main image according to a preset sampling rule to obtain target pixels of the main image.
  • the processor 710 may be specifically configured to: obtain a multi-frame candidate sub-image; select the target sub-image that meets a preset requirement from the multi-frame candidate sub-images.
  • the processor 710 may be specifically configured to: determine the angle between the optical axis of the main image and the optical axis of each frame of candidate sub-image; The candidate secondary image corresponding to the included angle is determined as the target secondary image.
  • the processor 710 may be specifically configured to: perform filtering processing on multiple matching cost combinations of target pixels in the main image; The multiple matching cost combinations of pixels determine the depth corresponding to the target pixel in the main image from the multiple candidate depth indication parameters.
  • the processor 710 may be specifically configured to perform filtering processing on multiple matching cost combinations of the target pixel in the main image according to a preset direction.
  • the device 50 shown in FIG. 5 or FIG. 6 and the device 70 shown in FIG. 7 can implement the steps of the method for acquiring the depth map described above, and in order to avoid repetition, details are not repeated here.
  • An embodiment of the present invention also provides a movable platform, including: a photographing device for outputting the main image and the target secondary image, and a device for acquiring a depth map as described in any one of Figs. 5-7.
  • An embodiment of the present invention also provides a computer storage medium on which a computer program is stored.
  • the computer program executes the method for obtaining a depth map provided in the above method embodiment.
  • the embodiment of the present invention also provides a computer program product containing instructions, which when executed by a computer causes the computer to execute the method for obtaining a depth map provided in the above method embodiments.
  • the feature information of the image is obtained through epipolar correction, and then the depth map of the main image can be obtained.
  • This method can be executed in parallel, thereby improving processing efficiency and shortening processing time.
  • the computational complexity of this method is low, which reduces the demand for hardware.
  • the use of polar correction has a faster speed and shortens the calculation time.
  • cost calculation can be performed, and dynamic programming can optionally be used for optimization, which has higher stability, especially for weak texture images.
  • the computer may be implemented in whole or in part by software, hardware, firmware or any other combination.
  • software it can be implemented in the form of a computer program product in whole or in part.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • the computer instructions may be transmitted from a website, computer, server, or data center.
  • the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or a data center integrated with one or more available media.
  • the usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a digital video disc (DVD)), or a semiconductor medium (for example, a solid state disk (SSD)), etc.
  • the disclosed system, device, and method may be implemented in other ways.
  • the device embodiments described above are merely illustrative, for example, the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or It can be integrated into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • each functional unit in each embodiment of the present application may be integrated in a processor, or each unit may exist alone physically, or two or more units may be integrated in one unit.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Computer Graphics (AREA)
  • Geometry (AREA)
  • Software Systems (AREA)
  • Image Processing (AREA)

Abstract

一种获取深度图的方法、装置及计算机存储介质。获取深度图的方法,包括:获取主图像和目标副图像(S110);通过极线矫正得到分别与主图像和目标副图像对应的第一校正图像和第二校正图像(S120);分别确定在第一校正图像和第二校正图像中的对应图像块(S130);确定对应图像块的映射像素点的特征信息(S140);根据像素点的特征信息确定主图像的深度图(S150)。由此可见,通过极线矫正得到图像的特征信息,进而能够得到主图像的深度图,该方法能够并行执行,从而能够提高处理效率,缩短处理时间。另外,该方法的计算复杂度低,降低了对硬件的需求。

Description

获取深度图的方法、装置及计算机存储介质 技术领域
本发明实施例涉及图像处理领域,并且更具体地,涉及一种获取深度图的方法、装置及计算机存储介质。
背景技术
随着镜头和电荷耦合元件(CCD)技术的发展,采集的图像变得越来越大,包含的信息也越来越丰富,用图像来做即时定位与地图构建(simultaneous localization and mapping,SLAM)或者三维重建成为研究的热点,而此前提是确定图像的深度图。
然而目前SLAM地图由稀疏或者半稠密的点组成,能提供的信息有限,无法快速输出一个稠密、可靠、可复用的地图产品,离线三维重建时需要进行大量的多视图像之间的稠密匹配,该步骤需要耗费大量的时间和计算资源,三维重建的效率较低,对硬件的要求很高。
因此,亟需一种能够快速准确地得到深度图的方法。
发明内容
本发明实施例提供了一种获取深度图的方法、装置及计算机存储介质,能够得到主图像的深度图,且处理效率高,对硬件要求不高。
第一方面,提供了一种获取深度图的方法,包括:
获取主图像和目标副图像;
对所述主图像和所述目标副图像进行极线矫正以获取与所述主图像对应的第一校正图像和与所述目标副图像对应的第二校正图像;
确定所述第一校正图像中与所述主图像中的目标像素点对应的图像块和所述第二校正图像中与所述目标副图像中的像素点对应的图像块;
根据所述第一校正图像中与所述主图像中的目标像素点对应的图像块确定所述主图像中的目标像素点的特征信息,根据所述第二校正图像中与所述目标副图像中的像素点对应的图像块确定所述目标副图像中的像素点的特征信 息;
根据所述主图像中的目标像素点的特征信息和所述目标副图像中的像素点的特征信息确定所述主图像对应的深度图。
第二方面,提供了一种获取深度图的装置,包括:存储器和处理器,其中,
所述存储器,用于存储程序代码;
所述处理器,用于调用所述程序代码,当所述程序代码被执行时,用于执行以下操作:
获取主图像和目标副图像;
对所述主图像和所述目标副图像进行极线矫正以获取与所述主图像对应的第一校正图像和与所述目标副图像对应的第二校正图像;
确定所述第一校正图像中与所述主图像中的目标像素点对应的图像块和所述第二校正图像中与所述目标副图像中的像素点对应的图像块;
根据所述第一校正图像中与所述主图像中的目标像素点对应的图像块确定所述主图像中的目标像素点的特征信息,根据所述第二校正图像中与所述目标副图像中的像素点对应的图像块确定所述目标副图像中的像素点的特征信息;
根据所述主图像中的目标像素点的特征信息和所述目标副图像中的像素点的特征信息确定所述主图像对应的深度图。
第三方面,提供了一种可移动平台,包括:用于输出所述主图像和目标副图像的拍摄装置和第二方面所述的获取深度图的装置。
第四方面,提供了一种计算机存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现前述第一方面或其任一实现方式所述的获取深度图的方法的步骤。
由此可见,本发明实施例中通过极线矫正得到图像的特征信息,进而能够得到主图像的深度图,该方法能够并行执行,从而能够提高处理效率,缩短处理时间。另外,该方法的计算复杂度低,降低了对硬件的需求。其中,采用极线矫正具有更快的速度,缩短了计算时间。其中,在得到深度图时,可以进行代价计算,并且可选地可以采用动态规划进行优化,具有更高的稳定性,尤其地对弱纹理图像更加稳健。
附图说明
为了更清楚地说明本发明实施例的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1是本发明实施例的获取深度图的方法的一个示意性流程图。
图2是本发明实施例的获取深度图的方法的另一个示意性流程图。
图3是对进行采样并投影的一个示意图。
图4是8个方向的动态规划优化的一个示意图。
图5是本发明实施例的获取深度图的装置的一个示意性框图。
图6是本发明实施例的获取深度图的装置的另一个示意性框图。
图7是本发明实施例的获取深度图的装置的又一个示意性框图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动的前提下所获得的所有其他实施例,都属于本发明保护的范围。
应用于已经进行了矫正的图像或者是未矫正但已知位姿(Pose)的多张图像,计算主图像上任意像素的深度使得主图像和参考图像的匹配代价最低,这类图像匹配方法叫做稠密匹配。传统的稠密匹配方法主要有PMVS,PatchMatch MVS,SGM和SGBM四种。
PMVS算法主要分为初始化特征匹配、生成面片和面片过滤三步。首先是提取角点,即DOG(Difference of Gaussian)和Harris角点,通过已知位姿沿着极线方向特征匹配得到匹配对,三角化匹配对得到加密的稀疏点,然后将每个稀疏点进行面片化生成面片,筛选可以看到该稀疏点的图像,随机给法向量和深度并对其优化,投影面片到可视图像上,计算两两之间的代价,最后主要根据匹配代价满足阈值的可视图像的个数,删除掉不正确的面片,迭代生成面片和过滤面片多次。PMVS算法存在大量的迭代步骤,需要一次加载大量的图像,内存消耗较大,较难并行实现,且要求图像纹理丰富,弱纹理区域通常无 法计算深度。
PatchMatch MVS算法是一种深度图计算方法,其思想是先选取一张主图像和若干张副图像,然后选取一个扫描方向,传递已经扫描过的区域的深度和法向量到未扫描的像素,并且加上一定的随机扰动,以及随机多个深度和法向量,采用单应性变换找到主图像和副图像的图像块(patch)的对应关系,计算patch的匹配代价,留下代价最小的深度和法向量,多个方向扫描即可得到深度图。PatchMatch MVS的方法需要串行的扫描以及要求图像纹理丰富,较难并行实现且弱纹理区域容易缺失。
SGM算法是一种视差图计算方法,给定两张已经做完极线矫正的图像,首先随机一个初始的视差图,有初始视差图统计出两张图像之间的互信息代价图,计算任一个视差之间的互信息匹配代价,形成匹配代价立方体,采用多路径动态规划对代价立方体进行滤波,解得新的视差图,采用金字塔思想,由高层级低分辨率的视差图逐步迭代到原分辨率,计算得到原分辨率的视差图。SGM算法有个强假设,认为只要多次迭代就能收敛计算出正确的视差图,但实际上对于一些前景后景差异较大的情况收敛性是未知的,算法不够鲁棒。
SGBM算法是一种结合planeSweeping算法和多路径动态规划深度图估计方法,其思想是先选取一张主图像和若干张副图像,确定主图像的大致深度范围,通过逆深度空间的大量采样,假设出来足够多的前向平行平面,通过投影的方法将这些平行平面投影到其他副图像上,通过计算每个像素点所在的平面的patch和副图像上的patch的匹配代价,形成一个匹配代价的立方体,然后采用多路径的动态规划对代价进行滤波,最后计算所有最小代价对应的深度作为最终的深度图。SGBM算法中每个像素的投影匹配是完全并行的,但是每个点的patch的代价计算量较大,因此算法效率不高。
本发明实施例提供了一种获取深度图的方法,如图1是本发明一个实施例的获取深度图的方法的一个示意性流程图。图1所示的方法包括:
S110,获取主图像和目标副图像。
具体地,采用图1所示的方法可以得到主图像的深度图。其中,可以根据所需的深度图的分辨率来选择主图像和目标副图像,可选地,作为一例,主图像和目标副图像(统称为原图)的分辨率可以高于所需的深度图的分辨率至少一倍。
示例性地,S110可以包括获取主图像以及与主图像对应的至少一幅副图像。具体地,可以先获取主图像,再选取与主图像对应的至少一幅副图像。
示例性地,可以获取多帧候选副图像;从所述多帧候选副图像中选择满足预设要求的所述目标副图像。
其中,多帧候选副图像可以是与主图像相邻帧数的图像,或者,多帧候选副图像可以是在其他时间所拍摄的与主图像同一场景的图像,或者,多帧候选副图像也可以是其他图像,本发明对此不限定。
可选地,可以根据主图像的位置姿态信息来选取至少一幅副图像。
可选地,可以根据主图像的深度范围信息和/或主图像的稀疏点信息来选取至少一幅副图像。
可选地,作为一个实施例,多帧候选副图像可以包括与主图像距离较近的多帧图像,其中,两张图像之间的距离可以根据两张图像的特征向量进行计算得到,例如两个特征向量之间的点积。预设要求可以是稀疏点的外接区域的面积大于预设面积。也就是说,在选取目标副图像时,可以随机一些虚拟的三维点,然后将三维点投影到多帧候选副图像上,根据稀疏点的外接区域的面积大小的顺序来选取目标副图像。例如,可以选择稀疏点的外接区域的面积最大的一幅副图像作为目标副图像;例如,可以选择按照稀疏点的外接区域的面积大小排序的top N幅副图像作为目标副图像;例如,可以选择稀疏点的外接区域的面积大于预设面积的所有副图像作为目标副图像。
可选地,作为一个实施例,预设要求可以是光轴与主图像的光轴之间的夹角小于预设角度范围。也就是说,在选取目标副图像时,可以确定所述主图像的光轴与每一帧候选副图像的光轴之间的夹角;将处于预设角度范围的所述夹角对应的候选副图像确定为所述目标副图像。也就是说,若某一帧候选副图像的光轴与主图像的光轴之间的夹角处于预设角度范围内,则将该某一帧候选副图像作为目标副图像(或者,作为目标副图像的其中之一)。举例来说,可以将主图像上的稀疏点(三维点)投影到多帧候选副图像上,然后根据稀疏点计算出每帧候选副图像的深度范围,并选取结构性较强的至少一张目标副图像。其中,深度范围可以是全图统一的深度范围也可以是将图像分为若干个子图像块,每个图像块拥有独立的深度范围;其中,结构性较强可以包括交会角接近30度和稀疏点所占区域大小越大,交会角是稀疏点和影像光心形成的交角。
通过上述方式选择目标副图像,能够获取到与主图像更加接近的目标副图像,从而使得得到的主图像的深度图更加更加准确。应当理解,本发明实施例也可以采用其他的方式来选择目标副图像,本发明对此不限定。
另外,可理解,在一些实施例中,本发明实施例中的主图像和目标副图像可以是由可移动平台(例如无人机)拍摄的。
S120,对所述主图像和所述目标副图像进行极线矫正以获取与所述主图像对应的第一校正图像和与所述目标副图像对应的第二校正图像。
可理解,若目标副图像包括多帧,则针对每一帧目标副图像,均可以按照S120得到主图像的第一校正图像和该帧目标副图像的第二校正图像。也就是说,假设目标副图像有N幅,那么在S120中可以得到与N帧目标副图像一一对应的主图像的N幅第一校正图像,得到每帧目标副图像的第二校正图像。
为了阐述的方便,以主图像和一帧目标副图像构成的图像对为例,详细描述S120,可理解,对其他帧目标副图像,可以类似地进行。
具体地,S120可以包括:对于主图像和目标副图像这两张图像,可以将主图像通过单应性变换映射到第一校正图像,将目标副图像通过单应性变换映射到第二校正图像,并且第一校正图像和第二校正图像的相同行一一对应,使得同名像点位于相同的行。
极线矫正就是针对两张图像,求取对应于这两张图像的两个单应性变换矩阵,使得两张图像做了单应性变换之后的两张变换后图像的相同行一一对应,使得同名像点必定位于相同的行。其中极线是指过基线的平面和两张图像的交线,成对出现于两张图像,因为位于该平面内的物方点在图像上必定分布在同一对极线上,通常用来简化匹配时的搜索空间。其中,基线是指两张图像的光心之间的连线。
对主图像和目标副图像进行极线矫正时,确定与主图像对应的第一单应性变换矩阵以及与目标副图像对应的第二单应性变换矩阵。随后可以使用第一单应性变换矩阵对主图像进行映射,得到第一校正图像;使用第二单应性变换矩阵对目标副图像进行映射,得到第二校正图像。
极线矫正主要是需要求解第一单应性变换矩阵和第二单应性变换矩阵这两个矩阵,或分别表示为H1矩阵和H2矩阵(统称为H矩阵)。其实质上是找到两个旋转矩阵R o,R r,使得主图像和目标副图像这两张图像的相对旋转为 0,且图像的长边和空间中的基线平行。具体地,可以保持影像的光心位置固定,将基线方向作为x方向,左图光心方向与基线所在平面的法向作为y方向,垂直于x方向和y方向并满足右手坐标系的方向为z方向,将两张图像的姿态旋转到该定义的坐标系下。随后可以根据矫正前后的旋转参数R o,R r和相机矩阵K,按照
Figure PCTCN2019103343-appb-000001
便可以计算出由原始图像到极线矫正后图像的单应变换矩阵H,且该映射是可逆的,因而可以计算出极线矫正后图像到原始图像的单应变换矩阵h。也就是说,主图像可以通过第一单应性变换矩阵H1映射到第一校正图像,目标副图像可以通过第二单应性变换矩阵H2映射到第二校正图像。可逆地,第一校正图像可以通过单应变换矩阵h1映射到主图像,第二校正图像可以通过单应变换矩阵h2映射到目标副图像。
应注意的是,尽管上述已右手系的笛卡尔坐标系为例阐述了极线矫正,但是这不应理解为本发明的限制,也可以采用其他的方式进行极线矫正。本发明对此不再一一罗列。
S130,确定所述第一校正图像中与所述主图像中的目标像素点对应的图像块和所述第二校正图像中与所述目标副图像中的像素点对应的图像块。
可选地,作为一个实施例,针对主图像以及第一校正图像,可以在S130中确定主图像中的目标像素点在第一校正图像中对应的图像块。
示例性地,可以在第一校正图像中确定与主图像中的目标像素点匹配的像素点,根据该匹配的像素点确定第一校正图像中与主图像中的目标像素点对应的图像块。
其中,主图像中的目标像素点可以包括多个目标像素点,其可以是主图像中的所有像素点,或者,可以是主图像中的部分像素点。S130可以得到每一个目标像素点对应的图像块。
可选地,如果目标像素点是主图像中的部分像素点,则可以按照预设的采样规则对主图像进行采集以获取目标像素点。
具体地,可以对主图像中的全部像素点或者其中的一些像素点进行采样,从而得到目标像素点。本发明实施例对采样的方式不作限定,例如可以均匀采样、随机采样等等。
为了描述的方便,假设主图像中的目标像素点为第一像素,假设对应的第一校正图像中的图像块为第一图像块。
具体地,可以基于第一单应性变换矩阵H1,确定第一像素映射到第一校正图像中的哪个像素,即得到第一像素所映射到的第一校正图像中的第一位置,进而可以得到该第一位置所在的第一图像块。其中,可以将第一位置连同其周围的多个像素所构成的图像块确定为第一图像块。可选地,可以将第一位置的像素连同围绕其的多个像素所构成的图像块确定为第一图像块。作为一例,可以将以第一位置为中心的图像块确定为第一图像块。
例如,假设第一像素在主图像中的二维坐标表示为[x1,y1],那么将其映射到第一校正图像中的第一位置的坐标可以为:[x11 y11] T=H1[x1 y1] T,其中,第一位置的坐标表示为[x11,y11],T表示转置。
例如,可以将第一位置所在的k1×k2个像素所构成的图像块确定为第一图像块。其中,k1和k2为大于或等于2的正整数,两者可以相等或不相等。作为一例,k1=k2,具体地例如将以第一位置的像素为中心的3×3个像素构成的图像块确定为第一图像块。应理解,本发明实施例对第一图像块的形状或大小不作限定。
可选地,作为一个实施例,针对目标副图像以及第二校正图像,可以在S130中确定目标副图像中的像素点在第二校正图像中对应的图像块。
示例性地,可以在第二校正图像中确定与目标副图像中的像素点匹配的像素点,根据所述匹配的像素点确定第二校正图像中与目标副图像中的像素点对应的图像块。
其中,目标副图像中的像素点可以包括多个像素点,其可以是目标副图像中的所有像素点,或者,可以是目标副图像中的部分像素点。S130可以得到每一个像素点对应的图像块。
为了描述的方便,假设目标副图像中的像素点为第二像素,假设对应的第二校正图像中的图像块为第二图像块。
具体地,可以基于第二单应性变换矩阵H2,确定第二像素映射到第二校正图像中的哪个像素,即得到第二像素所映射到的第二校正图像中的第二位置,进而可以得到该第二位置所在的第二图像块。其中,可以将第二位置连同其周围的多个像素所构成的图像块确定为第二图像块。可选地,可以将第二位置的像素连同围绕其的多个像素所构成的图像块确定为第二图像块。作为一例,可以将以第二位置为中心的图像块确定为第二图像块。
例如,假设第二像素在目标副图像中的二维坐标表示为[x2,y2],那么将其映射到第二校正图像中的第二位置的坐标可以为:[x22 y22] T=H2[x2 y2] T,其中,第二位置的坐标表示为[x22,y22],T表示转置。
例如,可以将第二位置所在的k3×k4个像素所构成的图像块确定为第二图像块。其中,k3和k4为大于或等于2的正整数,两者可以相等或不相等。作为一例,k3=k4,具体地例如将以第二位置的像素为中心的3×3个像素构成的图像块确定为第二图像块。应理解,本发明实施例对第二图像块的形状或大小不作限定。
可见,在S130中,针对主图像和针对目标副图像确定在各自校正后的图像中的图像块的方法是类似的。并且其中,第一图像块和第二图像块可以包括相同数量的像素,例如,第一图像块包括9个像素,第二图像块包括9个像素。
并且,类似地,针对主图像中的多个目标像素点,可以得到每一个目标像素点在第一校正图像中对应的图像块。针对目标副图像中的的多个像素点,可以得到每一个像素点在第二校正图像中对应的图像块。
并且,类似地,若目标副图像包括多幅目标副图像,则可以针对主图像和任一目标副图像,执行S130的过程,这里不再赘述。
S140,根据所述第一校正图像中与所述主图像中的目标像素点对应的图像块确定所述主图像中的目标像素点的特征信息,根据所述第二校正图像中与所述目标副图像中的像素点对应的图像块确定所述目标副图像中的像素点的特征信息。
可选地,作为一个实施例,可以根据主图像中的目标像素点在第一校正图像对应中的图像块,确定主图像中的目标像素点的特征信息。
示例性地,可以确定与主图像中的目标像素点对应的图像块中的像素点在主图像中的映射像素点,并将主图像中的映射像素点的颜色信息与所述主图像中的目标像素点的颜色信息进行比较,以获取主图像中的目标像素点的特征信息。
本发明实施例中,特征信息可以为描述子(census)、或者可以为breaf、daisy、surf、sift等等。为了描述的方便,下文以描述子为例进行详细阐述。
结合S130,依然假设主图像中的目标像素点为第一像素,假设对应的第 一校正图像中的图像块为第一图像块。
具体地,可以基于单应变换矩阵h1(即第一单应性变换矩阵H1的逆矩阵),确定第一图像块中的各个像素映射到主图像中的哪些像素,然后根据映射到主图像中的这些像素的颜色信息来计算得到第一像素的特征信息。
也就是说,可以使用第一单应性变换矩阵H1的逆矩阵h1,将第一图像块中各个像素映射到主图像,得到在主图像中对应的多个映射像素。例如,假设第一图像块包括m个像素点,则将这m个像素点映射到主图像,得到m个映射像素。可理解,这m个映射像素包括第一像素,并且这m个映射像素不一定是连续的,彼此之间可以间隔、不连续,即这m个映射像素在主图像中可能无法形成图像块。但是,可以按照第一图像块中的m个像素点的位置,为对应的m个映射像素进行排序。例如,将第一图像块中的m个像素点按照从上到下、从左到右的顺序进行排序,进而能够得到映射后的m个映射像素的顺序。
随后,可以根据多个映射像素的颜色信息来计算得到第一像素的特征信息(如描述子)。可选地,颜色信息可以为灰度值,也就是说,可以根据多个映射像素的灰度值得到第一像素的描述子。
假设第一图像块包括m个像素点,则多个映射像素为m个映射像素。可以获取这m个映射像素的每一个映射像素的灰度值;将m个映射像素中除第一像素之外的另外m-1个映射像素的灰度值与第一像素的灰度值进行比较;并根据比较的结果来得到第一像素的描述子。
可选地,描述子可以是二进制的字符串的形式。作为一种实现方式,若m-1个映射像素中某个映射像素的灰度值小于第一像素的灰度值,则将这个映射像素标记为1;若m-1个映射像素中另一个映射像素的灰度值大于或等于第一像素的灰度值,则将这另一个映射像素标记为0。随后,将m-1个映射像素的标记值顺次连接为二进制字符串,作为第一像素的描述子。在该示例中,第一像素的描述子是由m-1个二进制字符所构成的字符串。
举例来说,假设第一图像块包括9(即m=9)个像素点,这9个像素点映射到主图像中的9个映射像素的灰度值依次为:123、127、129、126、128、129、127、131和130。其中128表示第一像素的灰度值。那么,计算得到的第一像素的描述子为11010100。
应注意,本发明实施例也可以采用其他的方法来计算描述子,描述子也可以表示为其他的形式,这里不再一一罗列。
可选地,作为一个实施例,可以根据目标副图像中的像素点在第二校正图像对应中的图像块,确定目标副图像中的像素点的特征信息。
示例性地,可以确定与目标副图像中的像素点对应的图像块中的像素点在目标副图像图像中的映射像素点,并将目标副图像中的映射像素点的颜色信息与目标副图像中的像素点的颜色信息进行比较,以获取目标副图像中的像素点的特征信息。
本发明实施例中,特征信息可以为描述子(census)、或者可以为breaf、daisy、surf、sift等等。为了描述的方便,下文以描述子为例进行详细阐述。
结合S130,依然假设目标副图像中的像素点为第二像素,假设对应的第二校正图像中的图像块为第二图像块。
具体地,可以基于单应变换矩阵h2(即第二单应性变换矩阵H2的逆矩阵),确定第二图像块中的各个像素映射到目标副图像中的哪些像素,然后根据映射到目标副图像中的这些像素的颜色信息来计算得到第二像素的特征信息。
也就是说,可以使用第二单应性变换矩阵H2的逆矩阵h2,将第二图像块中各个像素映射到目标副图像,得到在目标副图像中对应的多个映射像素。例如,假设第二图像块包括m个像素点,则将这m个像素点映射到目标副图像,得到m个映射像素。可理解,这m个映射像素包括第二像素,并且这m个映射像素不一定是连续的,彼此之间可以间隔、不连续,即这m个映射像素在目标副图像中可能无法形成图像块。但是,可以按照第二图像块中的m个像素点的位置,为对应的m个映射像素进行排序。例如,将第二图像块中的m个像素点按照从上到下、从左到右的顺序进行排序,进而能够得到映射后的m个映射像素的顺序。
随后,可以根据多个映射像素的颜色信息来计算得到第二像素的特征信息(如描述子)。可选地,颜色信息可以为灰度值,也就是说,可以根据多个映射像素的灰度值得到第二像素的描述子。
假设第二图像块包括m个像素点,则多个映射像素为m个映射像素。可以获取这m个映射像素的每一个映射像素的灰度值;将m个映射像素中除第二像素之外的另外m-1个映射像素的灰度值与第二像素的灰度值进行比较;并 根据比较的结果来得到第二像素的描述子。
可选地,描述子可以是二进制的字符串的形式。作为一种实现方式,若m-1个映射像素中某个映射像素的灰度值小于第二像素的灰度值,则将这个映射像素标记为1;若m-1个映射像素中另一个映射像素的灰度值大于或等于第二像素的灰度值,则将这另一个映射像素标记为0。随后,将m-1个映射像素的标记值顺次连接为二进制字符串,作为第一像素的描述子。在该示例中,第二像素的描述子是由m-1个二进制字符所构成的字符串。
应注意,本发明实施例也可以采用其他的方法来计算描述子,描述子也可以表示为其他的形式,这里不再一一罗列。
可见,在S140中,计算目标副图像中的像素的特征信息的方法与计算主图像中的目标像素点的特征信息的方法是类似的。并且,所得到的目标副图像中的像素的特征信息与主图像中的目标像素点的特征信息可以具有相同的维度,例如,均为m-1位二进制字符构成的字符串。
并且,类似地,针对主图像中的多个目标像素点,可以得到每一个目标像素点的特征信息。针对目标副图像中的的多个像素点,可以得到每一个像素点的特征信息。
并且,类似地,若目标副图像包括多幅目标副图像,则可以针对主图像和任一目标副图像,执行S140的过程,这里不再赘述。
S150,根据所述主图像中的目标像素点的特征信息和所述目标副图像中的像素点的特征信息确定所述主图像对应的深度图。
可选地,可以根据主图像中的目标像素点的特征信息与目标副图像中的像素点的特征信息之间的汉明距离,得到主图像中的目标像素点的匹配代价。进而基于主图像中的多个目标像素点的匹配代价来确定主图像对应的深度图。
示例性地,如图2所示,S150可以包括:
S1501,获取多个候选深度指示参数;
S1502,根据所述多个候选深度指示参数将所述主图像中的每一个目标像素点对应的物方点投影到所述目标副图像,以在所述目标副图像中的像素点中确定与所述主图像中的目标像素点匹配的多个投影像素点;
S1503,根据所述主图像中的目标像素点的特征信息和与所述主图像中的目标像素点匹配的多个投影像素点的特征信息,确定所述主图像中的目标像素 点的多个匹配代价;
S1504,根据所述主图像中的目标像素点的多个匹配代价,从所述多个候选深度指示参数中确定所述主图像中的目标像素点对应的深度。
其中,深度指示参数可以为深度或逆深度,也可以为与深度有关的其它参数。
可选地,可以获取主图像对应的深度指示参数的范围,从而在S1501中可以在所述深度指示参数的范围内进行采样以获取所述多个候选深度指示参数。
举例来说,假设深度指示参数为深度,深度指示参数的范围(即深度范围)为[d min,d max]。举例来说,假设深度指示参数为逆深度,若已知主图像的深度范围[d min,d max],则深度指示参数的范围(即逆深度范围)为[d max -1,d min -1]。
示例性地,S1502中,可以将主图像的目标像素点在逆深度空间(或深度空间)进行多次采样,并将多次采样得到的物方点投影到目标副图像上,得到对应的多个投影像素点。其中,逆深度采样可以更好地匹配图像。
其中,采样可以是均匀采样,例如在像方平面上等间隔采样或者近似等间隔采样。或者,采样可以是随机采样,或者,其他方式采样,本发明对此不限定。
其中,投影可以是中心投影,采样得到的物方点投影后的物方深度是不均匀的,如图3所示。
可选地,作为一个实施例,如果目标副图像的数量为多幅,即如果目标副图像为多帧目标副图像,则在S1502中,可以包括:根据多个候选深度指示参数将主图像中的目标像素点对应的物方点投影到每一帧目标副图像,以在每一帧目标副图像中的像素点中确定与主图像中的目标像素点匹配的多个投影像素点。也就是说,可以将主图像的目标像素点进行多次采样,将多次采样得到的物方点投影到每一帧目标副图像上,从而在每一帧目标幅图像上都对应得到多个投影像素点。
示例性地,S1503中,针对每一个投影像素点:可以计算目标像素点的特征信息与投影像素点的特征信息之间的汉明距离,并将其结果作为两者之间的匹配代价。基于多个投影像素点,可以得到对应的多个匹配代价。这个数量与对目标像素点进行采样的次数是一致的。
可选地,特征信息可以为描述子,描述子可以表示为二进制字符串的形状, 那么,汉明距离可以等于两个描述子中不相同的比特位数。
可选地,作为一个实施例,如果目标副图像的数量为多幅,即如果目标副图像为多帧目标副图像,则在S1503中,可以包括:根据主图像中的目标像素点的特征信息和每一帧目标副图像中与目标像素点匹配的多个投影像素点的特征信息确定主图像中的目标像素点的多个匹配代价集合,其中,每一个匹配代价集合与一个候选深度指示参数对应;对多个匹配代价集合中的每一个集合中的匹配代价进行融合以获取所述多个匹配代价。
具体地,可以将主图像的目标像素点进行采样,将采样得到的物方点投影到每一帧目标副图像上,从而在每一帧目标幅图像上都对应得到投影像素点(如图3所示)。将基于目标像素点的特征信息与这些投影像素点的特征信息得到的匹配代价一起作为一个匹配代价集合。通过对目标像素点进行多次采样,可以类似地得到多个匹配代价集合。其中,计算匹配代价的方法可以如上所述,这里不再赘述。
举例来说,假设包括P帧目标副图像,N个候选深度指示参数(即采样次数为N)。那么,可以得到N个匹配代价集合,并且每个匹配代价集合包括P个匹配代价。N个匹配代价集合与N个候选深度指示参数一一对应,每个匹配代价集合中的P个匹配代价与P帧目标副图像一一对应。
具体地,将一个匹配代价集合中的多个匹配代价进行融合,可以是通过取最小、加权求和等方式实现的。举例来说,一个匹配代价集合包括P个匹配代价,将这P个匹配代价的最小值作为融合匹配代价。这样,通过对N个匹配代价集合中每个匹配代价集合的融合,能够得到N个融合后的匹配代价,这融合后的N个匹配代价与N个候选深度指示参数一一对应。
类似地,可以得到多个目标像素点中每一个目标像素点对应的多个匹配代价。例如,针对M个目标像素点,每个目标像素点均对应N个匹配代价。
示例性地,S1504中,可以包括:从所述主图像中的目标像素点的多个匹配代价中确定最小的匹配代价;将所述最小的匹配代价对应的候选深度指示参数确定为所述主图像中的目标像素点对应的深度。
举例来说,针对目标像素点A,已经得到了多个匹配代价,其中最小的匹配代价为PPDJ1,该最小的匹配代价PPDJ1是通过在候选深度指示参数DEP1采样时所得到的,那么可以选取候选深度指示参数DEP1,并根据候选深度指 示参数DEP1来确定目标像素点A的深度。若候选深度指示参数为深度,则目标像素点A的深度为DEP1;若候选深度指示参数为逆深度,则目标像素点A的深度为DEP1 -1
类似地,便可以得到每一个目标像素点的深度,从而得到主图像的深度图。
可选地,作为一个实施例,如果目标副图像的数量为多幅,即如果目标副图像为多帧目标副图像,则在S1504中,可以包括:对主图像中的目标像素点的多个匹配代价组合进行滤波处理;根据滤波处理得到的主图像中的目标像素点的多个匹配代价组合从多个候选深度指示参数确定主图像中的目标像素点对应的深度。
具体地,针对一个目标像素点,可以得到多个匹配代价。针对多个目标像素点(例如M个),可以得到M个多个匹配代价,可以称为多个匹配代价组合。
可选地,可以按照预设的方向对多个匹配代价组合进行滤波处理。
其中,滤波处理可以是采用多路径规划的方法进行的。举例来说,预设的方向可以是从左往右,那么可以从图像的左侧开始,可以根据上一个像素的多个匹配代价,对当前真正进行滤波处理的像素的多个匹配代价之一进行优化。在优化的过程中,其实像素的多个匹配代价不变(即不进行优化),之后从左到右的像素的多个匹配代价一次进行优化,从而得到优化后的多个匹配代价。例如,可以采用但不限于8个方向的动态规划优化方法(如图4所示)得到优化后的多个匹配代价。针对多个目标像素点的多个匹配代价组合,可以得到优化后的多个匹配代价组合,也称为滤波处理后的多个匹配代价组合。
可理解,动态规划算法一般可以得到近似全局最优解,使得得到的深度图更加准确和完整。另外,动态规划算法对小面积弱纹理区域鲁棒,比如即使是无纹理区域,其深度也可以通过边缘深度的延伸得到。
滤波处理后的多个匹配代价组合包括多个目标像素点中每一个目标像素点的多个匹配代价。随后,针对一个目标像素点的滤波处理后的多个匹配代价,可以选择最小的匹配代价,并将最小的匹配代价对应的候选深度指示参数确定为该目标像素点对应的深度。该过程可以参见上述实施例中确定深度的具体过程,这里不再赘述。
基于多个匹配代价组合中其他目标像素点的多个匹配代价,可以类似地得 到各个目标像素点的深度。从而能够得到主图像的深度图。
由此可见,本发明实施例中通过极线矫正得到图像的特征信息,进而能够得到主图像的深度图,该方法能够并行执行,从而能够提高处理效率,缩短处理时间。另外,该方法的计算复杂度低,降低了对硬件的需求。其中,采用极线矫正具有更快的速度,缩短了计算时间。其中,在得到深度图时,可以进行代价计算,并且可选地可以采用动态规划进行优化,具有更高的稳定性,尤其地对弱纹理图像更加稳健。
图5是本发明实施例的获取深度图的装置50的一个示意性框图。如图7所示,装置50可以包括:
图像获取模块510,用于获取主图像和目标副图像;
极线矫正模块520,用于对所述主图像和所述目标副图像进行极线矫正以获取与所述主图像对应的第一校正图像和与所述目标副图像对应的第二校正图像;
映射模块530,用于确定所述第一校正图像中与所述主图像中的目标像素点对应的图像块和所述第二校正图像中与所述目标副图像中的像素点对应的图像块;
特征信息计算模块540,用于根据所述第一校正图像中与所述主图像中的目标像素点对应的图像块确定所述主图像中的目标像素点的特征信息,根据所述第二校正图像中与所述目标副图像中的像素点对应的图像块确定所述目标副图像中的像素点的特征信息;
深度图确定模块550,用于根据所述主图像中的目标像素点的特征信息和所述目标副图像中的像素点的特征信息确定所述主图像对应的深度图。
可选地,在一些实施例中,所述映射模块530可以具体用于:在所述第一校正图像中确定与所述主图像中的目标像素点匹配的像素点,根据所述匹配的像素点确定所述第一校正图像中与所述主图像中的目标像素点对应的图像块;在所述第二校正图像中确定与所述目标副图像中的像素点匹配的像素点,根据所述匹配的像素点确定所述第二校正图像中与所述目标副图像中的像素点对应的图像块。
可选地,在一些实施例中,所述特征信息计算模块540可以具体用于:确定与所述主图像中的目标像素点对应的图像块中的像素点在所述主图像中的 映射像素点,并将所述主图像中的映射像素点的颜色信息与所述主图像中的目标像素点的颜色信息进行比较,以获取所述主图像中的目标像素点的特征信息;确定与所述目标副图像中的像素点对应的图像块中的像素点在所述目标副图像图像中的映射像素点,并将所述目标副图像中的映射像素点的颜色信息与所述目标副图像中的像素点的颜色信息进行比较,以获取所述目标副图像中的像素点的特征信息。
可选地,在一些实施例中,如图6所示,所述深度图确定模块550可以包括:
获取单元5501,用于获取多个候选深度指示参数;
投影单元5502,用于根据所述多个候选深度指示参数将所述主图像中的每一个目标像素点对应的物方点投影到所述目标副图像,以在所述目标副图像中的像素点中确定与所述主图像中的目标像素点匹配的多个投影像素点;
匹配代价计算单元5503,用于根据所述主图像中的目标像素点的特征信息和与所述主图像中的目标像素点匹配的多个投影像素点的特征信息,确定所述主图像中的目标像素点的多个匹配代价;
深度确定单元5504,用于根据所述主图像中的目标像素点的多个匹配代价,从所述多个候选深度指示参数中确定所述主图像中的目标像素点对应的深度。
可选地,在一些实施例中,所述装置还包括:深度范围获取模块,用于获取所述主图像对应的深度指示参数的范围。其中,所述获取单元5501可以具体用于:在所述深度指示参数的范围内进行采样以获取所述多个候选深度指示参数。
可选地,在一些实施例中,所述深度确定单元5504可以具体用于:从所述主图像中的目标像素点的多个匹配代价中确定最小的匹配代价;将所述最小的匹配代价对应的候选深度指示参数确定为所述主图像中的目标像素点对应的深度。
可选地,在一些实施例中,所述深度指示参数包括深度或者逆深度。
可选地,在一些实施例中,所述目标副图像包括多帧目标副图像,其中所述投影单元5502可以具体用于:根据所述多个候选深度指示参数将所述主图像中的目标像素点对应的物方点投影到每一帧目标副图像,以在所述每一帧目 标副图像中的像素点中确定与所述主图像中的目标像素点匹配的多个投影像素点。所述匹配代价计算单元5503可以具体用于:根据所述主图像中的每一个目标像素点的特征信息和每一帧目标副图像中与所述主图像中的每一个目标像素点匹配的多个投影像素点的特征信息确定所述主图像中的每一个目标像素点的多个匹配代价集合,其中,每一个匹配代价集合与一个候选深度指示参数对应;对多个匹配代价集合中的每一个集合中的匹配代价进行融合以获取所述多个匹配代价。
可选地,在一些实施例中,所述装置还可以包括采样模块,用于按照预设的采样规则对所述主图像进行采样以获取所述主图像的目标像素点。
可选地,在一些实施例中,如图6所述,所述图像获取模块510可以包括:
候选图像获取单元5101,用于获取多帧候选副图像;
图像选择单元5102,用于从所述多帧候选副图像中选择满足预设要求的所述目标副图像。
可选地,在一些实施例中,所述图像选择单元5102可以具体用于:确定所述主图像的光轴与每一帧候选副图像的光轴之间的夹角;将处于预设角度范围的所述夹角对应的候选副图像确定为所述目标副图像。
可选地,在一些实施例中,所述深度确定单元5504可以包括:
滤波单元,用于对所述主图像中的目标像素点的多个匹配代价组合进行滤波处理;
确定单元,用于根据所述滤波处理得到的主图像中的目标像素点的多个匹配代价组合从所述多个候选深度指示参数确定所述主图像中的目标像素点对应的深度。
可选地,在一些实施例中,所述滤波单元可以具体用于:按照预设的方向对所述主图像中的目标像素点的多个匹配代价组合进行滤波处理。
如图7所示,本发明实施例还提供了一种获取深度图的装置70。该装置70包括处理器710和存储器720。该存储器720中存储有计算机指令,该处理器710执行该计算机指令时,使得该处理器710执行以下步骤:获取主图像和目标副图像;对所述主图像和所述目标副图像进行极线矫正以获取与所述主图像对应的第一校正图像和与所述目标副图像对应的第二校正图像;确定所述第一校正图像中与所述主图像中的目标像素点对应的图像块和所述第二校正图 像中与所述目标副图像中的像素点对应的图像块;根据所述第一校正图像中与所述主图像中的目标像素点对应的图像块确定所述主图像中的目标像素点的特征信息,根据所述第二校正图像中与所述目标副图像中的像素点对应的图像块确定所述目标副图像中的像素点的特征信息;根据所述主图像中的目标像素点的特征信息和所述目标副图像中的像素点的特征信息确定所述主图像对应的深度图。
可选地,在一些实施例中,处理器710可以具体用于:在所述第一校正图像中确定与所述主图像中的目标像素点匹配的像素点,根据所述匹配的像素点确定所述第一校正图像中与所述主图像中的目标像素点对应的图像块;在所述第二校正图像中确定与所述目标副图像中的像素点匹配的像素点,根据所述匹配的像素点确定所述第二校正图像中与所述目标副图像中的像素点对应的图像块。
可选地,在一些实施例中,处理器710可以具体用于:确定与所述主图像中的目标像素点对应的图像块中的像素点在所述主图像中的映射像素点,并将所述主图像中的映射像素点的颜色信息与所述主图像中的目标像素点的颜色信息进行比较,以获取所述主图像中的目标像素点的特征信息;确定与所述目标副图像中的像素点对应的图像块中的像素点在所述目标副图像图像中的映射像素点,并将所述目标副图像中的映射像素点的颜色信息与所述目标副图像中的像素点的颜色信息进行比较,以获取所述目标副图像中的像素点的特征信息。
可选地,在一些实施例中,处理器710可以具体用于:获取多个候选深度指示参数;根据所述多个候选深度指示参数将所述主图像中的每一个目标像素点对应的物方点投影到所述目标副图像,以在所述目标副图像中的像素点中确定与所述主图像中的目标像素点匹配的多个投影像素点;根据所述主图像中的目标像素点的特征信息和与所述主图像中的目标像素点匹配的多个投影像素点的特征信息,确定所述主图像中的目标像素点的多个匹配代价;根据所述主图像中的目标像素点的多个匹配代价,从所述多个候选深度指示参数中确定所述主图像中的目标像素点对应的深度。
可选地,在一些实施例中,处理器710还可以用于:获取所述主图像对应的深度指示参数的范围。从而处理器710可以用于:在所述深度指示参数的范 围内进行采样以获取所述多个候选深度指示参数。
可选地,在一些实施例中,处理器710可以具体用于:从所述主图像中的目标像素点的多个匹配代价中确定最小的匹配代价;将所述最小的匹配代价对应的候选深度指示参数确定为所述主图像中的目标像素点对应的深度。
可选地,在一些实施例中,所述深度指示参数包括深度或者逆深度。
可选地,在一些实施例中,所述目标副图像包括多帧目标副图像,其中处理器710可以具体用于:根据所述多个候选深度指示参数将所述主图像中的目标像素点对应的物方点投影到每一帧目标副图像,以在所述每一帧目标副图像中的像素点中确定与所述主图像中的目标像素点匹配的多个投影像素点。处理器710还可以具体用于:根据所述主图像中的每一个目标像素点的特征信息和每一帧目标副图像中与所述主图像中的每一个目标像素点匹配的多个投影像素点的特征信息确定所述主图像中的每一个目标像素点的多个匹配代价集合,其中,每一个匹配代价集合与一个候选深度指示参数对应;对多个匹配代价集合中的每一个集合中的匹配代价进行融合以获取所述多个匹配代价。
可选地,在一些实施例中,处理器710还可以用于按照预设的采样规则对所述主图像进行采样以获取所述主图像的目标像素点。
可选地,在一些实施例中,处理器710可以具体用于:获取多帧候选副图像;从所述多帧候选副图像中选择满足预设要求的所述目标副图像。
可选地,在一些实施例中,处理器710可以具体用于:确定所述主图像的光轴与每一帧候选副图像的光轴之间的夹角;将处于预设角度范围的所述夹角对应的候选副图像确定为所述目标副图像。
可选地,在一些实施例中,处理器710可以具体用于:对所述主图像中的目标像素点的多个匹配代价组合进行滤波处理;根据所述滤波处理得到的主图像中的目标像素点的多个匹配代价组合从所述多个候选深度指示参数确定所述主图像中的目标像素点对应的深度。
可选地,在一些实施例中,处理器710可以具体用于:按照预设的方向对所述主图像中的目标像素点的多个匹配代价组合进行滤波处理。
图5或图6所示的装置50以及图7所示的装置70能够实现上文所述的获取深度图的方法的步骤,为避免重复,这里不再赘述。
本发明实施例还提供一种可移动平台,包括:用于输出所述主图像和目标 副图像的拍摄装置和如图5-7中任一项所述的获取深度图的装置。
本发明实施例还提供一种计算机存储介质,其上存储有计算机程序,该计算机程序被计算机执行时使得,该计算机执行上文方法实施例提供的获取深度图的方法。
本发明实施例还提供一种包含指令的计算机程序产品,该指令被计算机执行时使得计算机执行上文方法实施例提供的获取深度图的方法。
由此可见,本发明实施例中通过极线矫正得到图像的特征信息,进而能够得到主图像的深度图,该方法能够并行执行,从而能够提高处理效率,缩短处理时间。另外,该方法的计算复杂度低,降低了对硬件的需求。其中,采用极线矫正具有更快的速度,缩短了计算时间。其中,在得到深度图时,可以进行代价计算,并且可选地可以采用动态规划进行优化,具有更高的稳定性,尤其地对弱纹理图像更加稳健。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其他任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本发明实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(digital subscriber line,DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(例如,软盘、硬盘、磁带)、光介质(例如数字视频光盘(digital video disc,DVD))、或者半导体介质(例如固态硬盘(solid state disk,SSD))等。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现 所描述的功能,但是这种实现不应认为超出本申请的范围。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理器中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (28)

  1. 一种获取深度图的方法,其特征在于,包括:
    获取主图像和目标副图像;
    对所述主图像和所述目标副图像进行极线矫正以获取与所述主图像对应的第一校正图像和与所述目标副图像对应的第二校正图像;
    确定所述第一校正图像中与所述主图像中的目标像素点对应的图像块和所述第二校正图像中与所述目标副图像中的像素点对应的图像块;
    根据所述第一校正图像中与所述主图像中的目标像素点对应的图像块确定所述主图像中的目标像素点的特征信息,根据所述第二校正图像中与所述目标副图像中的像素点对应的图像块确定所述目标副图像中的像素点的特征信息;
    根据所述主图像中的目标像素点的特征信息和所述目标副图像中的像素点的特征信息确定所述主图像对应的深度图。
  2. 根据权利要求1所述的方法,其特征在于,所述确定所述第一校正图像中与所述主图像中的目标像素点对应的图像块和所述第二校正图像中与所述目标副图像中的像素点对应的图像块,包括:
    在所述第一校正图像中确定与所述主图像中的目标像素点匹配的像素点,根据所述匹配的像素点确定所述第一校正图像中与所述主图像中的目标像素点对应的图像块;
    在所述第二校正图像中确定与所述目标副图像中的像素点匹配的像素点,根据所述匹配的像素点确定所述第二校正图像中与所述目标副图像中的像素点对应的图像块。
  3. 根据权利要求1所述的方法,其特征在于,所述根据所述第一校正图像中与所述主图像中的目标像素点对应的图像块确定所述主图像中的目标像素点的特征信息,根据所述第二校正图像中与所述目标副图像中的像素点对应的图像块确定所述目标副图像中的像素点的特征信息,包括:
    确定与所述主图像中的目标像素点对应的图像块中的像素点在所述主图像中的映射像素点,并将所述主图像中的映射像素点的颜色信息与所述主图像中的目标像素点的颜色信息进行比较,以获取所述主图像中的目标像素点的特征信息;
    确定与所述目标副图像中的像素点对应的图像块中的像素点在所述目标副图像图像中的映射像素点,并将所述目标副图像中的映射像素点的颜色信息与所述目标副图像中的像素点的颜色信息进行比较,以获取所述目标副图像中的像素点的特征信息。
  4. 根据权利要求1至3中任一项所述的方法,其特征在于,所述根据所述主图像中的目标像素点的特征信息和所述目标副图像中的像素点的特征信息确定所述主图像对应的深度图,包括:
    获取多个候选深度指示参数;
    根据所述多个候选深度指示参数将所述主图像中的每一个目标像素点对应的物方点投影到所述目标副图像,以在所述目标副图像中的像素点中确定与所述主图像中的目标像素点匹配的多个投影像素点;
    根据所述主图像中的目标像素点的特征信息和与所述主图像中的目标像素点匹配的多个投影像素点的特征信息,确定所述主图像中的目标像素点的多个匹配代价;
    根据所述主图像中的目标像素点的多个匹配代价,从所述多个候选深度指示参数中确定所述主图像中的目标像素点对应的深度。
  5. 根据权利要求4所述的方法,其特征在于,所述方法还包括:
    获取所述主图像对应的深度指示参数的范围;
    其中,所述获取多个候选深度指示参数,包括:
    在所述深度指示参数的范围内进行采样以获取所述多个候选深度指示参数。
  6. 根据权利要求4或5所述的方法,其特征在于,所述根据所述主图像中的目标像素点的多个匹配代价,从所述多个候选深度指示参数中确定所述主图像中的目标像素点对应的深度,包括:
    从所述主图像中的目标像素点的多个匹配代价中确定最小的匹配代价;
    将所述最小的匹配代价对应的候选深度指示参数确定为所述主图像中的目标像素点对应的深度。
  7. 根据权利要求4-6任一项所述的方法,其特征在于,所述深度指示参数包括深度或者逆深度。
  8. 根据权利要求4-7任一项所述的方法,其特征在于,所述目标副图像 包括多帧目标副图像,其中,
    所述根据所述多个候选深度指示参数将所述主图像中的每一个目标像素点对应的物方点投影到所述目标副图像以在目标副图像中的像素点中确定与所述主图像中的目标像素点匹配的多个投影像素点,包括:
    根据所述多个候选深度指示参数将所述主图像中的目标像素点对应的物方点投影到每一帧目标副图像,以在所述每一帧目标副图像中的像素点中确定与所述主图像中的目标像素点匹配的多个投影像素点;
    所述根据所述主图像中的目标像素点的特征信息和与所述主图像中的目标像素点匹配的多个投影像素点的特征信息确定所述主图像中的目标像素点的多个匹配代价,包括:
    根据所述主图像中的每一个目标像素点的特征信息和每一帧目标副图像中与所述主图像中的每一个目标像素点匹配的多个投影像素点的特征信息确定所述主图像中的每一个目标像素点的多个匹配代价集合,其中,每一个匹配代价集合与一个候选深度指示参数对应;
    对多个匹配代价集合中的每一个集合中的匹配代价进行融合以获取所述多个匹配代价。
  9. 根据权利要求8所述的方法,其特征在于,所述方法还包括:
    按照预设的采样规则对所述主图像进行采样以获取所述主图像的目标像素点。
  10. 根据权利要求8所述的方法,其特征在于,所述获取所述目标副图像包括:
    获取多帧候选副图像;
    从所述多帧候选副图像中选择满足预设要求的所述目标副图像。
  11. 根据权利要求10所述的方法,其特征在于,所述从所述多帧候选副图像中选择满足预设要求的所述目标副图像,包括:
    确定所述主图像的光轴与每一帧候选副图像的光轴之间的夹角;
    将处于预设角度范围的所述夹角对应的候选副图像确定为所述目标副图像。
  12. 根据权利要求8-11任一项所述的方法,其特征在于,所述根据所述主图像中的目标像素点的多个匹配代价,从所述多个候选深度指示参数中确定 所述主图像中的目标像素点对应的深度,包括:
    对所述主图像中的目标像素点的多个匹配代价组合进行滤波处理;
    根据所述滤波处理得到的主图像中的目标像素点的多个匹配代价组合从所述多个候选深度指示参数确定所述主图像中的目标像素点对应的深度。
  13. 根据权利要求12所述的方法,其特征在于,所述对所述主图像中的目标像素点的多个匹配代价组合进行滤波处理,包括:
    按照预设的方向对所述主图像中的目标像素点的多个匹配代价组合进行滤波处理。
  14. 一种获取深度图的装置,其特征在于,包括:存储器和处理器,其中,
    所述存储器,用于存储计算机指令;
    所述处理器,用于调用所述计算机指令,当所述计算机指令被执行时,用于执行以下步骤:
    获取主图像和目标副图像;
    对所述主图像和所述目标副图像进行极线矫正以获取与所述主图像对应的第一校正图像和与所述目标副图像对应的第二校正图像;
    确定所述第一校正图像中与所述主图像中的目标像素点对应的图像块和所述第二校正图像中与所述目标副图像中的像素点对应的图像块;
    根据所述第一校正图像中与所述主图像中的目标像素点对应的图像块确定所述主图像中的目标像素点的特征信息,根据所述第二校正图像中与所述目标副图像中的像素点对应的图像块确定所述目标副图像中的像素点的特征信息;
    根据所述主图像中的目标像素点的特征信息和所述目标副图像中的像素点的特征信息确定所述主图像对应的深度图。
  15. 根据权利要求14所述的装置,其特征在于,所述处理器,具体用于:
    在所述第一校正图像中确定与所述主图像中的目标像素点匹配的像素点,根据所述匹配的像素点确定所述第一校正图像中与所述主图像中的目标像素点对应的图像块;
    在所述第二校正图像中确定与所述目标副图像中的像素点匹配的像素点,根据所述匹配的像素点确定所述第二校正图像中与所述目标副图像中的像素点对应的图像块。
  16. 根据权利要求14所述的装置,其特征在于,所述处理器,具体用于:
    确定与所述主图像中的目标像素点对应的图像块中的像素点在所述主图像中的映射像素点,并将所述主图像中的映射像素点的颜色信息与所述主图像中的目标像素点的颜色信息进行比较,以获取所述主图像中的目标像素点的特征信息;
    确定与所述目标副图像中的像素点对应的图像块中的像素点在所述目标副图像图像中的映射像素点,并将所述目标副图像中的映射像素点的颜色信息与所述目标副图像中的像素点的颜色信息进行比较,以获取所述目标副图像中的像素点的特征信息。
  17. 根据权利要求14至16中任一项所述的装置,其特征在于,所述处理器,具体用于:
    获取多个候选深度指示参数;
    根据所述多个候选深度指示参数将所述主图像中的每一个目标像素点对应的物方点投影到所述目标副图像,以在所述目标副图像中的像素点中确定与所述主图像中的目标像素点匹配的多个投影像素点;
    根据所述主图像中的目标像素点的特征信息和与所述主图像中的目标像素点匹配的多个投影像素点的特征信息,确定所述主图像中的目标像素点的多个匹配代价;
    根据所述主图像中的目标像素点的多个匹配代价,从所述多个候选深度指示参数中确定所述主图像中的目标像素点对应的深度。
  18. 根据权利要求17所述的装置,其特征在于,所述处理器,还用于获取所述主图像对应的深度指示参数的范围;
    其中,所述处理器,具体用于在所述深度指示参数的范围内进行采样以获取所述多个候选深度指示参数。
  19. 根据权利要求17或18所述的装置,其特征在于,所述处理器,具体用于:
    从所述主图像中的目标像素点的多个匹配代价中确定最小的匹配代价;
    将所述最小的匹配代价对应的候选深度指示参数确定为所述主图像中的目标像素点对应的深度。
  20. 根据权利要求17-19任一项所述的装置,其特征在于,所述深度指示 参数包括深度或者逆深度。
  21. 根据权利要求17-20任一项所述的装置,其特征在于,所述目标副图像包括多帧目标副图像,其中,
    所述处理器,具体用于:
    根据所述多个候选深度指示参数将所述主图像中的目标像素点对应的物方点投影到每一帧目标副图像,以在所述每一帧目标副图像中的像素点中确定与所述主图像中的目标像素点匹配的多个投影像素点;
    所述处理器,具体用于:
    根据所述主图像中的每一个目标像素点的特征信息和每一帧目标副图像中与所述主图像中的每一个目标像素点匹配的多个投影像素点的特征信息确定所述主图像中的每一个目标像素点的多个匹配代价集合,其中,每一个匹配代价集合与一个候选深度指示参数对应;
    对多个匹配代价集合中的每一个集合中的匹配代价进行融合以获取所述多个匹配代价。
  22. 根据权利要求21所述的装置,其特征在于,所述处理器,还用于按照预设的采样规则对所述主图像进行采样以获取所述主图像的目标像素点。
  23. 根据权利要求21所述的装置,其特征在于,所述处理器,具体用于:
    获取多帧候选副图像;
    从所述多帧候选副图像中选择满足预设要求的所述目标副图像。
  24. 根据权利要求23所述的装置,其特征在于,所述处理器,具体用于:
    确定所述主图像的光轴与每一帧候选副图像的光轴之间的夹角;
    将处于预设角度范围的所述夹角对应的候选副图像确定为所述目标副图像。
  25. 根据权利要求21所述的装置,其特征在于,所述处理器,具体用于:
    对所述主图像中的目标像素点的多个匹配代价组合进行滤波处理;
    根据所述滤波处理得到的主图像中的目标像素点的多个匹配代价组合从所述多个候选深度指示参数确定所述主图像中的目标像素点对应的深度。
  26. 根据权利要求25所述的装置,其特征在于,所述处理器,具体用于:
    按照预设的方向对所述主图像中的目标像素点的多个匹配代价组合进行滤波处理。
  27. 一种可移动平台,包括:用于输出所述主图像和目标副图像的拍摄装置和如权利要求14-26任一项所述的获取深度图的装置。
  28. 一种计算机存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至13中任一项所述方法的步骤。
PCT/CN2019/103343 2019-08-29 2019-08-29 获取深度图的方法、装置及计算机存储介质 WO2021035627A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201980031872.5A CN112243518A (zh) 2019-08-29 2019-08-29 获取深度图的方法、装置及计算机存储介质
PCT/CN2019/103343 WO2021035627A1 (zh) 2019-08-29 2019-08-29 获取深度图的方法、装置及计算机存储介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/103343 WO2021035627A1 (zh) 2019-08-29 2019-08-29 获取深度图的方法、装置及计算机存储介质

Publications (1)

Publication Number Publication Date
WO2021035627A1 true WO2021035627A1 (zh) 2021-03-04

Family

ID=74168428

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/103343 WO2021035627A1 (zh) 2019-08-29 2019-08-29 获取深度图的方法、装置及计算机存储介质

Country Status (2)

Country Link
CN (1) CN112243518A (zh)
WO (1) WO2021035627A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113793420A (zh) * 2021-09-17 2021-12-14 联想(北京)有限公司 深度信息处理方法、装置、电子设备及存储介质

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111366917B (zh) * 2020-03-13 2022-07-15 北京百度网讯科技有限公司 可行驶区域检测方法、装置、设备及计算机可读存储介质
CN112834457B (zh) * 2021-01-23 2022-06-03 中北大学 基于反射式激光热成像的金属微裂纹三维表征系统及方法
CN113658242A (zh) * 2021-08-23 2021-11-16 深圳市慧鲤科技有限公司 深度估计方法、装置、计算机设备及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104333758A (zh) * 2014-10-11 2015-02-04 华为技术有限公司 深度图的预测方法和检测像素点的方法及相关装置
US20150189253A1 (en) * 2014-01-02 2015-07-02 Industrial Technology Research Institute Depth map aligning method and system
CN107862742A (zh) * 2017-12-21 2018-03-30 华中科技大学 一种基于多假设联合视图选择的稠密三维重建方法
CN109903379A (zh) * 2019-03-05 2019-06-18 电子科技大学 一种基于点云优化采样的三维重建方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150189253A1 (en) * 2014-01-02 2015-07-02 Industrial Technology Research Institute Depth map aligning method and system
CN104333758A (zh) * 2014-10-11 2015-02-04 华为技术有限公司 深度图的预测方法和检测像素点的方法及相关装置
CN107862742A (zh) * 2017-12-21 2018-03-30 华中科技大学 一种基于多假设联合视图选择的稠密三维重建方法
CN109903379A (zh) * 2019-03-05 2019-06-18 电子科技大学 一种基于点云优化采样的三维重建方法

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113793420A (zh) * 2021-09-17 2021-12-14 联想(北京)有限公司 深度信息处理方法、装置、电子设备及存储介质
CN113793420B (zh) * 2021-09-17 2024-05-24 联想(北京)有限公司 深度信息处理方法、装置、电子设备及存储介质

Also Published As

Publication number Publication date
CN112243518A (zh) 2021-01-19

Similar Documents

Publication Publication Date Title
WO2020001168A1 (zh) 三维重建方法、装置、设备和存储介质
US11410320B2 (en) Image processing method, apparatus, and storage medium
CN109461180B (zh) 一种基于深度学习的三维场景重建方法
WO2021035627A1 (zh) 获取深度图的方法、装置及计算机存储介质
CN108921781B (zh) 一种基于深度的光场拼接方法
CN110211043B (zh) 一种用于全景图像拼接的基于网格优化的配准方法
CN111598993B (zh) 基于多视角成像技术的三维数据重建方法、装置
WO2016110239A1 (zh) 图像处理方法和装置
CN110176032B (zh) 一种三维重建方法及装置
CN115205489A (zh) 一种大场景下的三维重建方法、系统及装置
CN108010123B (zh) 一种保留拓扑信息的三维点云获取方法
JP2018028899A (ja) 画像レジストレーションの方法及びシステム
CN111383333B (zh) 一种分段式sfm三维重建方法
US11270415B2 (en) Image inpainting with geometric and photometric transformations
CN112348958A (zh) 关键帧图像的采集方法、装置、系统和三维重建方法
CN115035235A (zh) 三维重建方法及装置
JP2022515517A (ja) 画像深度推定方法および装置、電子機器、ならびに記憶媒体
WO2022247126A1 (zh) 视觉定位方法、装置、设备、介质及程序
CN112734630B (zh) 正射影像处理方法、装置、设备及存储介质
CN113724365B (zh) 一种三维重建方法及装置
Fu et al. Image stitching techniques applied to plane or 3-D models: a review
CN112002007A (zh) 基于空地影像的模型获取方法及装置、设备、存储介质
CN116704111A (zh) 图像处理方法和设备
CN113436269B (zh) 图像稠密立体匹配方法、装置和计算机设备
JP5478533B2 (ja) 全方位画像生成方法、画像生成装置およびプログラム

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

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

Country of ref document: EP

Kind code of ref document: A1