Method for compensating for off-axis tilting of a lens

Information

  • Patent Grant
  • 10356346
  • Patent Number
    10,356,346
  • Date Filed
    Monday, February 26, 2018
    6 years ago
  • Date Issued
    Tuesday, July 16, 2019
    5 years ago
Abstract
A method for compensating for off-axis tilting of a lens relative to an image sensor in an image acquisition device comprises acquiring a set of calibrated parameters
Description
FIELD

The present invention relates to a method for compensating for off-axis tilting of a lens.


BACKGROUND

Referring now to FIG. 1, when a lens is assembled to a camera, it is hard to ensure that an optical axis of the lens is perfectly perpendicular to an imaging sensor surface. Unless compensation is applied, this misalignment will cause geometrical distortion to any image produced by the lens.


In order to compensate for lens tilt, it must be properly modelled and the modelling parameters estimated.


Both Matlab Camera Calibration Toolbox and OpenCV refer to the distortion caused by lens tilt as “tangential distortion” and suggest that it can be corrected by the following set of equations:

xdist=x+(2p1xy+p2(r2+2x2))
ydist=Y+(p1(r2+2y2)+2p2xy)


where xdist, ydist are the x,y coordinates of a pixel within an image distorted by a tilted lens; x, y are the normalised pixel coordinates;


r is the distance to the optical axis where r=√{square root over (x2+y2)}; and


p1,p2 are the modelling parameters.


However, according to Beauchemin et al., “Modelling and Removing Radial and Tangential Distortions in Spherical Lenses”, Multi-Image Analysis, 10th International Workshop on Theoretical Foundations of Computer Vision Dagstuhl Castle, Germany, Mar. 12-17, 2000, pp. 1-21 the above equations are based on thin prism distortion caused by the misalignment of the lens optical elements and are applicable only to spherical lenses. Thus, these equations may not be applicable in the case of lenses containing a large number of aspherical elements such as lens assemblies common in modern smartphones.


SUMMARY

There is provided an image acquisition system arranged to compensate for off-axis tilting of a lens according to each of claim 1 or 4.


In an image acquisition system with a lens tilt of 0.25 degrees, the errors between the present method and the conventional method are 1.5 pixels on average with 3 pixels maximum for a 2 Mpixel Full-HD image sensor. This error gets worse for higher resolutions and so the improvement provided by the invention improves for higher resolution image sensors.


Similarly, the error grows quite significantly with the amount of tilt, thus lower quality lens modules can also benefit more from the invention than higher quality devices.





BRIEF DESCRIPTION OF THE DRAWINGS

Embodiments of the invention will now be described, by way of example, with reference to the accompanying drawings, in which:



FIG. 1 shows lens projection on perpendicular and on tilted projection planes;



FIG. 2 illustrates an image acquisition system arranged to compensate for off-axis tilting of a lens according to the present invention;



FIG. 3 shows vectors describing projection on a tilted plane employed in describing an embodiment of the present invention;



FIG. 4A and FIG. 4B show conic sections employed in a second approach to describing an embodiment of the present invention;



FIG. 5 illustrates the conic section and vectors of FIG. 4A and FIG. 4B; and



FIG. 6 shows a non-linear mapping {right arrow over (p)}custom character{right arrow over (q)} projecting the coordinates of a circle onto an ellipse according to the present invention.





DESCRIPTION OF THE EMBODIMENTS

Referring now to FIG. 2 an image acquisition system 200 according to an embodiment of the present invention is shown. The acquisition system 200 comprises an otherwise conventional lens system 20 and sensor 22 assembly where the optical axis of the lens may not be orthogonal to the sensor surface. The lens 20 may either be integrally formed within the acquisition system 200, as in the case of smartphones, tablets or laptop computers and indeed some dedicated cameras; or the lens 20 may be of the interchangeable type fitted to a camera body. Typically, raw image information acquired by the sensor 22 is initially processed by an image sensor pipeline (ISP) 24 before an image 32 is written across a system bus 28 for storage in system memory 30.


