The embodiments described herein relate generally to electronic image and video processing, and specifically to calibration of image projection systems.
Image projection systems are known to be highly susceptible to geometric image distortions due to their positional freedom. Essentially, any deviation from perpendicularity of the axis that connects the light source of a projector to a viewing surface (normally the optical axis) causes a so-called keystone distortion. Although occurring in rear-projection configurations too, this effect is more pronounced in front-projection configurations that have typically a long throw ratio.
Several prior art patents address electronic correction of geometric distortions, in addition to older mechanical solutions. A majority of the electronic correction methods exploit some form of calibration test patterns that consist of precisely positioned objects (lines, circles, rectangles, etc.) on the projection surface; or use a fixed reference such as physical bezels of the projection surface. These solutions are generally suitable for calibrations in controlled environments, where devices are stationary or have limited displacements. Also, they may require precise alignment jobs. The U.S. Pat. No. 8,406,562 teaches a comprehensive test pattern and reference based calibration techniques applicable to most image systems including rear and front view projectors, and various surface geometries. Another class of calibration methods, for example as taught in the U.S. Pat. No. 6,877,863; relies on position and orientation measurement sensors to quantify distortion parameters. That in turn requires extra components and tools.
In some set-ups, such as a car Heads-Up-Display (HUD) or a Helmet-Mounted-Display (HMD), the projectors are susceptible to constant displacements from the ideal (also referred to as reference) position. Yet, it is crucial to have an undistorted image at all time. Therefore, there is a need for fast, frequent, and automatic calibration on the run. Further, it would be desirable to eliminate additional resources (test patterns, test pattern generators) and alignment tasks needed to perform the calibration.
The present invention takes advantage of digital imaging combined with image analytic techniques to extract projectors' rotational angles from naturally occurring scenes, instead of calibration patterns. Capture devices equipped with Wide-Angle (WA) and particularly Ultra Wide-Angle (UWA) lenses, lenses having a field of view of at least 180°, almost guarantee capture of useful information from a scene. This approach would be at the expense of complexity of UWA mapping calculations and performing heavier image processing. The co-pending patent application PCTUS2012/027189 teaches techniques of UWA lens mapping; content of which will be used as a reference.
The embodiments described herein provide in one aspect, a method to correct for rotational distortions of an image projected from a projection source on a viewing surface, said method comprising:
acquiring an image of a scene containing the viewing surface, using at least one image capture device with a known orientation relative to the projection source; identifying at least a first pair of parallel lines in the image; identifying at least a second pair of parallel lines, orthogonal to the at least first pair of parallel lines, in the image; obtaining coordinates of vanishing points corresponding to the at least first and the at least second pair of parallel lines; computing angles of rotation of the at least one capture device with respect to a frame of reference, using the coordinates of the vanishing points; and constructing a correction transformation using the rotational angles and the orientation of the at least one capture device relative to the projection source.
The embodiments described herein provide in another aspect a calibration system to correct for rotational distortions of an image projected from a projection source on a viewing surface, said system comprising:
at least one image capture device positioned at a known orientation relative to the projection source, to acquire an image of a scene; means to identify at least a first pair of parallel lines, and least a second pair of parallel lines orthogonal to the at least first pair of parallel lines, in the image; means to obtain coordinates of vanishing points corresponding to the at least first and the at least second pairs of parallel lines; means to compute a rotational angle of the capture device using the coordinates of the vanishing points; and means to construct a correction transformation using the rotational angles and the orientation of the at least one capture device relative to the projection source.
The embodiments described herein provide in another aspect a calibration method for use with an image projection set-up having a source and a viewing surface, said method being carried out by at least one electronic processor configured to:
receive input image data acquired, from a scene containing the viewing surface, by at least one capture device; receive input data representing orientation of the at least one capture device relative to the projection source; identify at least a first pair of parallel lines in the image; identify at least a second pair of parallel lines, orthogonal to the at least first pair of parallel lines, in the image; compute coordinates of vanishing points corresponding to the at least first and the at least second pair of parallel lines; compute angles of rotation of the at least one capture device with respect to a frame of reference, using the coordinates of the vanishing points; and construct a correction transformation using the computed angles of rotation and the orientation of the at least one capture device relative to the projection source.
For a better understanding of the embodiments and/or related implementations described herein and to show more clearly how they may be carried into effect, reference will now be made, by way of example only, to the accompanying drawings which show at least one exemplary embodiment and/or related implementation in which:
a and 6b respectively illustrate mapping of a selected portion of
a illustrates an outdoor image acquired through a UWA lens as rotated about an arbitrary axis with respect to the reference position in
b illustrates mapping of a selected portion of
a and 9b respectively illustrate mapping of a selected portion of
a illustrates an indoor image acquired through a UWA lens as rotated about an arbitrary axis with respect to the reference position in
b illustrates mapping of a selected portion of
It will be appreciated that for simplicity and clarity of illustration, elements shown in the figures have not necessarily been drawn to scale. For example, the dimensions of some of the elements may be exaggerated relative to other elements for clarity. Further, where considered appropriate, reference numerals may be repeated among the figures to indicate corresponding or analogous elements.
It will be appreciated that numerous specific details are set forth in order to provide a thorough understanding of the exemplary embodiments described herein.
However, it will be understood by those of ordinary skill in the art that the embodiments and/or implementations described herein may be practiced without these specific details. In other instances, well-known methods, procedures and components have not been described in detail so as not to obscure the embodiments and/or implementations described herein. Furthermore, this description is not to be considered as limiting the scope of the embodiments described herein, but rather to describe the structure and operation of the various embodiments and/or implementations described herein.
In an ideal configuration, the optical axis of the projector 10 is set to be perpendicular to the viewing surface 12 such that the projected image is formed within a rectangular boundary, referred to as the undistorted image. Any deviation from this perpendicularity, in addition to a rotation about the optical axis, results in a geometric image distortion.
According to one embodiment of the invention, at least one capture device 14 is an essential component of a calibration system that is employed to determine the orientation of the image projection source with respect to an ideal orientation. That is, provided the orientation of the capture device relative to the projection source is known. In one embodiment, the capture device is physically attached to the projector. In another embodiment, the capture device 14 is integrated with the projection assembly, such that the orientation of the capture device never changes with respect to the projection source and no additional set-up would be required. Yet in general, the capture device is an independent unit, such as a DSLR camera. In that case, the capture device 14 can be freely positioned, as long as its relative position and orientation with respect to the projection source 12 is known. The relative position and orientation is preferably represented as a matrix to be used in computations.
Since no specific calibration test pattern is intended to be used, unlike traditional calibration methods, one needs to collect useful information from a series of objects in naturally occurring scenes, in order to determine the orientation of the camera. According to one embodiment, a set of parallel lines and vanishing points associated with the parallel lines are used to calculate the rotation matrix. That is based on an observation that it would be relatively straightforward to detect and extract parallel lines, such as horizontal or vertical lines, from recognizable objects in a scene. If a projector is placed indoor, edge lines of the walls, ceiling and floor inside a room; tables, desks, light fixtures, and computer monitors, among other objects, would be good candidates. For outdoor usage, e.g. in a car HUD assembly, building walls, windows, door frames, street lights, traffic signs, road lines, and etc. can be detected and identified for this purpose. Albeit, one needs to make a valid assumption about orientation of the detected objects. For instance, it would be safe to assume that most buildings are vertically erected, or road markings defining a parking spot are drawn in parallel.
Although it may be more likely to identify and pick horizontal and vertical lines in a scene, this is not a requirement. Any two pairs of parallel lines, where the two pairs are orthogonal in the 3D space, can be utilized to do the task as long as their angles with respect to the horizon are known or can be determined.
In a preferred embodiment, the capture device 14 is equipped with a lens having a large field of view (FOV) to assure enough useful information is captured from the scene in a given direction, hence avoiding repetition of the procedure. Accordingly, it would be advantageous to use wide angle (WA) and particularly ultra-wide angle (UWA) lenses to maximize the chance of inclusion of objects of interest.
r′=F
r′(θ,φ),φ′=Fφ′(θ,φ)
θ=Fθ(r′,φ′),φ=Fφ(r′,φ′) (1)
In practice, the lens mapping takes (to a good approximation) a simpler one variable form:
r′=F
r′(φ),φ′=Fφ′(φ)
θ=Fθ(r′),φ=Fφ(φ′) (2)
In the case of a linear (equidistant) fisheye, the above reduces to:
r′=fθ,φ′=φ (3)
where f is a constant that can be viewed as the focal length. Note that θ is defined as positive from the optical axis, which may not be the +z-axis of the frame, in which case the appropriate angle adjustments need to be made. Mapping for the generic case of Eq. (1) is described in the co-pending application PCTUS2012/027189, in which case the mapping should be determined a priori.
Finally, a correction transformation 180 can be constructed by combining the rotation matrix of the camera with another matrix that describes orientation of the camera relative to the projection source. In one embodiment, the correction transformation is applied in a forward direction to the output image. In another embodiment the inverse of the correction transformation is computed and applied to the source image so that the output appears undistorted. The latter is preferred, for example when the transformation is applied via a processing chip.
Referring to
Alternatively, according to another embodiment, an intermediate step 130 can be performed. As illustrated in
In another example,
According to one embodiment, the calibration is performed indoors, e.g. inside a room or a lab environment.
Alternatively, according to another embodiment, the intermediate step 130 can be performed to avoid dealing with curvilinear lines in a fisheye image. As illustrated in
a illustrates an image captured from the same room as in
We now provide algebraic calculations that enable implementation of the embodiments in a hardware processor or for a computer-readable medium. It is worth observing that
{(xmnL, ymnL, zmnL)}, Line m in Frame-n parallel to x-axis with:
−∞<x=xmnLx<+∞,y=ymnLx,z=zmnLx (4)
We use xmnLx instead of x, to make explicit which line is being addressed.
The image taken by a projective camera is formed in a flat image space referred to as the projective space. Consider a projective camera, with position 2 (corresponding to frame 2) rotated about an arbitrary axis relative to the ideal position 1 (corresponding to frame 1). The centers of the two positions are taken to coincide, i.e. no shift.
Applying this transform to points on a line gives:
x
m2
L
=R
xx
x
m1
L
+R
xy
y
m1
L
+R
xz
z
m1
L
y
m2
L
=R
yx
x
m1
L
+R
yy
y
m1
L
+R
yz
z
m1
L
z
m2
L
=R
zx
x
m1
L
+R
zy
y
m1
L
+R
zz
z
m1
L (6)
Projecting this onto the camera image in position 2, gives the line points in Image-2:
wherein fp>0, is the focal length and the negative sign indicates the camera looking down the negative z-axis. To relate the line points with the vanishing points, one may consider lines that are parallel to the three axes, and take the infinite limit for the parallel component. This gives six equations defining the vanishing points:
The right side of (8) is independent of the line, i.e. does not depend on index m; hence any line parallel to the corresponding axis meets at the same vanishing point. This can be seen, for instance, in
The vanishing points can also be computed directly from Image-2 by looking at the images of a pair of parallel lines. Two distinct lines parallel to the x-axis will intersect at the x vanishing point (u∞2Lx, v∞2Lx) in Image-2. Taking a pair of points on each line (as seen in Image-2), constructing a line through the pair and computing the intersection of the two constructed lines, gives the x vanishing point coordinates; similarly the y and z vanishing points can be computed. Again, if some of the axes remains fixed, the corresponding parallel lines will continue to remain parallel in Image-2 and the intersection is at infinity; these cases need to be individually handled. Knowing the vanishing points, the above equations can be re-written as (dropping the L superscript and 2 subscript):
Furthermore, for a rotation there are additional constraints on the elements from the matrix being orthogonal:
RR
T
=R
T
R=1 (10)
Equations (9) and (10) are sufficient to determine the rotation matrix. In fact the system is over constrained. Solving the equations gives:
In the above, the positive square root has been taken based on the following representation for R. In general, a rotation matrix can be written in terms of a unit vector {circumflex over (ω)}=(ωx, ωy, ωz), being the axis of rotation, and an angle α giving the rotation angle about ŵ. This is known as Rodrigues' rotation formula:
R
ij=ωiωj−εijkωk sin α+(1−ωiωj)cos α (12)
i, j=1, 2, 3, with the correspondence 1x, 2y, 3z
The fully anti-symmetric tensor εijk is used in (13). For the diagonal elements, the parameterization becomes:
R
xx=ωx2+(1−ωx2)cos α
R
yy=ωy2+(1−ωy2)cos α
R
zz=ωz2+(1−ωz2)cos α (14)
that is typical for most practical applications, we have the diagonal elements as being positive. The diagonal elements are independent of the focal length, which is expected since the rotation matrix cannot depend on the scale of the image. A more compact form for the diagonal elements can be written using dot and cross products of the vanishing points. Defining the following vanishing points in 3D:
Then:
The elements not involving the z index can be computed from equation (9):
This also shows independence from the focal length. Instead of using equation (9) for the remaining elements, which seem to include the focal length, we compute those using additional relations from equation (10). It follows from (10) that:
R
xz
2=1−Rxx2−Rxy2,Ryz2=1−Ryy2−Ryx2 (18)
Combining with (9) to obtain the sign gives the following, focal length independent result:
Similarly, it can be shown that:
This can be computed using the previously determined elements.
As mentioned above, the system of equations is over constrained. In particular this implies that it is not necessary to know all three vanishing points to compute the rotation matrix. The various constraints from (10) lead to relations that allow computation of the rotation matrix from two vanishing points. Consider the following constraint:
R
xx
R
xy
+R
yx
R
yy
+R
zx
R
zy=0 (21)
Using (9) gives:
This implies:
f
p
2=−({right arrow over (x)}∞·{right arrow over (y)}∞) or fp=√{square root over (−({right arrow over (x)}∞·{right arrow over (y)}∞))} (23)
The focal length is hence determined by the x and y vanishing points. This result can be used to determine the diagonal elements, and in turn all the elements, in terms of the x and y vanishing points. The diagonal elements are determined as follows:
From their explicit form, we see that there is no dependence on {right arrow over (z)}∞, the z vanishing point. Four of the remaining elements are given by (again independent of {right arrow over (z)}∞):
The last two elements can be computed from equations analogous to (20):
Therefore, the rotation matrix is completely determined using only the x and y vanishing points. This suggests that the z vanishing point may be constrained by the x and y vanishing points. Comparing the two formulas for Rxx, it can be shown that:
{right arrow over (z)}
∞
−{right arrow over (y)}
∞)·{right arrow over (z)}∞=0 (27)
Mention should again be made of the special cases where some of the rotation matrix elements are zero because of vanishing points at infinity. This leads to “division by 0” situations in some of the equations. These cases need to be identified prior to the above analysis and the equations appropriately adjusted.
Up to this stage, it has been assumed that the two camera positions coincide at the center, differing only in orientation. In fact, a translation of the camera does not change the vanishing point analysis. To demonstrate this, consider a general translation vector {right arrow over (v)}s:
Analogous to (7), the projective map becomes:
In taking the infinite limits along the three axes, equation (8) is unchanged; hence the computations that follow are also unchanged. In particular, the same equations can be used for computing the rotation matrix. However, the translation vector itself cannot be computed using this approach.
The results for projective cameras can be extended to UWA cameras, in accordance with a preferred embodiment of the invention. Unless lined in some certain directions, a straight line {(xmnL, ymnL, zmnL)} in 3D will normally be imaged as a curved line in the UWA image space (see
Let {(um2L, vm2L)} be the coordinates of a straight 3D line, as imaged by the rotated UWA camera in position 2 (e.g.
The radial coordinate is not known, whereas the angular coordinates {(θm2L, φm2L)} can be computed from {(um2L, vm2L)} using the UWA lens transformation. Next, a projection onto a projective camera identified as n=2′ with focal length fp is made, giving the 2D coordinates:
Selecting a specific value for fp, e.g. 1, these equations can be used to compute the line coordinates {(um2′L, vm2′L)} in the projective camera (starting from the UWA image coordinates {(um2L, vm2L)}), which will from a straight line. Taking pairs of lines (m1, m2) parallel to the x, y and z axis, then their projective camera coordinates: {(um
The ideal un-rotated UWA camera position 1 (e.g.
Taking the infinite limit for lines parallel to the three axes gives the three vanishing points for Image-2′ as in (8). Since the vanishing points are already known from (33), the final result is the same six equations relating the rotation matrix elements (9), re-written below, maintaining the projective camera index to explicitly show that the vanishing points are computed from the projective images not the original UWA images:
The same focal length fp should be used for computing the vanishing points. From here onwards, the derivation for the rotation matrix is identical to that of the projective camera. In particular, the rotation matrix is given by equations (16) to (20) or (24) to (26). The translation cannot be computed from vanishing points alone, and normally is not the issue when the projection source is in a fixed position.
Finally, once the rotation matrix associated with the capture device 14 is obtained, a correction transformation can be computed 180 to undo misorientation of the projection source 10. Given the rotation of the projector relative to camera is known, its' absolute (relative to the ideal) rotation can be calculated as follows:
R
IP
=R
IC
×R
CP(35)
where RIC is the camera rotation matrix, as computed; RCP represents the rotation matrix relating the projector to the camera; and RIP is the matrix representing rotation of the projector with respect to the ideal orientation. RCP may be an identity matrix, for instance if the capture device is integrated with the projection source. Furthermore, in analogy with what was demonstrated in Eqs. (27) and (28) regarding the camera displacement factor, the relative displacement of the projector from the camera does not affect RCP.
A correction transformation 180 constructed upon the rotation matrix RIP can be applied to the output image in a forward direction to correct for the image distortions. Alternatively, an inverse transformation can be calculated and applied to the source or input image, such that the output image appears substantially undistorted. The latter would be preferred when the calibration is performed in real-time using a processing chip.
In one embodiment, orientation of the projection source changes as in time, requiring frequent calibration. The above procedure can be repeated as often and as fast as needed to dynamically compute a rotation matrix for varying rotational angles.
In one embodiment, the projection source is part of a car HUD assembly, where the image is formed on a virtual screen a few feet in front of the car's windshield. During the calibration process, the optical rays for both the projection source and the capture device pass through the windshield which is normally curved, adding extra distortions. The windshield curvature, as well as other distortions in the system that are optical in nature, are generally decoupled from the geometric (rotation) and fisheye distortions. That also applies to real viewing surface distortions, be it intrinsic curvatures or a specific geometry. Techniques taught for example in the U.S. Pat. No. 8,406,562 can be used, usually once, and the correction components associated with each of the above distortions may get concatenated with the geometric correction RIP as disclosed.
While the above description provides examples of the embodiments, it will be appreciated that some features and/or functions of the described embodiments are susceptible to modification without departing from the spirit and principles of operation of the described embodiments. Accordingly, what has been described above has been intended to be illustrative of the invention and non-limiting and it will be understood by persons skilled in the art that other variants and modifications may be made without departing from the scope of the invention as defined in the claims appended hereto.