CN105046657A - Image stretching distortion adaptive correction method - Google Patents
Image stretching distortion adaptive correction method Download PDFInfo
- Publication number
- CN105046657A CN105046657A CN201510354230.2A CN201510354230A CN105046657A CN 105046657 A CN105046657 A CN 105046657A CN 201510354230 A CN201510354230 A CN 201510354230A CN 105046657 A CN105046657 A CN 105046657A
- Authority
- CN
- China
- Prior art keywords
- mrow
- msub
- msup
- mfrac
- energy function
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/80—Geometric correction
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/60—Rotation of whole images or parts thereof
- G06T3/608—Rotation of whole images or parts thereof by skew deformation, e.g. two-pass or three-pass rotation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10004—Still image; Photographic image
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10052—Images from lightfield camera
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Image Processing (AREA)
Abstract
本发明提出了一种图像拉伸畸变自适应校正方法。首先将图像划分为均匀方形网格并建立输入输出坐标;其次通过人脸检测算法确定出人物区域与背景区域,分别为各个区域建立单应性约束,以校正人物区域中出现的拉伸畸变,并为相邻区域建立单应性兼容约束,保证各个区域的连续性;通过直线检测算法确定直线区域,为直线区域建立直线保持约束,以保证校正后的直线不出现弯曲;通过全局坐标平滑和均匀性约束保证整幅图像一致连续。再将上述约束表述为能量函数,并加入权重,将各个能量方程相加。使用最小二乘方法计算出能量最小时的坐标值,即得到校正后的图像坐标值。最后使用双线性映射进行渲染得到最终校正图像。
The invention proposes an image stretching distortion self-adaptive correction method. First, the image is divided into uniform square grids and the input and output coordinates are established; secondly, the character area and the background area are determined through the face detection algorithm, and homography constraints are established for each area to correct the stretching distortion in the character area. And establish homography compatibility constraints for adjacent regions to ensure the continuity of each region; determine the straight region through the straight line detection algorithm, and establish straight line maintenance constraints for the straight line area to ensure that the corrected straight line does not appear curved; through global coordinate smoothing and Uniformity constraints ensure that the entire image is consistent and continuous. Then express the above constraints as energy functions, add weights, and add up the energy equations. The least square method is used to calculate the coordinate value when the energy is minimum, that is, the corrected image coordinate value is obtained. Finally, the bilinear map is used for rendering to obtain the final rectified image.
Description
技术领域technical field
本发明涉及一种数字图像处理技术,尤其涉及一种图像拉伸畸变自适应校正方法。The invention relates to a digital image processing technology, in particular to an image stretching distortion adaptive correction method.
背景技术Background technique
照相机广角镜头能获取较大视场的图像,但也容易引入图像畸变。其中一种畸变是当广角镜头遵循针孔成像模型进行成像,并且成像场景中有物体靠近相机并处在视场边缘时,拍摄后的图像中该物体由于透视效应会被严重拉伸,造成该物体几何形状的失真。特别是该物体是人脸或人物时,由于人眼对人脸和人物图像的畸变较为敏感,该拉伸畸变更为明显。因此,需要对出现物体拉伸畸变的图像进行校正,使得图像符合人眼视觉。The wide-angle lens of the camera can obtain images with a larger field of view, but it is also easy to introduce image distortion. One of the distortions is that when the wide-angle lens follows the pinhole imaging model for imaging, and there is an object in the imaging scene that is close to the camera and at the edge of the field of view, the object in the captured image will be severely stretched due to the perspective effect, causing the object Distortion of geometric shapes. Especially when the object is a human face or a person, since the human eye is more sensitive to the distortion of the image of the human face or person, the stretching distortion becomes more obvious. Therefore, it is necessary to correct the image with stretching distortion of the object so that the image conforms to human vision.
然而,图像场景中的直线会因为校正了物体的拉伸而受到弯曲,因此,需要在在校正拉伸畸变同时使得其他场景或物体保持不受影响。However, the straight lines in the image scene will be bent due to the correction of the stretching of the object. Therefore, it is necessary to correct the stretching distortion while keeping other scenes or objects unaffected.
此外,全景图像本质上也是一种广角图像。当全景图像采用线性透视投影时,该图像也会出现拉伸畸变。In addition, a panoramic image is essentially a wide-angle image. When a panoramic image is projected from a linear perspective, the image will also appear stretched.
在现有的技术中有通过改变投影中心的全局投影校正方法,有通过将图像背景与人物相分离再分别校正的方法,有优化的保持图像内容的投影校正方法。In the existing technology, there is a global projection correction method by changing the projection center, there is a method by separating the image background from the person and correcting them separately, and there is an optimized projection correction method that maintains the image content.
发明内容Contents of the invention
本发明的目的在于针对现有技术的不足,提供一种图像拉伸畸变自适应校正方法,在保持图像中背景直线笔直的同时校正图像中物体尤其是人物出现的拉伸畸变。The object of the present invention is to address the deficiencies in the prior art and provide an adaptive correction method for image stretching distortion, which corrects the stretching distortion of objects in the image, especially characters, while keeping the background straight in the image.
本发明的目的是通过以下技术方案实现的:一种图像拉伸畸变自适应校正方法,所述方法包括以下步骤:The purpose of the present invention is achieved by the following technical solutions: a method for self-adaptive correction of image stretching distortion, said method comprising the following steps:
步骤A:输入带有物体拉伸畸变的图像。Step A: Input an image with object stretching distortion.
步骤B:建立网格及坐标,将带有物体拉伸畸变的图像划分为正方形均匀网格,网格交点坐标记为xi,j=(xi,j,yi,j),i,j为网格交点序号;设网格交点坐标xi,j校正后的坐标为ui,j=(ui,j,vi,j)。Step B: Establish the grid and coordinates, divide the image with object stretching distortion into a square uniform grid, and the grid intersection coordinates are marked as x i,j = ( xi,j ,y i,j ), i, j is the serial number of the grid intersection point; suppose the corrected coordinates of the grid intersection point x i,j are u i,j =(u i,j ,v i,j ).
步骤C:构造ui,j的约束能量函数。Step C: Construct the constrained energy function of u i,j .
步骤C1:构造单应性约束能量函数。计算出将人物区域旋转至视场中心需要旋转的角度计算公式为:Step C1: Construct a homography-constrained energy function. Calculate the angle needed to rotate the character area to the center of the field of view The calculation formula is:
其中L为人物区域中心到视场中心的水平偏移距离,f为焦距,L和f均转化为以像素数为单位。则人物区域的单应性变换可写为:Among them, L is the horizontal offset distance from the center of the character area to the center of the field of view, f is the focal length, and both L and f are converted to the number of pixels. Then the homography transformation of the character area can be written as:
将上式描述的单应性变换记为H(xi,j),则可以定义人物区域网格点单应性约束的能量函数:Denote the homography transformation described by the above formula as H( xi,j ), then the energy function of the homography constraint of grid points in the character area can be defined:
其中,P1为人物区域网格点的集合。Among them, P 1 is the set of grid points in the character area.
背景区域网格点的单应性约束能量函数定义为:The homography-constrained energy function of the grid points in the background region is defined as:
其中,P2为背景区域网格点的集合。Among them, P2 is the set of grid points in the background area.
总的单应性约束能量函数即为The total homography-constrained energy function is
步骤C2:构造单应性兼容约束能量函数。Step C2: Construct a homography compatible constrained energy function.
定义Phc为人物区域和背景区域间共有边界的网格点,H1、H2分别为背景区域和人物区域的单应性变换。则单应性兼容约束的能量函数为:Define P hc as the grid point sharing the boundary between the character area and the background area, and H 1 , H 2 are the homography transformations of the background area and the character area respectively. Then the energy function of the homography compatible constraint is:
步骤C3:构造直线保持约束能量函数。首先使用直线段检测算法检测图像中除人物之外背景区域中的直线段。将检测到的直线集合定义为L。Step C3: Construct a straight line preserving constraint energy function. Firstly, a straight line segment detection algorithm is used to detect the straight line segment in the background area of the image except the person. Define the set of detected lines as L.
在每一个有直线经过的网格中定义一个虚拟点 Define a virtual point in each grid through which a line passes
其中系数a,b,c,d由与u-v坐标相对应的x-y坐标值经双线性插值计算得到。计算公式为:The coefficients a, b, c, d are calculated by bilinear interpolation from the x-y coordinate values corresponding to the u-v coordinates. The calculation formula is:
其中,取为网格块内线段的中点。in, Taken as the midpoint of the line segment within the grid block.
对于任意一条直线,定义其起始点和终点分别为ustart和uend。For any straight line, define its starting point and end point as u start and u end respectively.
计算曲线上的点ui,j与该点到直线上投影点之间的距离D,并将D约束为零。由几何关系可以得到,该距离D的计算式为Calculate the distance D between the point u i,j on the curve and the projected point on the straight line, and constrain D to be zero. It can be obtained from the geometric relationship that the calculation formula of the distance D is
D=|(ui,j-ustart)Tn|D=|(u i,j -u start ) T n|
其中,n=(n1,n2)为直线的单位法向量。计算出距离D,则可定义直线保持约束的能量函数为Wherein, n=(n 1 , n 2 ) is the unit normal vector of the straight line. After calculating the distance D, the energy function of the line-keeping constraint can be defined as
步骤C4:构造全局坐标平滑约束能量函数。定义u-v坐标的雅可比矩阵为Step C4: Construct a global coordinate smoothing constrained energy function. The Jacobian matrix defining the u-v coordinates is
当雅可比矩阵中的各项满足柯西-黎曼方程:When the terms in the Jacobian matrix satisfy the Cauchy-Riemann equation:
可实现坐标的连续平滑。将上式离散化得:Continuous smoothing of coordinates is possible. Discretize the above formula to get:
ui+1,j-ui,j=vi,j+1-vi,j u i+1,j -u i,j =v i,j+1 -v i,j
ui,j+1-ui,j=-(vi+1,j-vi,j);u i,j+1 -u i,j =-(v i+1,j -v i,j );
通过上式可计算坐标平滑约束能量函数:The coordinate smoothing constraint energy function can be calculated by the above formula:
Es=Σ((ui+1,j-ui,j)-(vi,j+1-vi,j))2+Σ((vi+1,j-vi,j)+(ui,j+1-ui,j))2;E s =Σ((u i+1,j -u i,j )-(v i,j+1 -v i,j )) 2 +Σ((v i+1,j -v i,j ) +(u i,j+1 -u i,j )) 2 ;
步骤C5:构造全局坐标均匀约束能量函数。将拉普拉斯算子离散化,可定义全局坐标均匀约束的能量函数为Step C5: Construct a global coordinate uniformly constrained energy function. By discretizing the Laplacian operator, the energy function of the global coordinate uniform constraint can be defined as
步骤D:线性最小二乘求解。为每一个能量函数添加权重系数并将各能量函数相加得到总能量函数为:Step D: Linear least squares solution. Add weight coefficients for each energy function and add up the energy functions to get the total energy function as:
使E=0,则Eh,Ehc,El,Es,Eu均需为0,由此可以构造出线性方程组Make E=0, then E h , E hc , E l , E s , E u must all be 0, and thus a linear equation system can be constructed
Ax=bAx=b
其中A为约束矩阵,包含约束能量函数中的ui,j前的各个系数。x为包含待求未知量ui,j和vi,j的列向量,b包含各个方程的常数项。Wherein A is the constraint matrix, including the coefficients before u i, j in the constraint energy function. x is a column vector containing the unknown quantities u i, j and v i, j , and b contains the constant terms of each equation.
用线性最小二乘法对x进行求解,求解公式为Use the linear least squares method to solve x, and the solution formula is
x=(ATA)-1ATbx=(A T A) -1 A T b
步骤E:求解出网格点坐标ui,j和vi,j后,采用双线性映射计算出除网格点之外任意点(x,y)校正后的坐标为Step E: After solving the grid point coordinates u i, j and v i, j , use bilinear mapping to calculate the corrected coordinates of any point (x, y) other than the grid point as
(u,v)=(1-x)(1-y)p1+x(1-y)p2+(1-x)yp3+xyp4。(u,v)=(1-x)(1-y)p1+x(1-y)p2+(1-x)yp3+xyp4.
其中,p1,p2,p3,p4分别为点(x,y)所在网格的4个网格点坐标,p1为左上角网格点坐标,p2为右上角网格点坐标,p3为左下角网格点坐标,p4为右下角网格点坐标。Among them, p1, p2, p3, and p4 are the four grid point coordinates of the grid where the point (x, y) is located, p1 is the grid point coordinates of the upper left corner, p2 is the grid point coordinates of the upper right corner, and p3 is the lower left corner Grid point coordinates, p4 is the grid point coordinates in the lower right corner.
步骤F:计算出校正坐标(u,v)后。通过从输入坐标值(x,y)到计算得到的坐标值(u,v)的重映射和插值,得到校正图像。Step F: After calculating the corrected coordinates (u, v). The rectified image is obtained by remapping and interpolating from input coordinate values (x, y) to calculated coordinate values (u, v).
本发明公开的方法相比现有的校正方法有以下几个特点:(1)既能校正视场边缘处物体的拉伸畸变,又能保持背景直线不受弯曲;(2)校正结果图像内容连续一致,无切割想象出现;(3)校正后图像的视场损失较小;(4)校正方法自动完成,无需人工干预。Compared with the existing correction methods, the method disclosed in the present invention has the following characteristics: (1) It can not only correct the stretching distortion of the object at the edge of the field of view, but also keep the background straight line from bending; (2) Correct the image content of the result Continuous and consistent, no cutting image appears; (3) The field of view loss of the corrected image is small; (4) The correction method is automatically completed without manual intervention.
附图说明Description of drawings
图1是本发明一种图像拉伸畸变校正方法的流程图;Fig. 1 is a flow chart of an image stretching distortion correction method of the present invention;
图2是带有本发明所描述的拉伸畸变的示例图像;Figure 2 is an example image with stretch distortion as described in the present invention;
图3是网格的建立和坐标的定义示意图;Fig. 3 is the establishment of grid and the definition schematic diagram of coordinate;
图4是图像区域的划分示意图;FIG. 4 is a schematic diagram of division of image regions;
图5是虚拟点的定义示意图;Fig. 5 is the definition sketch map of virtual point;
图6是距离D的计算示意图;Fig. 6 is the calculation schematic diagram of distance D;
图7是双线性映射示意图;Fig. 7 is a schematic diagram of bilinear mapping;
图8是经本发明方法校正后的示例图像;Fig. 8 is an example image corrected by the method of the present invention;
图9是本发明方法校正后的示例图像剪裁为矩形后的图像。FIG. 9 is an example image corrected by the method of the present invention and clipped into a rectangular image.
具体实施方式Detailed ways
本发明所述的图像拉伸畸变自适应校正方法包括接受带有物体拉伸畸变的图像;用均匀网格对图像进行划分并建立输入输出坐标系;将输入图像通过人脸检测算法检测人脸位置和大小,并通过该信息确定出人物所处的矩形区域和余下的背景区域;分别为各个区域建立单应性约束,以校正人物区域中出现的拉伸畸变,并为相邻区域建立单应性兼容约束,保证各个区域的连续性;通过直线检测算法确定直线区域,为直线区域建立直线保持约束,以保证校正后的直线不出现弯曲;建立全局坐标平滑和均匀性约束保证整幅图像一致连续;将上述约束表述为能量函数,并加入权重,将各个能量方程相加;将能量函数最小化以构造出线性方程组,使用最小二乘法计算该线性方程组,得到校正后的图像坐标值;使用双线性纹理映射进行渲染得到最终图像。The self-adaptive correction method for image stretching distortion of the present invention includes accepting an image with stretching distortion of an object; dividing the image with a uniform grid and establishing an input and output coordinate system; detecting the face of the input image through a face detection algorithm Position and size, and use this information to determine the rectangular area where the character is located and the remaining background area; establish homography constraints for each area to correct the stretching distortion in the character area, and establish a homography for the adjacent area Responsive compatibility constraints to ensure the continuity of each area; determine the straight line area through the straight line detection algorithm, and establish a straight line maintenance constraint for the straight line area to ensure that the corrected straight line does not appear curved; establish global coordinate smoothness and uniformity constraints to ensure the entire image Consistent and continuous; express the above constraints as energy functions, add weights, and add each energy equation; minimize the energy function to construct a linear equation system, use the least square method to calculate the linear equation system, and obtain the corrected image coordinates Value; the final image is rendered using bilinear texture mapping.
为更好地理解本发明的实现过程,下面将结合附图详细阐述本发明的一种图像拉伸畸变自适应校正方法。具体实施步骤的流程图参见图1,应用本发明的方法实现图像拉伸畸变校正的具体步骤如下:In order to better understand the implementation process of the present invention, an image stretching distortion adaptive correction method of the present invention will be described in detail below in conjunction with the accompanying drawings. Referring to Fig. 1 for the flow chart of specific implementation steps, the specific steps of applying the method of the present invention to realize image stretching distortion correction are as follows:
步骤A:输入带有物体拉伸畸变的图像。图2是带有人物拉伸畸变的图像的一个示例,畸变位置用双箭头标明。Step A: Input an image with object stretching distortion. Figure 2 is an example of an image with stretching distortion of a person, and the location of the distortion is marked with a double arrow.
步骤B:建立网格及坐标。以图2为例,如图3所示,将图像划分为正方形均匀网格,网格交点坐标记为xi,j=(xi,j,yi,j),i,j为网格交点序号。经图像扭曲后,待求解的坐标记为ui,j=(ui,j,vi,j)。Step B: Establish grid and coordinates. Taking Figure 2 as an example, as shown in Figure 3, the image is divided into square uniform grids, and the grid intersection coordinates are marked as x i,j = ( xi,j ,y i,j ), where i,j is the grid Intersection number. After the image is warped, the coordinates to be solved are marked as u i,j =(u i,j ,v i,j ).
步骤C:构造约束能量函数。Step C: Construct the constrained energy function.
步骤C1:构造单应性约束能量函数。出现拉伸畸变的原因是物体处在图像视场边缘,当旋转照相机使之正对物体并使物体处在视场中央拍摄时,则物体无拉伸畸变。因此,需要通过单应性变换(透视变换)改变图像局部区域的视角,以校正该区域中物体的拉伸畸变。首先,使用图像人脸检测算法检测人脸位置和大小,通过该信息确定出人物所处的矩形区域和余下的背景区域,以图2为例确定出的人物区域和背景区域如图4所示。计算出将人物区域旋转至视场中心需要旋转的角度计算公式为:Step C1: Construct a homography-constrained energy function. The reason for stretching distortion is that the object is at the edge of the image field of view. When the camera is rotated to face the object and the object is shot in the center of the field of view, the object has no stretching distortion. Therefore, it is necessary to change the viewing angle of a local area of the image through homography transformation (perspective transformation) to correct the stretching distortion of objects in this area. First, use the image face detection algorithm to detect the position and size of the face, and use this information to determine the rectangular area where the person is located and the remaining background area. Taking Figure 2 as an example, the figure area and background area determined are shown in Figure 4 . Calculate the angle needed to rotate the character area to the center of the field of view The calculation formula is:
其中L为人物区域中心到视场中心的水平偏移距离,f为焦距,L和f均转化为以像素数为单位。则人物区域的单应性变换可写为:Among them, L is the horizontal offset distance from the center of the character area to the center of the field of view, f is the focal length, and both L and f are converted to the number of pixels. Then the homography transformation of the character area can be written as:
将上式描述的单应性变换记为H(xi,j),则可以定义人物区域网格点单应性约束的能量函数:Denote the homography transformation described by the above formula as H( xi,j ), then the energy function of the homography constraint of grid points in the character area can be defined:
其中P1为人物区域网格点的集合。背景区域不需单应性变换,因此该区域网格点的单应性约束能量函数定义为:Among them, P 1 is the set of grid points in the character area. The background area does not require homography transformation, so the homography constraint energy function of the grid points in this area is defined as:
其中P2为背景区域网格点的集合。总的单应性约束能量函数即为where P2 is the set of grid points in the background area. The total homography-constrained energy function is
步骤C2:构造单应性兼容约束能量函数。人物区域和背景区域有公共的边。为了防止各个区域经过单应性变换之后造成区域相接部分出现错位现象,必须在区域的邻接部分加入单应性兼容约束。定义Phc为区域间共有边界的网格点,H1、H2分别为人物和背景区域的单应性变换。则单应性兼容约束的能量函数为:Step C2: Construct a homography compatible constrained energy function. The character region and the background region have common edges. In order to prevent the misalignment of the adjacent parts of the regions after each region undergoes homography transformation, it is necessary to add homography compatibility constraints to the adjacent parts of the regions. Define P hc as the grid point with a common boundary between regions, and H 1 and H 2 are the homography transformations of the character and background regions respectively. Then the energy function of the homography compatible constraint is:
所述单应性变换H1为:The homography transformation H 1 is:
所述单应性变换H2为3×3的单位矩阵。The homography transformation H 2 is a 3×3 identity matrix.
步骤C3:构造直线保持约束能量函数。保证图像中直线经校正后仍然保持笔直,需要加入直线保持约束。首先使用直线段检测算法检测图像中除人物之外背景区域的直线段。将检测到的直线集合定义为L。Step C3: Construct a straight line preserving constraint energy function. To ensure that the straight lines in the image remain straight after correction, it is necessary to add straight line maintenance constraints. Firstly, the straight line segment detection algorithm is used to detect the straight line segment in the background area of the image except the person. Define the set of detected lines as L.
由于并不是任何一条直线都经过网格点,因此如图5所示,在每一个有直线经过的网格中定义一个虚拟点 Since not any straight line passes through the grid points, as shown in Figure 5, a virtual point is defined in each grid where a straight line passes through
其中系数a,b,c,d由与u-v坐标相对应的x-y坐标值经双线性插值计算得到。计算公式为:The coefficients a, b, c, d are calculated by bilinear interpolation from the x-y coordinate values corresponding to the u-v coordinates. The calculation formula is:
其中,取为网格块内线段的中点。in, Taken as the midpoint of the line segment within the grid block.
对于任意一条直线,定义其起始点和终点分别为ustart和uend。如图6所示,为了将曲线拉直为直线,需要计算曲线上的点ui,j与该点到直线上投影点之间的距离D,并将D约束为零。由几何关系可以得到,该距离D的计算式为For any straight line, define its starting point and end point as u start and u end respectively. As shown in Figure 6, in order to straighten the curve into a straight line, it is necessary to calculate the distance D between the point u i,j on the curve and the projected point on the straight line, and constrain D to be zero. It can be obtained from the geometric relationship that the calculation formula of the distance D is
D=|(ui,j-ustart)Tn|D=|(u i,j -u start ) T n|
其中,n=(n1,n2)为直线的单位法向量。计算出距离D,则可定义直线保持约束的能量函数为Wherein, n=(n 1 , n 2 ) is the unit normal vector of the straight line. After calculating the distance D, the energy function of the line-keeping constraint can be defined as
步骤C4:构造全局坐标平滑约束能量函数。要使图像内容能够一致连续,需定义全局坐标平滑约束,定义u-v坐标的雅可比矩阵为Step C4: Construct a global coordinate smoothing constrained energy function. In order to make the image content consistent and continuous, it is necessary to define the global coordinate smoothing constraints, and define the Jacobian matrix of u-v coordinates as
当雅可比矩阵中的各项满足柯西-黎曼方程:When the terms in the Jacobian satisfy the Cauchy-Riemann equation:
时,可实现坐标的连续平滑。由于网格是离散的,将上式离散化得When , the continuous smoothing of coordinates can be realized. Since the grid is discrete, the above formula is discretized to get
ui+1,j-ui,j=vi,j+1-vi,j u i+1,j -u i,j =v i,j+1 -v i,j
ui,j+1-ui,j=-(vi+1,j-vi,j)u i,j+1 -u i,j =-(v i+1,j -v i,j )
通过上式可计算坐标平滑约束能量函数:The coordinate smoothing constraint energy function can be calculated by the above formula:
Es=Σ((ui+1,j-ui,j)-(vi,j+1-vi,j))2+Σ((vi+1,j-vi,j)+(ui,j+1-ui,j))2 E s =Σ((u i+1,j -u i,j )-(v i,j+1 -v i,j )) 2 +Σ((v i+1,j -v i,j ) +(u i,j+1 -u i,j )) 2
步骤C5:构造全局坐标均匀约束能量函数。仅考虑坐标平滑约束会使得最终校正图像外围网格比图像中部网格大很多。因此,有必要加入全局坐标均匀约束,使得图像内外的网格比例保持一致。拉普拉斯方程的解具有均匀性质,因此这里采用拉普拉斯算子。将拉普拉斯算子离散化,可定义坐标均匀约束的能量函数为Step C5: Construct a global coordinate uniformly constrained energy function. Only considering coordinate smoothing constraints will make the peripheral grid of the final corrected image much larger than the central grid of the image. Therefore, it is necessary to add global coordinate uniform constraints to keep the grid ratio inside and outside the image consistent. The solution of the Laplace equation has a uniform property, so the Laplace operator is used here. By discretizing the Laplacian operator, the energy function of coordinate uniform constraints can be defined as
步骤D:线性最小二乘求解。为每一个能量函数添加权重系数并将各能量函数相加得到总能量函数为:Step D: Linear least squares solution. Add weight coefficients for each energy function and add up the energy functions to get the total energy function as:
要使能量函数最小,需使E=0。E=0,则Eh,Ehc,El,Es,Eu均需为0,由此可以构造出线性方程组To minimize the energy function, it is necessary to make E=0. E=0, then E h , E hc , E l , E s , E u must all be 0, from which a system of linear equations can be constructed
Ax=bAx=b
其中A为约束矩阵,包含约束能量函数中的ui,j前的各个系数。X为包含待求未知量ui,j和vi,j的列向量,b包含各个方程的常数项。由于该线性方程组是超定的,可用线性最小二乘法对X进行求解,求解公式为Wherein A is the constraint matrix, including the coefficients before u i, j in the constraint energy function. X is a column vector containing the unknown quantities u i, j and v i, j , and b contains the constant terms of each equation. Since the system of linear equations is overdetermined, the linear least square method can be used to solve X , and the solution formula is
x=(ATA)-1ATbx=(A T A) -1 A T b
步骤E:求解出网格点坐标ui,j和vi,j后,需采用双线性映射计算出除网格点之外的其余坐标。如图7所示,已知网格点p1,p2,p3,p4坐标,网格内任意点(u,v)的计算式为Step E: After solving the coordinates u i,j and v i,j of the grid points, it is necessary to use bilinear mapping to calculate other coordinates except the grid points. As shown in Figure 7, the coordinates of grid points p1, p2, p3, and p4 are known, and the calculation formula of any point (u, v) in the grid is
(u,v)=(1-x)(1-y)p1+x(1-y)p2+(1-x)yp3+xyp4(u,v)=(1-x)(1-y)p1+x(1-y)p2+(1-x)yp3+xyp4
步骤F:计算出校正坐标(u,v)后。经过从输入坐标值到计算得到的坐标值的重映射和插值,即可得到最终校正图像,如图8所示。校正图像边界不规则,需剪裁为矩形后输出,如图9所示。Step F: After calculating the corrected coordinates (u, v). After remapping and interpolation from the input coordinate value to the calculated coordinate value, the final corrected image can be obtained, as shown in FIG. 8 . The corrected image has irregular borders and needs to be cropped into a rectangle for output, as shown in Figure 9.
Claims (1)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510354230.2A CN105046657B (en) | 2015-06-23 | 2015-06-23 | A kind of image stretch distortion self-adapting correction method |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510354230.2A CN105046657B (en) | 2015-06-23 | 2015-06-23 | A kind of image stretch distortion self-adapting correction method |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN105046657A true CN105046657A (en) | 2015-11-11 |
| CN105046657B CN105046657B (en) | 2018-02-09 |
Family
ID=54453177
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201510354230.2A Expired - Fee Related CN105046657B (en) | 2015-06-23 | 2015-06-23 | A kind of image stretch distortion self-adapting correction method |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN105046657B (en) |
Cited By (21)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105528758A (en) * | 2016-01-12 | 2016-04-27 | 武汉精测电子技术股份有限公司 | Image remapping method and device based on programmable logic device |
| CN106506970A (en) * | 2016-11-30 | 2017-03-15 | 宇龙计算机通信科技(深圳)有限公司 | A kind of image pickup method and terminal |
| CN107155017A (en) * | 2017-06-30 | 2017-09-12 | 上海兆芯集成电路有限公司 | Camera bearing calibration and the device using this method |
| CN107665477A (en) * | 2016-07-28 | 2018-02-06 | 三星电子株式会社 | The method of electronic equipment and control electronics |
| GB2559639A (en) * | 2017-09-08 | 2018-08-15 | Anthropics Tech Limited | Image manipulation |
| CN109146808A (en) * | 2018-08-01 | 2019-01-04 | 成都品果科技有限公司 | A kind of portrait U.S. type method and system |
| CN109544460A (en) * | 2017-09-22 | 2019-03-29 | 宝沃汽车(中国)有限公司 | Image correction method, device and vehicle |
| CN110232667A (en) * | 2019-06-17 | 2019-09-13 | 厦门美图之家科技有限公司 | Pattern distortion modification method, device, electronic equipment and readable storage medium storing program for executing |
| CN110276734A (en) * | 2019-06-24 | 2019-09-24 | Oppo广东移动通信有限公司 | Image distortion correction method and device |
| CN110689501A (en) * | 2019-09-29 | 2020-01-14 | 京东方科技集团股份有限公司 | Distortion correction method, device, electronic device and computer-readable storage medium |
| CN111008947A (en) * | 2019-12-09 | 2020-04-14 | Oppo广东移动通信有限公司 | Image processing method and device, terminal device and storage medium |
| CN111008605A (en) * | 2019-12-09 | 2020-04-14 | Oppo广东移动通信有限公司 | Method, device, terminal device and storage medium for straight line processing in face image |
| CN111091507A (en) * | 2019-12-09 | 2020-05-01 | Oppo广东移动通信有限公司 | Image processing method, image processing apparatus, electronic device, and storage medium |
| KR20210006900A (en) * | 2018-05-07 | 2021-01-19 | 구글 엘엘씨 | Correcting Perspective Distortion (PD) of the face |
| CN112529784A (en) * | 2019-09-18 | 2021-03-19 | 华为技术有限公司 | Image distortion correction method and device |
| CN112686824A (en) * | 2020-12-30 | 2021-04-20 | 北京迈格威科技有限公司 | Image correction method, image correction device, electronic equipment and computer readable medium |
| CN113052900A (en) * | 2021-04-23 | 2021-06-29 | 深圳市商汤科技有限公司 | Position determination method and device, electronic equipment and storage medium |
| CN114049281A (en) * | 2021-12-23 | 2022-02-15 | 厦门大学 | Wide-angle portrait photo distortion correction method based on self-adaptive grid |
| CN115205126A (en) * | 2021-04-09 | 2022-10-18 | Oppo广东移动通信有限公司 | Image distortion correction processing method, device, storage medium and electronic equipment |
| CN115587938A (en) * | 2021-07-05 | 2023-01-10 | 华为技术有限公司 | Video distortion correction method and related equipment |
| WO2024078233A1 (en) * | 2022-10-10 | 2024-04-18 | 杭州睿胜软件有限公司 | Text-containing image processing method and system, and storage medium |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101131435A (en) * | 2006-08-23 | 2008-02-27 | 中国石油集团东方地球物理勘探有限责任公司 | NMO correction stacking method preventing NMO stretching |
| US8447078B2 (en) * | 2006-05-08 | 2013-05-21 | Siemens Aktiengesellschaft | X-ray diagnostic device |
| CN103258328A (en) * | 2013-04-27 | 2013-08-21 | 浙江大学 | Method for locating distorted center of wide-field lens |
| CN103283214A (en) * | 2011-01-06 | 2013-09-04 | 松下电器产业株式会社 | Camera, distortion correction device and distortion correction method |
-
2015
- 2015-06-23 CN CN201510354230.2A patent/CN105046657B/en not_active Expired - Fee Related
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8447078B2 (en) * | 2006-05-08 | 2013-05-21 | Siemens Aktiengesellschaft | X-ray diagnostic device |
| CN101131435A (en) * | 2006-08-23 | 2008-02-27 | 中国石油集团东方地球物理勘探有限责任公司 | NMO correction stacking method preventing NMO stretching |
| CN103283214A (en) * | 2011-01-06 | 2013-09-04 | 松下电器产业株式会社 | Camera, distortion correction device and distortion correction method |
| CN103258328A (en) * | 2013-04-27 | 2013-08-21 | 浙江大学 | Method for locating distorted center of wide-field lens |
Cited By (48)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105528758B (en) * | 2016-01-12 | 2018-12-14 | 武汉精测电子集团股份有限公司 | Image based on programmable logic device remaps method and device |
| CN105528758A (en) * | 2016-01-12 | 2016-04-27 | 武汉精测电子技术股份有限公司 | Image remapping method and device based on programmable logic device |
| CN107665477A (en) * | 2016-07-28 | 2018-02-06 | 三星电子株式会社 | The method of electronic equipment and control electronics |
| CN107665477B (en) * | 2016-07-28 | 2023-08-04 | 三星电子株式会社 | Electronic apparatus and method of controlling the same |
| CN106506970A (en) * | 2016-11-30 | 2017-03-15 | 宇龙计算机通信科技(深圳)有限公司 | A kind of image pickup method and terminal |
| CN106506970B (en) * | 2016-11-30 | 2019-10-11 | 宇龙计算机通信科技(深圳)有限公司 | A kind of image pickup method and terminal |
| CN107155017A (en) * | 2017-06-30 | 2017-09-12 | 上海兆芯集成电路有限公司 | Camera bearing calibration and the device using this method |
| CN107155017B (en) * | 2017-06-30 | 2021-01-22 | 上海兆芯集成电路有限公司 | Image acquisition method and device |
| GB2559639B (en) * | 2017-09-08 | 2021-01-06 | Anthropics Tech Limited | Image manipulation |
| GB2559639A (en) * | 2017-09-08 | 2018-08-15 | Anthropics Tech Limited | Image manipulation |
| CN109544460A (en) * | 2017-09-22 | 2019-03-29 | 宝沃汽车(中国)有限公司 | Image correction method, device and vehicle |
| JP2021523455A (en) * | 2018-05-07 | 2021-09-02 | グーグル エルエルシーGoogle LLC | Projection distortion correction for the face |
| JP7441917B2 (en) | 2018-05-07 | 2024-03-01 | グーグル エルエルシー | Projection distortion correction for faces |
| KR102801507B1 (en) * | 2018-05-07 | 2025-04-29 | 구글 엘엘씨 | Perspective distortion correction on faces |
| US11922720B2 (en) | 2018-05-07 | 2024-03-05 | Google Llc | Perspective distortion correction on faces |
| KR20230065365A (en) * | 2018-05-07 | 2023-05-11 | 구글 엘엘씨 | Perspective distortion correction on faces |
| KR20210006900A (en) * | 2018-05-07 | 2021-01-19 | 구글 엘엘씨 | Correcting Perspective Distortion (PD) of the face |
| KR102528516B1 (en) * | 2018-05-07 | 2023-05-04 | 구글 엘엘씨 | Face PD (perspective distortion) correction |
| JP2023011634A (en) * | 2018-05-07 | 2023-01-24 | グーグル エルエルシー | Projection distortion correction for face |
| JP7158499B2 (en) | 2018-05-07 | 2022-10-21 | グーグル エルエルシー | Perspective distortion correction for faces |
| CN109146808B (en) * | 2018-08-01 | 2022-02-18 | 成都品果科技有限公司 | Portrait beauty method and system |
| CN109146808A (en) * | 2018-08-01 | 2019-01-04 | 成都品果科技有限公司 | A kind of portrait U.S. type method and system |
| CN110232667B (en) * | 2019-06-17 | 2021-06-04 | 厦门美图之家科技有限公司 | Image distortion correction method, device, electronic equipment and readable storage medium |
| CN110232667A (en) * | 2019-06-17 | 2019-09-13 | 厦门美图之家科技有限公司 | Pattern distortion modification method, device, electronic equipment and readable storage medium storing program for executing |
| US11861813B2 (en) | 2019-06-24 | 2024-01-02 | Guangdong Oppo Mobile Telecommunications Corp., Ltd. | Image distortion correction method and apparatus |
| CN110276734A (en) * | 2019-06-24 | 2019-09-24 | Oppo广东移动通信有限公司 | Image distortion correction method and device |
| WO2021052236A1 (en) * | 2019-09-18 | 2021-03-25 | 华为技术有限公司 | Image distortion correction method and device |
| US12254635B2 (en) | 2019-09-18 | 2025-03-18 | Huawei Technologies Co., Ltd. | Image distortion correction method and apparatus |
| CN112529784B (en) * | 2019-09-18 | 2024-05-28 | 华为技术有限公司 | Image distortion correction method and device |
| CN112529784A (en) * | 2019-09-18 | 2021-03-19 | 华为技术有限公司 | Image distortion correction method and device |
| US11295419B2 (en) | 2019-09-29 | 2022-04-05 | Boe Technology Group Co., Ltd. | Distortion correction method and apparatus, electronic device, and computer-readable storage medium |
| CN110689501B (en) * | 2019-09-29 | 2022-07-22 | 京东方科技集团股份有限公司 | Distortion correction method, device, electronic device and computer-readable storage medium |
| CN110689501A (en) * | 2019-09-29 | 2020-01-14 | 京东方科技集团股份有限公司 | Distortion correction method, device, electronic device and computer-readable storage medium |
| CN111008947A (en) * | 2019-12-09 | 2020-04-14 | Oppo广东移动通信有限公司 | Image processing method and device, terminal device and storage medium |
| CN111091507A (en) * | 2019-12-09 | 2020-05-01 | Oppo广东移动通信有限公司 | Image processing method, image processing apparatus, electronic device, and storage medium |
| CN111008605A (en) * | 2019-12-09 | 2020-04-14 | Oppo广东移动通信有限公司 | Method, device, terminal device and storage medium for straight line processing in face image |
| WO2021114991A1 (en) * | 2019-12-09 | 2021-06-17 | Oppo广东移动通信有限公司 | Linear processing method and apparatus in face image, terminal device, and storage medium |
| CN111008605B (en) * | 2019-12-09 | 2023-08-11 | Oppo广东移动通信有限公司 | Method, device, terminal device and storage medium for processing straight lines in face images |
| CN111008947B (en) * | 2019-12-09 | 2024-05-07 | Oppo广东移动通信有限公司 | Image processing method and device, terminal equipment and storage medium |
| EP4068151A4 (en) * | 2019-12-09 | 2023-04-12 | Guangdong Oppo Mobile Telecommunications Corp., Ltd. | METHOD AND APPARATUS FOR LINEAR PROCESSING IN A FACE IMAGE, TERMINAL DEVICE AND STORAGE MEDIA |
| CN112686824B (en) * | 2020-12-30 | 2024-11-29 | 北京迈格威科技有限公司 | Image correction method, apparatus, electronic device, and computer-readable medium |
| CN112686824A (en) * | 2020-12-30 | 2021-04-20 | 北京迈格威科技有限公司 | Image correction method, image correction device, electronic equipment and computer readable medium |
| CN115205126A (en) * | 2021-04-09 | 2022-10-18 | Oppo广东移动通信有限公司 | Image distortion correction processing method, device, storage medium and electronic equipment |
| CN113052900A (en) * | 2021-04-23 | 2021-06-29 | 深圳市商汤科技有限公司 | Position determination method and device, electronic equipment and storage medium |
| CN115587938A (en) * | 2021-07-05 | 2023-01-10 | 华为技术有限公司 | Video distortion correction method and related equipment |
| CN114049281A (en) * | 2021-12-23 | 2022-02-15 | 厦门大学 | Wide-angle portrait photo distortion correction method based on self-adaptive grid |
| CN114049281B (en) * | 2021-12-23 | 2024-08-20 | 厦门大学 | Wide-angle portrait photo distortion correction method based on self-adaptive grid |
| WO2024078233A1 (en) * | 2022-10-10 | 2024-04-18 | 杭州睿胜软件有限公司 | Text-containing image processing method and system, and storage medium |
Also Published As
| Publication number | Publication date |
|---|---|
| CN105046657B (en) | 2018-02-09 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN105046657B (en) | A kind of image stretch distortion self-adapting correction method | |
| US20210174471A1 (en) | Image Stitching Method, Electronic Apparatus, and Storage Medium | |
| US20190251675A1 (en) | Image processing method, image processing device and storage medium | |
| US10165258B2 (en) | Efficient determination of optical flow between images | |
| US9262807B2 (en) | Method and system for correcting a distorted input image | |
| KR101361897B1 (en) | Image processing method, image processing device and scanner | |
| Wei et al. | Fisheye video correction | |
| CN104966318B (en) | Augmented reality method with imaging importing and image special effect function | |
| CN104917931B (en) | Moving image compensation method and device, display device | |
| CN110276734A (en) | Image distortion correction method and device | |
| US20120093365A1 (en) | Conference system, monitoring system, image processing apparatus, image processing method and a non-transitory computer-readable storage medium | |
| CN105844256A (en) | Panorama video frame image processing method and device | |
| JP7739020B2 (en) | Image processing device, image processing method, mobile device, and computer program | |
| CN103824296B (en) | Fisheye image correction method of vehicle panoramic display system based on unit square | |
| CN109859137B (en) | Wide-angle camera irregular distortion global correction method | |
| CN105488766A (en) | Fish-eye lens image correcting method and device | |
| CN104881866A (en) | Fisheye camera rectification and calibration method for expanding pin-hole imaging model | |
| CN105761236A (en) | Image preprocessing method and apparatus for image registering | |
| CN104902201B (en) | Based on moving view point with abnormity screen projection as real-time correction method | |
| TWI443604B (en) | Image correction method and image correction apparatus | |
| CN104822030B (en) | A kind of squaring antidote of irregular video based on anamorphose | |
| JP6311372B2 (en) | Image processing apparatus and image processing method | |
| US9336573B2 (en) | Self-adaptive image edge correction device and method thereof | |
| CN114998496B (en) | A method for rapid generation of orthophotos based on scene aerial images and sparse point clouds | |
| CN103970432B (en) | A kind of method and apparatus of simulating real page turning effect |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant | ||
| 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: 20180209 Termination date: 20210623 |