Compensation for lens tilt can be implemented at any stage in the image processing pipeline and in the example of FIG. 2, a compensation module 26 is shown downstream in the image processing pipeline from the ISP 24. The module functionality may of course be integrated with the ISP 24 or indeed any other module processing acquired image information before it is written to system memory, for example, a module performing other forms of distortion correction as described in U.S. Pat. No. 9,280,810 and U.S. patent application Ser. No. 15/879,310, the disclosure of which are herein incorporated by reference. Alternatively, the module might be applied as part of a post-processing of an image 32 stored in memory 30 and could be implemented either as dedicated firmware, as described in the above referenced U.S. Pat. No. 9,280,810 and U.S. patent application Ser. No. 15/879,310, or in software running on a general purpose processor such as a system controller 34 for the system 200.


In any case, the system controller 34 provides the compensation module 26 with a set of parameters {right arrow over (n)} which can then be used by the module 26 to map pixel information from an image distorted by lens tilt to a distortion corrected image and these parameters along with how they can be used are described in more detail below.


In the description below, the effect caused by lens tilt does not need to take into account lens projection, as the model is only concerned with the path of light exiting the lens 20.


It can be observed, that for any field angle, the lens is producing a cone of light that intersects the sensor surface. We need to find the shape of the intersection as a function of the tilt. It is convenient to describe such a transformation in terms of mapping the “perfect” point coordinates produced by the lens 20 when it is perfectly aligned with the sensor 22, to the new coordinates which are distorted by the sensor tilt. In this way, the lens projection characteristics can be separated from the effect caused by the lens tilt. The problem can be approached from two directions, each producing equivalent end results:


1. Modelling the Lens Tilt by Raytracing


For convenience, we can assume that a projection plane is on the same side of the plane as object. It is a common convention used in computer graphics as the ISP 24 typically flips the raw image produced by lens 20, so there is no point in reversing this process in order to model the fact that the lens produces a flipped image.


We adopt the convention that the z-axis of the coordinate system is the optical axis and the ideal projection (not tilted) is done on the plane z=1 with the projection centre in the origin of the coordinate system.


Referring now to FIG. 3 which comprises a sideways view on the xz plane, let S0 be the horizontal sensor plane and S1 the tilted sensor plane. The normal vector of S0 will be:







w




(



0




0





-
1




)





and the unit normal vector of S1 will be







n




(




n
x






n
y






n
z




)





An ideally projected point will form a vector







u




(




u
x






u
y





1



)





where ux and uy are normalised coordinates on the horizontal plane S0.


The first stage of this approach is to find a point {right arrow over (P)} which is the intersection of the ray described by the vector {right arrow over (u)} with the plane S1. In order to do that we need to find a scale factor s that will stretch the vector {right arrow over (u)} to make it meet with S1. The scale factor s is defined as:






s
=

-



n


·

w





n


·

u









Since the vector {right arrow over (w)} is aligned with the coordinate system it can be simplified to:






s
=


n
z




u
x



n
x


+


u
y



n
y


+

n
z







The 3D position of the point {right arrow over (P)} is defined as







P


=


(




P
x






P
y






P
z




)

=


s


u



=

s


(




u
x






u
y





1



)








These calculations are relatively simple to implement and are very friendly for GPU or DSP implementations where dot products can be efficiently calculated by using SIMD (Single Instruction/Multiple Data) instructions.


Since we are interested in the position of point {right arrow over (P)} in the local coordinates of S1, the coordinates of point {right arrow over (P)} must be rotated in order to align them with the xy plane of the coordinate system. This can be done by finding a rotation matrix {circumflex over (R)} that rotates the vector {right arrow over (n)} to the vector {right arrow over (w)}.


The rotation axis is defined by the cross product between the vectors {right arrow over (n)} and {right arrow over (w)}:







v


=



n


×

w



=

(




-

n
y







n
x





0



)









v


=


(




v
x






v
y






v
z




)

=

(




-

n
y







n
x





0



)






and the cosine of the rotation angle is defined as the dot product between these vectors:

cos θ={right arrow over (w)}·{right arrow over (n)}=−nz


The vector {right arrow over (v)} can be used to construct a skew-symmetric matrix {circumflex over (V)}:







V
^

=

[



0



-

v
z





v
y






v
z



0



-

v
x







-

v
y





v
x



0



]





The rotation matrix {circumflex over (R)} can be calculated by rearranging the Rodriguez formula to the following form, and plugging in for the values of cos θ and {circumflex over (V)}:







R
^

=


+

V
^

+



V
^

2


1
+

cos





θ




=

[




1
+


n
x
2



n
z

-
1








n
x



n
y




n
z

-
1





n
x








n
x



n
y




n
z

-
1





1
+


n
y
2



n
z

-
1






n
y






-

n
x





-

n
y





-

n
z





]






