CN108564536B - A global optimization method for depth maps - Google Patents
A global optimization method for depth maps Download PDFInfo
- Publication number
- CN108564536B CN108564536B CN201711406513.2A CN201711406513A CN108564536B CN 108564536 B CN108564536 B CN 108564536B CN 201711406513 A CN201711406513 A CN 201711406513A CN 108564536 B CN108564536 B CN 108564536B
- Authority
- CN
- China
- Prior art keywords
- data
- depth
- view
- optimized
- perspective
- Prior art date
- Legal status (The legal status 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 status listed.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims abstract description 74
- 238000005457 optimization Methods 0.000 title claims abstract description 41
- 239000011159 matrix material Substances 0.000 claims description 30
- 238000004364 calculation method Methods 0.000 claims description 6
- 238000001914 filtration Methods 0.000 claims description 5
- 238000012937 correction Methods 0.000 claims description 3
- 238000002474 experimental method Methods 0.000 abstract description 3
- 238000009795 derivation Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 230000003238 somatosensory effect Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 230000009977 dual effect Effects 0.000 description 1
- 239000003550 marker Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/70—Denoising; Smoothing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/30—Determination of transform parameters for the alignment of images, i.e. image registration
- G06T7/33—Determination of transform parameters for the alignment of images, i.e. image registration using feature-based methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/50—Depth or shape recovery
- G06T7/55—Depth or shape recovery from multiple images
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Processing (AREA)
Abstract
一种深度图的全局优化方法,该方法充分利用左右视角视差数据的差值信息和颜色数据的边缘梯度信息来对深度图进行全局优化。首先,基于区域生长法分别对初始左右视角视差数据进行区域滤波,去除孤立的小块状有误视差;然后,利用优化后的左右视差数据的差值信息并采用
模型来计算视差置信度系数数据,实验证明该方法简洁有效;最后,将左视角视差数据和置信度系数数据,经视角投影转换成彩色相机视角下的初始深度数据和置信度数据,充分利用彩色图像的边缘信息,构造关于深度数据的线性方程组,通过超松弛迭代法解算可得优化后深度数据。该方法可实时获取高精度深度数据,经过优化的深度图光滑、保有边缘且大片空洞能较好填充。A global optimization method of depth map, which fully utilizes the difference information of left and right viewing angle disparity data and the edge gradient information of color data to optimize the depth map globally. First, based on the region growing method, the initial left and right viewing angle disparity data are regionally filtered to remove the isolated small block-shaped erroneous disparity; then, the optimized left and right disparity data difference information is used to
The model is used to calculate the parallax confidence coefficient data, and the experiment proves that the method is simple and effective; finally, the left perspective parallax data and confidence coefficient data are converted into the initial depth data and confidence data under the perspective of the color camera through perspective projection, making full use of the color The edge information of the image is used to construct a linear equation system about the depth data, and the optimized depth data can be obtained by solving the over-relaxation iterative method. This method can obtain high-precision depth data in real time, and the optimized depth map is smooth, retains edges, and can fill large holes well.Description
技术领域technical field
本发明涉及计算机视觉、图像处理技术领域,具体的说是一种深度图的全局优化方法。The invention relates to the technical fields of computer vision and image processing, in particular to a global optimization method of a depth map.
背景技术Background technique
从不同视角获取场景的两幅图像,可通过场景在两幅图像中的位置偏移来估算场景的深度信息。这种位置偏移对应为图像像素点的视差,可直接转换为场景深度,一般用深度图表示。然而,当场景出现纹理缺失和纹理重复时,计算的深度图在对应区域上可能出现大片空洞。现有的方法,一方面,通过对场景进行人为补偿(如粘贴标志点、投射光斑等)来丰富纹理,但存在操作不便、无法操作、不起作用等情况;另一方面,直接对深度图进行优化,但存在方法复杂、过度优化或不符实际等情况。Two images of the scene are acquired from different viewpoints, and the depth information of the scene can be estimated by the position offset of the scene in the two images. This position offset corresponds to the disparity of image pixels, which can be directly converted into scene depth, which is generally represented by a depth map. However, when the scene has texture missing and texture duplication, the calculated depth map may have large holes in the corresponding area. The existing method, on the one hand, enriches the texture by artificially compensating the scene (such as pasting marker points, projecting light spots, etc.), but it is inconvenient, inoperable, and ineffective. Optimized, but the method is complex, over-optimized, or unrealistic.
发明内容SUMMARY OF THE INVENTION
为了解决现有技术中的不足,本发明提供了一种深度图的全局优化方法,该方法实现深度图的滤波去噪及大片空洞的填补,将左右视角视差数据转换到RGB相机视角下,充分利用RGB图像边缘信息,简洁高效。In order to solve the deficiencies in the prior art, the present invention provides a global optimization method for a depth map, which realizes the filtering and denoising of the depth map and the filling of large holes, and converts the left and right perspective parallax data to the RGB camera perspective. Using RGB image edge information, it is concise and efficient.
为了实现上述目的,本发明采用的具体方案为:一种深度图的全局优化方法,该方法包括如下步骤:In order to achieve the above object, the specific scheme adopted in the present invention is: a global optimization method for a depth map, the method comprising the following steps:
步骤一、基于区域生长法分别对初始左视角视差数据和初始右视角视差数据进行区域滤波,去除孤立的块状区域有误视差,得到优化后的左视角视差数据和优化后的右视角视差数据;基于区域生长法去除块状区域有误视差的具体过程如下:Step 1: Perform regional filtering on the initial left-perspective disparity data and the initial right-perspective disparity data based on the region growing method to remove the erroneous parallax in isolated blocky regions, and obtain optimized left-perspective disparity data and optimized right-perspective disparity data ; The specific process of removing the erroneous parallax in the block region based on the region growing method is as follows:
S1、新建两个大小与初始左视角视差数据和初始右视角视差数据相等且初值为零的图像 Buff和Dst,Buff用来记录生长过的像素点,Dst用来标记满足条件的图像块状区域;S1. Create two new images Buff and Dst whose size is equal to the initial left-view disparity data and the initial right-view disparity data and whose initial value is zero. Buff is used to record the grown pixels, and Dst is used to mark the image blocks that meet the conditions. area;
S2、设定第一阈值和第二阈值;所述第一阈值为视差差值,第二阈值为块状区域有误视差的面积值;S2, setting a first threshold value and a second threshold value; the first threshold value is the parallax difference value, and the second threshold value is the area value of the block region with erroneous parallax;
S3、遍历每个未生长过的像素点,以当前点为种子点,压入区域生长函数;S3, traverse each ungrown pixel point, take the current point as the seed point, and press into the regional growth function;
S4、新建栈vectorGrowPoints和栈resultPoints,从栈vectorGrowPoints中取出末尾点,再按该点八个方向:{-1,-1},{0,-1},{1,-1},{1,0},{1,1},{0, 1},{-1,1},{-1,0}取出未生长过的像素点视差值与种子点视差值进行比较,若小于第一阈值,则认为符合条件,分别压入栈vectorGrowPoints和栈resultPoints中,并将生长过的点在Buff中做标记,重复上述过程,直到栈vectorGrowPoints中没有点为止;若栈resultPoints中的点数小于第二阈值,则在Dst中做标记;S4. Create a stack vectorGrowPoints and a stack resultPoints, take the end point from the stack vectorGrowPoints, and then press the point in eight directions: {-1, -1}, {0, -1}, {1, -1}, {1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 0} Take out the disparity value of the ungrown pixel point and compare it with the disparity value of the seed point. If a threshold is reached, it is considered that the conditions are met, and they are pushed into the stack vectorGrowPoints and the stack resultPoints respectively, and the grown points are marked in the Buff, and the above process is repeated until there are no points in the stack vectorGrowPoints; if the number of points in the stack resultPoints is less than the first point The second threshold is marked in Dst;
S5、重复步骤S3和S4,将Dst中做过标记的区域在视差数据中去除,得到优化后的左视角视差数据和优化后的右视角视差数据;S5, repeating steps S3 and S4, removing the marked area in Dst from the disparity data, to obtain optimized left-view disparity data and optimized right-view disparity data;
步骤二、由步骤一优化后的左视角视差数据和优化后的右视角视差数据计算左视角置信度系数数据;计算左视角置信度系数数据的具体方法为:Op=e-|ld-rd|,其中,ld为步骤一优化后的左视角视差数据,rd为对应的步骤一优化后的右视角视差数据,Op为左视角置信度系数数据;Step 2: Calculate the left-view confidence coefficient data from the optimized left-view parallax data and the optimized right-view parallax data in
步骤三、由步骤一优化后的左视角视差数据和相机参数计算左视角深度数据;将左视角深度数据和步骤二得到的左视角置信度系数数据同时通过视角投影转换,得到RGB相机视角下的初始深度数据和置信度系数数据;Step 3: Calculate the left-view depth data from the left-view parallax data and camera parameters optimized in
步骤四、利用RGB图像边缘信息计算边缘约束系数数据,之后将边缘约束系数数据、步骤三RGB相机视角下的初始深度数据和置信度系数数据利用全局优化目标函数生成优化后的深度数据。Step 4: Use the RGB image edge information to calculate edge constraint coefficient data, and then use the edge constraint coefficient data, the initial depth data and confidence coefficient data from the perspective of the RGB camera in step 3 to generate optimized depth data using the global optimization objective function.
作为优选的,获取深度图像过程中用到一种获取装置,所述获取装置包括两个近红外相机和一个RGB相机。Preferably, an acquisition device is used in the process of acquiring the depth image, and the acquisition device includes two near-infrared cameras and one RGB camera.
作为优选的,步骤三中,RGB相机视角下的初始深度数据具体计算过程如下:Preferably, in step 3, the specific calculation process of the initial depth data from the perspective of the RGB camera is as follows:
T1、遍历图像像素,已知左右近红外相机基线和焦距,将视差值转换为左视角深度数据;T1, traverse the image pixels, know the baseline and focal length of the left and right near-infrared cameras, and convert the parallax value into the depth data of the left perspective;
T2、由左视角深度数据及左近红外相机或者近红外右相机的内参数,计算对应空间点在相应坐标系下的三维坐标;T2. Calculate the three-dimensional coordinates of the corresponding spatial point in the corresponding coordinate system from the depth data of the left perspective and the internal parameters of the left near-infrared camera or the near-infrared right camera;
T3、由左近红外相机或者右近红外相机坐标系与RGB相机坐标系的相对位置关系及左右近红外相机之间的立体矫正矩阵,计算对应空间点在RGB相机坐标系下的三维坐标;T4、由 RGB相机的内参数,计算对应空间点在RGB图像平面上的投影及深度值,即得RGB相机视角下的初始深度数据。T3. Calculate the three-dimensional coordinates of the corresponding space point in the RGB camera coordinate system from the relative positional relationship between the left near-infrared camera or the right near-infrared camera coordinate system and the RGB camera coordinate system and the stereo correction matrix between the left and right near-infrared cameras; T4, by The internal parameters of the RGB camera are calculated by calculating the projection and depth value of the corresponding spatial point on the RGB image plane, that is, the initial depth data under the perspective of the RGB camera.
作为优选的,步骤四采用的全局优化目标函数为:Preferably, the global optimization objective function adopted in step 4 is:
其中,为图像上像素点p的初始深度数据,Dp为待求深度数据,αp为像素点p在RGB相机视角下的置信度系数数据,ωqp为边缘约束系数数据,q为p的四邻域像素点;当ε(D)最小时,优化结束;假设图像有n个像素点,为使ε(D)达到最小,令全局优化目标函数等号右侧部分对每一个Dp求导等于零,得到n个方程,整理得AX=B的线性方程组,其中A为n×n的系数矩阵,与αp和ωqp有关,B为n×1的常数矩阵,与αp和有关,X即为待求深度数据列向量[D1,D2,…,Dn]T,通过迭代计算,得优化后的深度数据。in, is the initial depth data of the pixel p on the image, D p is the depth data to be obtained, α p is the confidence coefficient data of the pixel p in the RGB camera perspective, ω qp is the edge constraint coefficient data, and q is the four neighborhoods of p Pixel point; when ε(D) is the smallest, the optimization ends; assuming that the image has n pixels, in order to minimize ε(D), the right part of the equal sign of the global optimization objective function is made equal to zero for each D p derivation, Obtain n equations, and arrange a linear equation system of AX=B, where A is a coefficient matrix of n × n, which is related to α p and ω qp , B is a constant matrix of n × 1, and α p and Relevant, X is the depth data column vector [ D 1 , D 2 , .
作为优选的,对任意像素点p,AX=B中第p行为:计算得系数矩阵A和常数矩阵B。Preferably, for any pixel p, the p-th behavior in AX=B: The coefficient matrix A and the constant matrix B are calculated.
作为优选的,系数矩阵A和常数矩阵B的具体计算过程如下:Preferably, the specific calculation process of the coefficient matrix A and the constant matrix B is as follows:
(1)、首先对RGB图像求梯度 为像素点q和p的灰度差值,然后 其取值范围在[0,1]之间,其中β为调优参数,且β=20;(1), first find the gradient of the RGB image is the grayscale difference between pixels q and p, and then Its value range is between [0, 1], where β is a tuning parameter, and β=20;
(2)、由αp和ωqp计算系数矩阵A,其中A的第p行为:(αp+∑(p,q)∈E(ωpq+ ωqp))Dp-∑(p,q)∈E(ωpq+ωqp)Dq,得该行有5个非零值,所述5个非零值为该像素点p和该像素点p的四邻域像素点对应元素,其中,该像素点p所对应的元素为αp+∑(p,q)∈E(ωpq+ωqp),该像素点p的四邻域像素点q所对应的元素为-(ωpq+ωqp);(2) Calculate the coefficient matrix A from α p and ω qp , where the p-th row of A: (α p + ∑ (p, q)∈E (ω pq + ω qp ))D p -∑ (p, q )∈E (ω pq +ω qp )D q , the row has 5 non-zero values, and the 5 non-zero values are the corresponding elements of the pixel point p and the four neighboring pixels of the pixel point p, wherein, The element corresponding to the pixel point p is α p +∑ (p, q)∈E (ω pq +ω qp ), and the element corresponding to the pixel point q in the four neighborhoods of the pixel point p is -(ω pq +ω qp );
(3)、由αp和初始深度数据计算常数矩阵B,其中B的第p行为 (3), by α p and the initial depth data Computes a constant matrix B where the pth row of B
作为优选的,采用超松弛迭代法解算线性方程组,得到优化后的深度数据。Preferably, an over-relaxation iterative method is used to solve the linear equation system to obtain the optimized depth data.
有益效果:Beneficial effects:
(1)本发明提供了一种深度图的全局优化方法,该方法基于一个获取装置,所述获取装置包括两个近红外相机(NIR)和一个可见光(RGB)相机,近红外相机构成一个双目立体视觉系统,实时获取深度图,并与可见光相机采集的RGB图像配准;充分利用左右视角视差数据的全局信息和颜色数据的边缘约束来对深度图进行全局优化,将左右视角视差数据转换到 RGB相机视角下,利用RGB图像边缘信息;在计算置信度系数数据时,采用e-x模型直接利用左右视角视差数据的方法,实验证明该方法简洁有效。简洁体现在:现有方法中,置信度系数的确定是通过拟合像素点相邻三个整数视差值的匹配代价二次曲线的方法,该法需要重新计算视差匹配代价,并对像素点的三个匹配代价值做二次拟合,通过判断曲线朝向来确定αp的正负值,因此,本发明方法与现有技术相比较为简洁;有效体现在:经过优化的深度图光滑、保有边缘且大片空洞能较好填充;(1) The present invention provides a global optimization method for a depth map. The method is based on an acquisition device. The acquisition device includes two near-infrared cameras (NIR) and one visible light (RGB) camera. The near-infrared cameras constitute a dual The stereo vision system can obtain the depth map in real time and register it with the RGB image collected by the visible light camera; make full use of the global information of the left and right perspective parallax data and the edge constraints of the color data to optimize the depth map globally, and convert the left and right perspective parallax data into In the RGB camera perspective, the edge information of the RGB image is used; when calculating the confidence coefficient data, the e- x model is used to directly use the left and right perspective disparity data. The experiment proves that the method is simple and effective. The simplicity is reflected in: in the existing method, the confidence coefficient is determined by fitting the matching cost quadratic curve of three adjacent integer disparity values of the pixel point. The three matching cost values of α are subjected to quadratic fitting, and the positive and negative values of α p are determined by judging the direction of the curve. Therefore, the method of the present invention is relatively simple compared with the prior art; it is effectively reflected in: the optimized depth map is smooth, Retain edges and large voids can be better filled;
(2)本发明提供了一种深度图的全局优化方法,采用区域生长法分别对初始左视角视差数据和初始右视角视差数据进行区域滤波,实验证明,该方法遍历一次图像即可完成标记,且能够有效地将视差值相似且明显不同于周围视差值的小块孤立区域有误视差去除。(2) The present invention provides a global optimization method for a depth map. The region growing method is used to perform regional filtering on the initial left-view disparity data and the initial right-view disparity data. Experiments have shown that the method can complete the marking by traversing the image once. And it can effectively remove the erroneous disparity in small isolated areas with similar disparity values and obviously different from the surrounding disparity values.
附图说明Description of drawings
图1是本发明流程图;Fig. 1 is the flow chart of the present invention;
图2为优化前头部大片空洞深度图;Figure 2 is the depth map of a large hole in the head before optimization;
图3为本发明全局优化方法优化后的深度图。FIG. 3 is a depth map after optimization by the global optimization method of the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
请参阅本发明流程图图1,本发明所有相机的内外参数均为已知,并通过现有技术计算得初始左视角视差数据和初始右视角视差数据,在此不做赘述。一种深度图的全局优化方法,该方法基于一个获取装置获取深度图像过程中用到一种获取装置,所述获取装置包括两个近红外相机和一个RGB相机,该方法包括如下步骤:Please refer to FIG. 1 of the flow chart of the present invention. The internal and external parameters of all cameras in the present invention are known, and the initial left-view disparity data and the initial right-view disparity data are calculated by the prior art, which will not be repeated here. A global optimization method for a depth map, the method uses an acquisition device in the process of acquiring a depth image based on an acquisition device, the acquisition device includes two near-infrared cameras and an RGB camera, and the method includes the following steps:
步骤一、基于区域生长法分别对初始左视角视差数据和初始右视角视差数据进行区域滤波,去除孤立的块状区域有误视差,得到优化后的左视角视差数据和优化后的右视角视差数据;一般生成的视差数据均经过左右校验,已经去除了大量误匹配的点视差,但仍存在呈小块区域的有误视差,本发明首先分别对左右视角视差数据进行区域滤波,去除视差值相似的小块孤立区域,进一步提高了视差质量,基于区域生长法去除块状区域有误视差的具体过程如下:Step 1: Perform regional filtering on the initial left-perspective disparity data and the initial right-perspective disparity data based on the region growing method to remove the erroneous parallax in isolated blocky regions, and obtain optimized left-perspective disparity data and optimized right-perspective disparity data Generally, the generated disparity data has been checked left and right, and a large number of incorrectly matched point disparities have been removed, but there are still erroneous disparities in small blocks. The small isolated areas with similar values further improve the parallax quality. The specific process of removing erroneous parallax in blocky areas based on the region growing method is as follows:
S1、新建两个大小与初始左视角视差数据和初始右视角视差数据相等且初值为零的图像 Buff和Dst,Buff用来记录生长过的像素点,Dst用来标记满足条件的图像块状区域;S1. Create two new images Buff and Dst whose size is equal to the initial left-view disparity data and the initial right-view disparity data and whose initial value is zero. Buff is used to record the grown pixels, and Dst is used to mark the image blocks that meet the conditions. area;
S2、设定第一阈值和第二阈值;所述第一阈值为视差差值,第二阈值为块状区域有误视差的面积值;作为优选的,所述第一阈值为10,第二阈值为60;S2. Set a first threshold value and a second threshold value; the first threshold value is the parallax difference value, and the second threshold value is the area value of the block region with erroneous parallax; The threshold is 60;
S3、遍历每个未生长过的像素点,以当前点为种子点,压入区域生长函数;S3, traverse each ungrown pixel point, take the current point as the seed point, and press into the regional growth function;
S4、新建栈vectorGrowPoints和栈resultPoints,从栈vectorGrowPoints中取出末尾点,再按该点八个方向:{-1,-1},{0,-1},{1,-1},{1,0},{1,1},{0, 1},{-1,1},{-1,0}取出未生长过的像素点视差值与种子点视差值进行比较,若小于第一阈值,则认为符合条件,分别压入栈vectorGrowPoints和栈resultPoints中,并将生长过的点在Buff中做标记,重复上述过程,直到栈vectorGrowPoints中没有点为止;若栈resultPoints中的点数小于第二阈值,则在Dst中做标记;S4. Create a stack vectorGrowPoints and a stack resultPoints, take the end point from the stack vectorGrowPoints, and then press the point in eight directions: {-1, -1}, {0, -1}, {1, -1}, {1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 0} Take out the disparity value of the ungrown pixel point and compare it with the disparity value of the seed point. If a threshold is reached, it is considered that the conditions are met, and they are pushed into the stack vectorGrowPoints and the stack resultPoints respectively, and the grown points are marked in the Buff, and the above process is repeated until there are no points in the stack vectorGrowPoints; if the number of points in the stack resultPoints is less than the first point The second threshold is marked in Dst;
S5、重复步骤S3和S4,将Dst中做过标记的区域在视差数据中去除,得到优化后的左视角视差数据和优化后的右视角视差数据;S5, repeating steps S3 and S4, removing the marked area in Dst from the disparity data, to obtain optimized left-view disparity data and optimized right-view disparity data;
步骤二、由步骤一优化后的左视角视差数据和优化后的右视角视差数据计算左视角置信度系数数据;计算左视角置信度系数数据的具体方法为:Op=e-|ld-rd |,其中,ld为步骤一优化后左视角视差数据,rd为对应的步骤一优化后右视角视差数据,Op为左视角置信度系数数据;现有方法中,存在通过拟合匹配代价曲线确定该点视差置信度系数数据的方法,实现过程较繁琐,本发明计算置信度系数数据的方法简洁高效。左视角置信度系数数据对优化效果起决定性的作用,而Op取值的可信度又与视差数据的准确性紧密相关,视差数据中的小块有误视差会导致优化后对应区域出现大块有误深度数据,因此,本发明提出基于区域生长法去除块状有误视差的方法来提高视差质量;Step 2: Calculate the left-view confidence coefficient data from the optimized left-view parallax data and the optimized right-view parallax data in
步骤三、由步骤一优化后的左视角视差数据和相机参数计算左视角深度数据;将左视角深度数据和步骤二得到的左视角置信度系数数据同时通过视角投影转换,得到RGB相机视角下的初始深度数据和置信度系数数据;RGB相机视角下的初始深度数据具体计算过程如下:Step 3: Calculate the left-view depth data from the left-view parallax data and camera parameters optimized in
T1、遍历图像像素,已知左右近红外相机基线和焦距,将视差值转换为左视角深度数据;T1, traverse the image pixels, know the baseline and focal length of the left and right near-infrared cameras, and convert the parallax value into the depth data of the left perspective;
T2、由左视角深度数据及左近红外相机或者近红外右相机的内参数,计算对应空间点在相应坐标系下的三维坐标;T2. Calculate the three-dimensional coordinates of the corresponding spatial point in the corresponding coordinate system from the depth data of the left perspective and the internal parameters of the left near-infrared camera or the near-infrared right camera;
T3、由左近红外相机或者右近红外相机坐标系与RGB相机坐标系的相对位置关系及左右近红外相机之间的立体矫正矩阵,计算对应空间点在RGB相机坐标系下的三维坐标;T4、由 RGB相机的内参数,计算对应空间点在RGB图像平面上的投影及深度值,即得RGB相机视角下的初始深度数据;T3. Calculate the three-dimensional coordinates of the corresponding space point in the RGB camera coordinate system from the relative positional relationship between the left near-infrared camera or the right near-infrared camera coordinate system and the RGB camera coordinate system and the stereo correction matrix between the left and right near-infrared cameras; T4, by Calculate the internal parameters of the RGB camera, calculate the projection and depth value of the corresponding spatial point on the RGB image plane, and obtain the initial depth data under the RGB camera perspective;
步骤四、利用RGB图像边缘信息计算边缘约束系数数据,之后将边缘约束系数数据、步骤三RGB相机视角下的初始深度数据和置信度系数数据利用全局优化目标函数生成优化后的深度数据,采用的全局优化目标函数为:Step 4: Use the edge information of the RGB image to calculate the edge constraint coefficient data, and then use the edge constraint coefficient data, the initial depth data and confidence coefficient data from the perspective of the RGB camera in step 3 to generate the optimized depth data by using the global optimization objective function. The global optimization objective function is:
其中,为图像上像素点p的初始深度数据,Dp为待求深度数据,αp为像素点p在RGB相机视角下的置信度系数数据,ωqp为边缘约束系数数据,q为p的四邻域像素点;当ε(D)最小时,优化结束;假设图像有n个像素点,为使ε(D)达到最小,令全局优化目标函数等号右侧部分对每一个Dp求导等于零,得到n个方程,整理得AX=B的线性方程组,其中A为n×n的系数矩阵,与αp和ωqp有关,B为n×1的常数矩阵,与αp和有关,X即为待求深度数据列向量[D1,D2,…,Dn]T,通过迭代计算,得优化后的深度数据。in, is the initial depth data of the pixel p on the image, D p is the depth data to be obtained, α p is the confidence coefficient data of the pixel p in the RGB camera perspective, ω qp is the edge constraint coefficient data, and q is the four neighborhoods of p Pixel point; when ε(D) is the smallest, the optimization ends; assuming that the image has n pixels, in order to minimize ε(D), the right part of the equal sign of the global optimization objective function is made equal to zero for each D p derivation, Obtain n equations, and arrange a linear equation system of AX=B, where A is a coefficient matrix of n × n, which is related to α p and ω qp , B is a constant matrix of n × 1, and α p and Relevant, X is the depth data column vector [ D 1 , D 2 , .
对任意像素点p,AX=B中第p行为: 计算得系数矩阵A和常数矩阵B。For any pixel p, the pth row in AX=B: The coefficient matrix A and the constant matrix B are calculated.
步骤三已获取初始深度数据,下面计算系数矩阵和常数矩阵,对于百万分辨率的图像,深度数据量可达百万,而系数矩阵数据量是平方级,为满足GPU实时实现,本发明采用超松弛迭代法(SOR)解算线性方程组,完成深度数据优化,如图2和图3所示,图2为优化前头部大片空洞深度图;图3为利用本发明全局优化方法优化后的深度图。系数矩阵A和常数矩阵B的具体计算过程如下:In step 3, the initial depth data has been obtained, and the coefficient matrix and the constant matrix are calculated below. For an image with a resolution of one million, the amount of depth data can reach one million, and the amount of coefficient matrix data is square. In order to meet the real-time realization of GPU, the present invention adopts The over-relaxation iterative method (SOR) solves the linear equation system and completes the optimization of depth data, as shown in Figure 2 and Figure 3, Figure 2 is the depth map of a large cavity in the head before optimization; Figure 3 is after optimization using the global optimization method of the present invention. depth map. The specific calculation process of coefficient matrix A and constant matrix B is as follows:
(1)、首先对RGB图像求梯度 为像素点q和p的灰度差值,然后 其取值范围在[0,1]之间,其中β为调优参数,且β=20,通过此步骤求解ωqp,ωqp对深度效果的影响是保持深度边缘,使其不被过度平滑;(1), first find the gradient of the RGB image is the grayscale difference between pixels q and p, and then Its value range is between [0, 1], where β is a tuning parameter, and β=20, through this step to solve ω qp , the influence of ω qp on the depth effect is to keep the depth edge so that it is not over-smoothed ;
(2)、由αp和ωqp计算系数矩阵A,其中A的第p行为:(αp+∑(p,q)∈E(ωpq+ ωqp))Dp-∑(p,q)∈E(ωpq+ωqp)Dq,得该行有5个非零值,所述5个非零值为该像素点p和该像素点p的四邻域像素点对应元素,其中,该像素点p所对应的元素为αp+∑(p,q)∈E(ωpq+ωqp),该像素点p的四邻域像素点q所对应的元素为-(ωpq+ωqp);(2) Calculate the coefficient matrix A from α p and ω qp , where the p-th row of A: (α p + ∑ (p, q)∈E (ω pq + ω qp ))D p -∑ (p, q )∈E (ω pq +ω qp )D q , the row has 5 non-zero values, and the 5 non-zero values are the corresponding elements of the pixel point p and the four neighboring pixels of the pixel point p, wherein, The element corresponding to the pixel point p is α p +∑ (p, q)∈E (ω pq +ω qp ), and the element corresponding to the pixel point q in the four neighborhoods of the pixel point p is -(ω pq +ω qp );
(3)、由αp和初始深度数据计算常数矩阵B,其中B的第p行为 (3), by α p and the initial depth data Computes a constant matrix B where the pth row of B
(4)、由SOR法解算线性方程组,得到优化后的深度数据。(4), solve the linear equation system by the SOR method, and obtain the optimized depth data.
本发明提供了一种深度图的全局优化方法,该方法对场景初始深度进行全局优化,实现深度实时高精度获取,主要解决场景纹理缺少或重复时,导致计算的视差数据中存在大量空洞的问题,如头发处,纹理单一,且即使采用主动光源投射结构光,也极易被吸收而缺少特征。可用于三维重建、体感交互等案例中。在三维重建中,为实时高精度重建提供各个视角下的优质深度数据,可简化后续优化处理操作。在体感交互中,通过对不同交互者模型的建立,将真实画面展现在对方面前。The invention provides a global optimization method for a depth map. The method performs global optimization on the initial depth of the scene, realizes real-time high-precision acquisition of the depth, and mainly solves the problem of a large number of holes in the calculated parallax data when the scene texture is missing or repeated. , such as hair, the texture is single, and even if an active light source is used to project structured light, it is easily absorbed and lacks features. It can be used in 3D reconstruction, somatosensory interaction and other cases. In 3D reconstruction, high-quality depth data from various perspectives is provided for real-time high-precision reconstruction, which simplifies subsequent optimization processing operations. In somatosensory interaction, through the establishment of different interactor models, the real picture is displayed in front of each other.
还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should also be noted that in this document, relational terms such as first and second are used only to distinguish one entity or operation from another, and do not necessarily require or imply those entities or operations There is no such actual relationship or order between them. Moreover, the terms "comprising", "comprising" or any other variation thereof are intended to encompass a non-exclusive inclusion such that a process, method, article or device that includes a list of elements includes not only those elements, but also includes not explicitly listed or other elements inherent to such a process, method, article or apparatus. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in a process, method, article or apparatus that includes the element.
对所公开的实施例的上述说明,使本领域专业技术人员能够实现或使用本发明。对这些实施例的多种修改对本领域的专业技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本发明的精神或范围的情况下,在其它实施例中实现。因此,本发明将不会被限制于本文所示的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。The above description of the disclosed embodiments enables any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (7)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711406513.2A CN108564536B (en) | 2017-12-22 | 2017-12-22 | A global optimization method for depth maps |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711406513.2A CN108564536B (en) | 2017-12-22 | 2017-12-22 | A global optimization method for depth maps |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108564536A CN108564536A (en) | 2018-09-21 |
CN108564536B true CN108564536B (en) | 2020-11-24 |
Family
ID=63530387
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711406513.2A Expired - Fee Related CN108564536B (en) | 2017-12-22 | 2017-12-22 | A global optimization method for depth maps |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108564536B (en) |
Families Citing this family (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109633661A (en) * | 2018-11-28 | 2019-04-16 | 杭州凌像科技有限公司 | A kind of glass inspection systems merged based on RGB-D sensor with ultrasonic sensor and method |
CN110163898B (en) * | 2019-05-07 | 2023-08-11 | 腾讯科技(深圳)有限公司 | Depth information registration method, device, system, equipment and storage medium |
CN110288558B (en) * | 2019-06-26 | 2021-08-31 | 福州鑫图光电有限公司 | Super-depth-of-field image fusion method and terminal |
WO2021195940A1 (en) * | 2020-03-31 | 2021-10-07 | 深圳市大疆创新科技有限公司 | Image processing method and movable platform |
CN111862077B (en) * | 2020-07-30 | 2024-08-30 | 浙江大华技术股份有限公司 | Parallax map processing method and device, storage medium and electronic device |
CN112597334B (en) * | 2021-01-15 | 2021-09-28 | 天津帕克耐科技有限公司 | Data processing method of communication data center |
CN113570701B (en) * | 2021-07-13 | 2023-10-24 | 聚好看科技股份有限公司 | Hair reconstruction method and device |
CN115937290B (en) * | 2022-09-14 | 2024-03-22 | 北京字跳网络技术有限公司 | Image depth estimation method and device, electronic equipment and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8774512B2 (en) * | 2009-02-11 | 2014-07-08 | Thomson Licensing | Filling holes in depth maps |
WO2014149403A1 (en) * | 2013-03-15 | 2014-09-25 | Pelican Imaging Corporation | Extended color processing on pelican array cameras |
CN104240217A (en) * | 2013-06-09 | 2014-12-24 | 周宇 | Binocular camera image depth information acquisition method and device |
CN105023263A (en) * | 2014-04-22 | 2015-11-04 | 南京理工大学 | Shield detection and parallax correction method based on region growing |
CN106570903B (en) * | 2016-10-13 | 2019-06-18 | 华南理工大学 | A visual recognition and localization method based on RGB-D camera |
-
2017
- 2017-12-22 CN CN201711406513.2A patent/CN108564536B/en not_active Expired - Fee Related
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8774512B2 (en) * | 2009-02-11 | 2014-07-08 | Thomson Licensing | Filling holes in depth maps |
WO2014149403A1 (en) * | 2013-03-15 | 2014-09-25 | Pelican Imaging Corporation | Extended color processing on pelican array cameras |
CN104240217A (en) * | 2013-06-09 | 2014-12-24 | 周宇 | Binocular camera image depth information acquisition method and device |
CN105023263A (en) * | 2014-04-22 | 2015-11-04 | 南京理工大学 | Shield detection and parallax correction method based on region growing |
CN106570903B (en) * | 2016-10-13 | 2019-06-18 | 华南理工大学 | A visual recognition and localization method based on RGB-D camera |
Also Published As
Publication number | Publication date |
---|---|
CN108564536A (en) | 2018-09-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108564536B (en) | A global optimization method for depth maps | |
CN103971408B (en) | Three-dimensional facial model generating system and method | |
CN111563921B (en) | An underwater point cloud acquisition method based on binocular camera | |
CN104065947B (en) | The depth map acquisition methods of a kind of integration imaging system | |
KR101310589B1 (en) | Techniques for rapid stereo reconstruction from images | |
CN106023303B (en) | A method of Three-dimensional Gravity is improved based on profile validity and is laid foundations the dense degree of cloud | |
CN102930530B (en) | Stereo matching method of double-viewpoint image | |
CN105023275B (en) | Super-resolution optical field acquisition device and its three-dimensional rebuilding method | |
CN106204731A (en) | A kind of multi-view angle three-dimensional method for reconstructing based on Binocular Stereo Vision System | |
CN113362247A (en) | Semantic live-action three-dimensional reconstruction method and system of laser fusion multi-view camera | |
CN103456038A (en) | Method for rebuilding three-dimensional scene of downhole environment | |
CN103106688A (en) | Indoor three-dimensional scene rebuilding method based on double-layer rectification method | |
CN103236082A (en) | Quasi-three dimensional reconstruction method for acquiring two-dimensional videos of static scenes | |
CN110853151A (en) | Three-dimensional point set recovery method based on video | |
CN102034265A (en) | Three-dimensional view acquisition method | |
KR101714224B1 (en) | 3 dimension image reconstruction apparatus and method based on sensor fusion | |
CN111462030A (en) | Multi-image fused stereoscopic set vision new angle construction drawing method | |
CN101873509A (en) | A Method for Eliminating Background and Edge Jitter of Depth Map Sequences | |
WO2018032841A1 (en) | Method, device and system for drawing three-dimensional image | |
CN102368826A (en) | Real time adaptive generation method from double-viewpoint video to multi-viewpoint video | |
CN104680544B (en) | Variational Scene Flow Estimation Method Based on 3D Flow Field Regularization | |
CN103093460A (en) | Moving camera virtual array calibration method based on parallel parallax | |
CN104182968A (en) | Method for segmenting fuzzy moving targets by wide-baseline multi-array optical detection system | |
CN106023189B (en) | A kind of light field data depth reconstruction method based on matching optimization | |
CN103679739A (en) | Virtual view generating method based on shielding region detection |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
TR01 | Transfer of patent right | ||
TR01 | Transfer of patent right |
Effective date of registration: 20220329 Address after: 471000 floor 10-11, East Tower, Xiaowen Avenue science and technology building, Yibin District, Luoyang City, Henan Province Patentee after: Luoyang Zhongke Information Industry Research Institute Patentee after: LUOYANG ZHONGKE ZHONGCHUANG SPACE TECHNOLOGY CO.,LTD. Address before: 471000 room 216, building 11, phase I standardized plant, Yibin District Industrial Park, Luoyang City, Henan Province Patentee before: LUOYANG ZHONGKE ZHONGCHUANG SPACE TECHNOLOGY CO.,LTD. |
|
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20201124 |