To perform the rotation around the projection plane origin, the points have to be first shifted to the coordinate centre, rotated then shifted back to the original location. So the final point coordinates in the local coordinate system of the tilted plane are defined as follows:

{right arrow over (P)}′={circumflex over (R)}({right arrow over (P)}+{right arrow over (w)})−{right arrow over (w)}


Since we are not interested in the z coordinate of the point {right arrow over (P)}′ (as it should equal 1 for all points), the calculations can be simplified to:







P
x


=


s


n
z



(


n
z

-
1

)





(



(


n
x
2

+


n
z



(


n
z

-
1

)



)



u
x


+


n
x



n
y



u
y



)









P
y


=


s


n
z



(


n
z

-
1

)





(



(


n
y
2

+


n
z



(


n
z

-
1

)



)



u
y


+


n
x



n
y



u
x



)






with the scale factors given by






s
=


n
z




u
x



n
x


+


u
y



n
y


+

n
z







The form of the above equations makes them readily computed using SIMD instructions. For example, the compensation module 26 can simply step through each ux, uy pixel location of a lens tilt compensated output image and determine the corresponding coordinates Px′, Py′ in the input distorted image—note that these coordinates need not necessarily correspond with a pixel location in the input image. As described in U.S. Pat. No. 9,280,810 and U.S. patent application Ser. No. 15/879,310, some interpolation between input image pixel values for pixel locations surrounding the input image coordinates may then be required to produce the pixel value for the output image pixel location.


Moreover, slight reorganisation of the equations will allow for further parallelization. The calculation of s and the expression in parentheses can be performed in parallel followed by the multiplication of the results.


2. Modelling the Lens Tilt by Conical Section


Referring to FIG. 4A and FIG. 4B which show conic sections employed in a second approach to describing an embodiment of the present invention.


The circle 10 shows the intersection between the horizontal plane S0 and the cone of light 11 produced by the lens that intersects the sensor surface; the ellipse 12 is the intersection of the tilted plane S1 and the cone; and the ellipse 14 is the ellipse after rotation back to the horizontal plane S0. A non-linear mapping {right arrow over (p)}custom character{right arrow over (q)}, FIG. 6, detailed below transforms the points of the circle 10, to the ellipse 14.


In this case, the coordinate system is inverted with respect to the previous ray tracing approach, as the optical centre is located at (0,0,1), so the focal point vector {right arrow over (f)}=−{right arrow over (w)}, and the horizontal plane is located at z=0.


Referring to FIG. 5, if {right arrow over (n)} is a normal vector to the plane Z, the general equation of the plane is given by the set of all points {right arrow over (z)}∈Z which satisfy:

{right arrow over (n)}·{right arrow over (z)}=xnx+yny+znz+n1=0


and the vectors are:







z


=

(



x




y




z




1



)








n


=

(




n
x






n
y






n
z






n
1




)





where {right arrow over (z)} is an element of the 3-dimensional projective plane {right arrow over (z)}∈custom character3. The 4th element of the normal vector is a translational component and describes the displacement of the tilted plane from the origin: (x,y,z)=(0,0,0). Here we need only consider planes which contain the origin. Therefore we may exclude the translational component and treat the unit normal {right arrow over (n)} as a 3-vector. There are 2 planes that are of interest to this study; respectively defined by the normal vectors

    • Horizontal plane:








n


0



(



0




0




1



)







    • Tilted plane:











n


1



(




n
x






n
y






n
z




)





With {right arrow over (n)}0={right arrow over (f)}, which is the focal point {right arrow over (f)} of the lens, and the centre of projection.







f


=

(



0




0




1



)





The cone of light rays 11 emanating from the focal point is illustrated in FIG. 4A. For a given field angle, the lens is producing a cone of light that intersects the imaging sensor. In the ideal case the imaging sensor is perfectly perpendicular to the optical axis and the intersection points describe a circle 10.


The 2-dimensional coordinates of the intersection points with the horizontal plane are described by the vector:







p


=

(




p
x






p
y





0



)





The light rays extend from the centre of projection toward the horizontal plane.







l


=



p


-

f



=

(




p
x






p
y






-
1




)






The light rays {right arrow over (l)} extend from the focal point {right arrow over (f)} and intersect the horizontal plane at {right arrow over (p)}. The intersection points are transformed to the tilted plane {right arrow over (q)}0 under the non-linear mapping

{right arrow over (p)}custom character{right arrow over (q)}0


Where {right arrow over (q)}0 are the 3-dimensional transformed coordinates defined by

{right arrow over (q)}0={right arrow over (f)}+λ{right arrow over (l)}


Where is the non-linear scaling of the light rays between the horizontal and tilted plane. The explicit form of the scaling parameter is found from the dot product of {right arrow over (q)}0 with the normal to the tilted imaging sensor plane {right arrow over (n)}.








n


·

(


f


+

λ






l




)


=
0






λ
=

-



n


·

f





n


·

l











λ
=


n
z



n
z

-


n
x



p
x


-


n
y



p
y








The light rays intersect the tilted plane at {right arrow over (q)}0.








q


0

=

(




λ






p
x







λ






p
y







1
-
λ




)





The intersection of the light rays with the tilted plane is illustrated by the ellipse 12 in FIG. 4A, FIG. 4B, and FIG. 5. When the imaging sensor 22 is tilted with respect to the optical axis, it is rotated by an angle θ around an axis {right arrow over (k)} which passes through the origin. The rotation axis is the cross product of the focal point vector {right arrow over (f)} and the unit normal {right arrow over (n)}.







k


=


f


×

n










k


=


(




k
x






k
y






k
z




)

=

(




n
y






-

n
x






0



)






The cosine of the angle of rotation is given by the dot product between the unit normal to the tilted plane and the focal point vector:

cos θ={right arrow over (f)}·{right arrow over (n)}=nz


We seek the non-linear mapping:

{right arrow over (p)}custom character{right arrow over (q)}


Where {right arrow over (p)} and {right arrow over (q)} are 2-dimensional vectors, both with a zero component along the optical axis pz=qz=0.


The 2-dimensional transformed coordinates are found by rotating {right arrow over (q)}0 back to the horizontal plane, via:

{right arrow over (q)}={circumflex over (Q)}{right arrow over (q)}0


{circumflex over (Q)} is an axis-angle quaternion, described by the Rodrigues rotation equation.







Q
^

=

+

K
^

+



K
^

2



(

1

1
+

cos





θ



)







where custom character is the identity matrix, and {circumflex over (K)} is a skew symmetric matrix given by the axis of rotation:







K
^

=

[



0



-

k
z





k
y






k
z



0



-

k
x







-

k
y





k
x



0



]





Making the substitutions

cos θ=nz and (kx,ky,kz)=(ny,−nx,θ)


the Rodrigues axis-angle quaternion simplifies to:







Q
^

=

[




1
-


n
x
2


1
+

n
z







-



n
x



n
y



1
+

n
z







-

n
x







-



n
x



n
y



1
+

n
z







1
-


n
y
2


1
+

n
z







-

n
y







n
x




n
y




n
z




]





Applying the rotation

{right arrow over (q)}={circumflex over (Q)}{right arrow over (q)}0


we obtain the 2-dimensional transformed coordinates







q


=


λ


n
z



(

1
+

n
z


)





(






(


n
x
2

+


n
z



(

1
+

n
z


)



)



p
x


+


n
x



n
y



p
y










(


n
y
2

+


n
z



(

1
+

n
z


)



)



p
y


+


n
x



n
y



p
x







0



)






The non-linear mapping from pxcustom characterqx, and from pycustom characterqy, is







p
x




λ


n
z



(

1
+

n
z


)





(



(


n
x
2

+


n
z



(

1
+

n
z


)



)



p
x


+


n
x



n
y



p
y



)









p
y




λ


n
z



(

1
+

n
z


)





(



(


n
y
2

+


n
z



(

1
+

n
z


)



)



p
y


+


n
x



n
y



p
x



)






with the scale factor λ given by:






λ
=


n
z



n
z

-


n
x



p
x


-


n
y



p
y








Now that the parameters {right arrow over (n)} defining the above described model and their application to compensate an acquired image for lens tilt have been described, it will be appreciated that any image acquisition system 200 (camera) having a lens tilt calibration module 26 driven by these parameters {right arrow over (n)} can be readily calibrated as described at the following link: http://ags.cs.uni-kl.de/fileadmin/inf ags/3dcv-ws11-12/3DCV WS11-12 lec03.pdf, Stricker by pointing the camera at a 3-surface reference object to acquire a single 2-D image and then applying a global optimisation algorithm to determine parameters both for camera location (X,Y,Z) and rotation (Rx,Ry,Rz) relative to the reference object as well as camera model parameters including taking into account lens distortion as well as lens tilt parameters {right arrow over (n)} by minimizing an error function mapping the points of the reference object to locations in the acquired 2-D image.


While the approach of Stricker is based on a reference object including a checkerboard type pattern, other reference objects can comprise surfaces including boards comprising unique ChArUco characters rather than a repeating pattern of the same unit.


Note that there may also be a loss in focus associated with lens tilt but this is not considered in detail here. Nonetheless, the above compensation technique can be combined with any other technique compensating for any loss of focus.


In variants of the above embodiments, rather than supplying the three coordinates for the vector {right arrow over (n)} directly, these can instead be derived from a pair of scalars, NX and NY generated by a calibration process as described above. First, a length of the input vector is calculated as follows: d=sqrt(NX2+NY2+1) (essentially a third scalar NZ=1). Then the components of the vector {right arrow over (n)} are calculated as follows:

nx=NX/d
ny=NY/d
nz=1/d.


Using such an approach, the interface for the compensation module 26 can be made interchangeable with that of compensation modules using the prior art approach, yet still provide an improved result.


Note that the above derivation from two parameters is just an example and other methods might be used, for example, the vector {right arrow over (n)} could be derived from two rotation angles of a sensor plane.

Claims
  • 1. An image acquisition system comprising a lens assembled to project an image onto an image sensor, where the lens is tilted relative to the image sensor, the image acquisition system including a calibration module configured to: acquire a set of calibrated parameters
  • 2. An image acquisition system according to claim 1 wherein said calibration module is configured to map image information by: selecting a pixel location ux, uy in said lens tilt compensated image, determining a corresponding coordinate Px′, Py′ in said acquired image, determining a plurality of pixel locations in said acquired image surrounding said coordinate, and interpolating pixel values for said surrounding pixel locations to determine a value for the pixel location in said lens tilt compensated image.
  • 3. An image acquisition system according to claim 1 wherein said calibration module is configured to acquire said set of calibrated parameters
  • 4. An image acquisition system comprising a lens assembled to proiect an image onto an image sensor, while the lens is tilted relative to the image sensor, the image acquisition system including a calibration module configured to: acquire a set of calibrated parameters
  • 5. An image acquisition system according to claim 4 wherein said calibration module is configured to map image information by: selecting a pixel location px, py in said lens tilt compensated image, determining a corresponding coordinate in said acquired image, determining a plurality of pixel locations in said acquired image surrounding said coordinate, and interpolating pixel values for said surrounding pixel locations to determine a value for the pixel location in said lens tilt compensated image.
  • 6. An image acquisition system according to claim 4 wherein said calibration module is configured to acquire said set of calibrated parameters
US Referenced Citations (11)
Number Name Date Kind
8482628 Khan Jul 2013 B1
9280810 Stec et al. Mar 2016 B2
20040032952 Pinto Feb 2004 A1
20040125227 Tsuruoka Jul 2004 A1
20050261849 Kochi Nov 2005 A1
20110032374 Imanishi Feb 2011 A1
20130100249 Norita Apr 2013 A1
20130242129 Harmeling Sep 2013 A1
20140009568 Stec Jan 2014 A1
20140063229 Olsson Mar 2014 A1
20140111672 Seki Apr 2014 A1
Non-Patent Literature Citations (4)
Entry
Beauchemin et al., “Modelling and Removing Radial and Tangential Distortions in Spherical Lenses”, Multi-Image Analysis, 10th International Workshop on Theoretical Foundations of Computer Vision Dagstuhl Castle, Germany, Mar. 12-17, 2000, pp. 1-21.
Strickler, Prof. Didier, “Camera model and calibration” https://ags.cs.uni-kl.de/fileadmin/inf_ags/3dcv-ws11-12/3DCV_WS11-12_lec03.pdf.
Stec, et al. “Method and system for correcting a distorted input image,” U.S. Appl. No. 15/879,310, filed Jan. 24, 2018.
“Mars Autonomy Project Stereo Ranging”, Field Robotics Center, Carnegie Mellon Robotics Institute, https://www.frc.ri.cmu.edu/projects/mars/stereo.html.