|
Description  |
|
|
FIELD OF THE INVENTION
The present invention relates to digital image processing.
BACKGROUND OF THE INVENTION
The following U.S. Patents have been found in a U.S. Patent Search and are believed to be generally relevant to the field of the invention:
______________________________________ 5,022,085 6/91 Cok 5,155,586 10/92 Levy et al. 5,185,808 2/93 Cok 5,231,385 7/93 Gengler et al. 5,251,022 10/93 Kitamura 5,325,449 6/94 Burt et al. 5,488,674 1/96 Burt et al. 5,630,037 5/97 Schindler
5,649,032 7/97 Burt et al. ______________________________________
Digital photographs with extended fields of view are conventionally created using an image processing technique known as "stitching", wherein a user takes multiple photographic images using a camera and rotates the camera between images, so as to
produce overlapping photos spanning an entire vista. A "stitcher" then combines the various images into a single large "omniview" image with an extended field of view, up to a full 360.degree.. The stitching process itself involves various steps, such
as correction of the images for camera angle and tilt, image alignment between successive images to account for overlap, and texture mapping. When performed accurately and properly viewed with appropriate perspective correction, the resulting large
image gives the viewer the experience of being immersed within a vista.
Although certain professional lenses, such as fisheye lenses, are capable of photographing an entire hemispherical view as a single image, use of a stitcher enables a non-professional photographer to use a standard lens, and yet capture the same
extended wide angle view. The computational processing within the stitcher effectively carries out necessary three-dimensional geometrical transformations to account for the non-linear distortion in a wide angle view. Specifically, it projects the
various linear images onto the surface of a sphere or cylinder or cube--depending on a desired environment map.
One commonly encountered source of artifacts in stitching is the variable lighting of individual images. As the camera rotates, for example, one image can be taken into the sun, and thus deviate from the other images with respect to lighting.
When this image is stitched with the others, it stands out awkwardly.
Current state of the art stitchers use a process known as "feathering" to merge together a left image (hereinafter designated as "image A") and an adjacent right image (hereinafter designated "image B"). Typical implementations of feathering
operate after the images are aligned and the overlap region has been identified. They then feather the two images within the overlap region, by weighted combining using weights which vary from a value above 50% (e.g. 100%) of image A and a value below
50% (e.g. 0%) image B at the left side of the overlap region, to a value below 50% (e.g. 0%) of image A and a value above 50% (e.g. 100%) of image B at the right side of the overlap region. However, if the lighting conditions of
the two images are substantially at variance and the overlap region is narrow, this technique of feathering does not work well, and typically produces noticeable bands at the overlap region. This is to be expected, since feathering does not
affect pixel color values outside of the overlapping region.
Another common artifact, referred to as "ghosting," occurs when two images being blended together are slightly misaligned. Suppose, for example, that the overlap region contains a bright square of dimensions 1".times.1". If the two images are
mis-aligned horizontally by 0.1", then feathering will produce an elongated square (i.e. a rectangle) of dimensions 1.1".times.1". Moreover the leftmost and rightmost strips of the rectangle, of dimensions 0.1".times.1", will be less bright than the
rest of the rectangle. The appearance of these less bright strips at the left and right ends of the rectangle gives the effect of ghosting, whereby only a partial remnant of the square is present. It should be emphasized that alignment is practically
never perfect, and as such, there is always some form of ghosting present.
Another source of ghosting occurs when an object is present in one of the images and absent in the other. For example, a person might appear in image A and be absent from image B, having moved out of sight between the times the two images were
photographed.
SUMMARY OF THE INVENTION
The present invention provides a novel approach to image feathering of two overlapping images (hereinafter designated "image A" and "image B") which avoids both of the artifacts described above; namely, noticeable bands at the overlap regions due
to different lighting conditions in adjacent images, and ghosting due to misalignment. This approach preferably involves four stages of image processing.
A first stage is that of aligning the two images so as to register them as best as possible in the overlap region. This stage is not addressed in the present invention. Rather, the present invention relates to the image processing after the
alignment is performed, using any conventional method.
A second stage involves vertical image warping, specially constructed so as to eliminate any vertical misalignment between the two images. Optimal vertical distortions for image A are calculated along selected vertical lines within the overlap
region so as to minimize vertical mis-match with respect to image B. In between and outside of these selected vertical lines, the vertical distortions are filled in by linear interpolation. The result is a two-dimensional vertical distortion map for
image A which brings it into vertical alignment with image B.
A third stage uses the information in the overlap region to correct the color of the two images, prior to carrying out the feathering. Popular belief tends to support the idea that the best way to take pictures with a camera in order to stitch
them together, is to minimize the overlap between them, so that they can be stitched together end-to-end. On the contrary, the present invention builds upon information in the overlap region to correct the color in each of the images, in order to bring
both images so equivalent lighting conditions. Thus the larger is the overlap region, the more of an information base is available for the color correction.
Once the images are color corrected, their variation due to different lighting conditions is reduced, and as a result the feathering is smoother. Even if conventional "feathering" is used, the banding artifact is significantly reduced. The
present invention tapers the color correction, so that full color correction is applied within the overlap region, and outside the overlap region only a fraction of the correction is applied, where the fraction preferably tapers from 100% to 0% as the
pixel distance from the overlap region increases. Normally, the color correction is not applied at all for pixels sufficiently far away from the overlap region.
A fourth stage involves a new form of feathering, which varies the relative weights of the A and B image pixels along a multitude of horizontal lines, from a value above 50% of A and a value below 50% of B at a left endpoint to 50% of A and 50%
of B at a middle point, to a value below 50% of A and a value above 50% of B at a right endpoint. The horizontal lines cover the entire overlap region, from the top to the bottom.
Three control points are defined for each horizontal line--left endpoint, middle point and right endpoint. The locations of these points typically vary from one horizontal line to the next. The collection of left endpoints forms a downward
running curve, designated as the "leftmost curve," the collection of middle points forms a downward running curve, designated as the "middle curve," and the collection of right endpoints forms a downward running curve, designated as the "rightmost
curve." The region between the leftmost and rightmost curves becomes the "feathering region." Whereas in conventional feathering the feathering region is precisely the overlap region, which is rectangular, in the current invention the feathering region
is typically non-rectangular, and lies strictly within the overlap region.
The present invention avoids ghosting by approximately aligning the two images, and then carefully choosing the leftmost and rightmost curves, so that the feathering region is as large as possible, but without containing any pixels where the two
images are significantly misaligned. Misalignment can be recognized by the difference between image A and image B in the overlap region. Large differences in any of the color values indicate significant misalignment. Precisely, specific threshold
values are used to indicate whether or not misalignment is "significant."
The present invention preferably first seeks a middle curve which travels downward from top to bottom, without passing through any pixels where the images are significantly misaligned. After the middle curve is found, the present invention seeks
outward horizontally, left and right, from each point on the middle curve, to find the extent for which there is no significant misalignment. The limits of these extents are taken as initial candidates for the leftmost and rightmost curves. These
candidate curves can be very erratic curves, and can be subsequently smoothed.
There is thus provided in accordance with a preferred embodiment of the present invention a method for compositing two digital images which overlap in an overlapping pixel region, including adjusting the pixel color values of at least one of the
overlapping images, so as to produce resulting digital images including at least one modified digital image, and combining the resulting digital images in the overlapping pixel region by taking weighted averages of their pixel color values.
Additionally in accordance with a preferred embodiment of the present invention the adjusting step adjusts the pixel color values of at least one of the digital images in a pixel region which includes the overlapping pixel region.
Moreover in accordance with a preferred embodiment of the present invention the adjusting step adjusts the pixel color values of at least one of the digital images in a pixel region which includes pixels outside the overlapping region.
Further in accordance with a preferred embodiment of the present invention the pixel color values are in RGB three-channel format, and the adjusting step is applied to at least one color channel.
Still further in accordance with a preferred embodiment of the present invention the adjusting step includes modifying brightness, contrast and gamma factors of each of the digital images so as to produce modified brightness, contrast and gamma
factors, denoted by .alpha., .beta. and .gamma., respectively; and applying the modified brightness, contrast and gamma factors by changing the color intensity, denoted by I, of at least one of the digital images to a modified color intensity, denoted
by I', according to the formula
Additionally in accordance with a preferred embodiment of the present invention the applying step includes constructing a lookup table which tabulates the chances in color intensity .DELTA.I=I'-I indexed by I, and accessing the lookup table to
modify the color intensities.
Moreover in accordance with a preferred embodiment of the present invention the changes in brightness, contrast and gamma factors produced by the applying step are applied with a weighting factor, the weighting factor tapering off from a value
above 50% to a value below 50% over a pixel region outside of and adjacent to the overlapping pixel region.
There is also provided in accordance with a preferred embodiment of the present invention a method for feathering two digital images which overlap in an overlapping pixel region, including aligning the digital images so as to approximately
register them in the overlapping pixel region, determining three curves, one of which is a leftmost curve, another of which is a middle curve and another of which is a rightmost curve, and at least one of which is not a straight vertical line, the curves
extending from the top to the bottom of the overlapping pixel region and lying within the overlapping pixel region, and the middle curve lying between the leftmost and rightmost curves, and combining the digital images by taking a weighted average of the
pixel color values, in such a way that the weights used are a value above 50% of image A and a value below 50% of image B to the left of the leftmost curve, 50% of image A and 50% of images B along the middle curve, and a value below 50% of image A and a
value above 50% of image B to the right of the rightmost curve.
Further in accordance with a preferred embodiment of the present invention the middle curve is halfway between the leftmost and rightmost curves.
Still further in accordance with a preferred embodiment of the present invention the middle curve is determined in such a way so as to avoid its passing through any portion of the overlapping pixel region where there is substantial misalignment
between the digital images.
Additionally in accordance with a preferred embodiment of the present invention the middle curve is determined by using an optimization algorithm, generally optimized so as to have the least amount of misalignment between the digital images along
its path.
Moreover in accordance with a preferred embodiment of the present invention the optimization algorithm used is a dynamic programming algorithm.
Further in accordance with a preferred embodiment of the present invention the leftmost and rightmost curves are determined by delineating a pixel zone surrounding the middle curve wherein there is no substantial misalignment between the digital
images, determining the leftmost and rightmost curves in such a way so as to be as far away as possible from the middle curve, yet remaining within the pixel zone.
Still further in accordance with a preferred embodiment of the present invention the pixel zone is delineated to be as wide as possible, without containing any pixels where there is substantial misalignment between the digital images.
Additionally in accordance with a preferred embodiment of the present invention the leftmost and rightmost curves are determined by using optimization algorithms, optimized so as to be smooth and as far away as possible from the middle curve.
Moreover in accordance with a preferred embodiment of the present invention the optimization algorithms used are dynamic programming algorithms.
There is also provided in accordance with a preferred embodiment of the present invention a method for aligning a first digital image with a second digital image which overlaps with it in an overlapping pixel region, including determining a
two-dimensional table of pixel displacements for each pixel location in the first image, and replacing the color values in the first image at each source pixel location in the first image with the color value of the pixel displaced from the source pixel
location by the pixel displacement for the source pixel location.
Moreover in accordance with a preferred embodiment of the present invention the pixel displacements are constrained to be zero at at least one side of the first image.
Additionally in accordance with a preferred embodiment of the present invention the pixel displacements are vertical displacements.
Further in accordance with a preferred embodiment of the present invention the determining step includes calculating pixel displacements along multiple vertical lines of pixel locations within the overlapping pixel region, and interpolating
horizontally to calculate pixel displacements at pixel locations not situated on the vertical lines.
Still further in accordance with a preferred embodiment of the present invention the pixel displacements are calculated along each of the multiple vertical lines by using a dynamic programming optimization algorithm.
There is also provided in accordance with a preferred embodiment of the present invention a system for composition of digital images which overlap in an overlapping pixel region, including a digital color processor adjusting the pixel color
values of at least one of the digital images, so as to produce resulting digital images including at least one modified digital image, and a pixel processor combining the resulting digital images in the overlapping pixel region by taking weighted
averages of their pixel color values.
Additional in accordance with a prefered embodiment of the present invention the digital color processor adjusts the pixel color values of at least one of the digital images in a pixel region which includes the overlapping pixel region.
Moreover in accordance with a preferred embodiment of the present invention the digital color processor adjusts the pixel color values of at least one of the digital images in a pixel region which includes pixels outside the overlapping region.
Further in accordance with a preferred embodiment of the present invention the pixel color values are in RGB three-channel format, and the digital color processor operates on at least one channel.
Still further in accordance with a preferred embodiment of the present invention the digital color processor includes a color parameter processor modifying brightness, contrast and gamma factors of each of the digital images so as to produce
modified brightness, contrast and gamma factors, denoted by .alpha., .beta. and .gamma., respectively, and an image processor applying the modified brightness, contrast and gamma factors by changing the color intensity, denoted by I, of at least one of
the digital images to a modified color intensity, denoted by I', according to the formula
Additionally in accordance with a preferred embodiment of the present invention the image processor includes a calculator constructing a lookup table which tabulates the changes in color intensity .DELTA.I=I'-I indexed by I, and a data retriever
accessing the lookup table to modify the color intensities.
Moreover in accordance with a preferred embodiment of the present invention the changes in brightness, contrast and gamma factors produced by the color parameter processor are applied with a weighting factor, the weighting factor tapering off
from a value above 50% to a value below 50% over a pixel region outside of and adjacent to the overlapping pixel region.
There is also provided in accordance with a preferred embodiment of the present invention a system for feathering two digital images which overlap in an overlapping pixel region, including a digital image aligner aligning the digital images so as
to approximately register them in the overlapping pixel region, an image processor determining three curves, one of which is a leftmost curve, another of which is a middle curve and another of which is a rightmost curve, and at least one of which is not
a straight vertical line, the curves extending from the top to the bottom of the overlapping pixel region and lying within the overlapping pixel region, and the middle curve lying between the leftmost and rightmost curves, and a pixel processor combining
the digital images by taking a weighted average of the pixel color values, in such a way that the weights used are a value above 50% of image A and a value below 50% of image B to the left of the leftmost curve, 50% of image A and 50% of image B along
the middle curve, and a value below 50% of image A and a value above 50% of image B to the
right of the rightmost curve.
Further in accordance with a preferred embodiment of the present invention the middle curve is halfway between the leftmost and rightmost curves.
Still further in accordance with a preferred embodiment of the present invention the middle curve is determined by the image processor in such a way so as to avoid its passing through any portion of the overlapping pixel region where there is
substantial misalignment between the digital images.
Additionally in accordance with a preferred embodiment of the present invention the middle curve is determined by the image processor by using an optimization algorithm, generally optimized so as to have the least amount of misalignment between
the digital images along its path.
Moreover in accordance with a preferred embodiment of the present invention the optimization algorithm used is a dynamic programming algorithm.
Further in accordance with a preferred embodiment of the present invention the image processor determining the leftmost and rightmost curves includes a zone processor delineating a pixel zone surrounding the middle curve wherein there is no
substantial misalignment between the digital images, and a curve processor determining the leftmost and rightmost curves in such a way so as to be as far away as possible from the curve, yet remaining within the pixel zone.
Still further in accordance with a preferred embodiment of the present invention the zone processor delineates the pixel zone in such as way so as to make it as wide as possible, substantially without containing any pixels where there is
substantial misalignment between the digital images.
Additionally in accordance with a preferred embodiment of the present invention the curve processor determines the leftmost and rightmost curves by using optimization algorithms, optimized so as to make the curves smooth and as far away as
possible from the middle curve.
Moreover in accordance with a preferred embodiment of the present invention the optimization algorithms used are dynamic programming algorithms.
There is also provided in accordance with a preferred embodiment of the present invention a system for aligning a first digital image with a second digital image which overlaps with it in an overlapping pixel region, including a processor
determining a two-dimensional table of pixel displacements for each pixel location in the first image, and an image writer replacing the color values in the first image at each source pixel location in the first image with the color value of the pixel
displaced from the source pixel location by the pixel displacement for the source pixel location.
Moreover in accordance with a preferred embodiment of the present invention the pixel displacements are constrained to be zero at at least one side of the first image.
Additionally in accordance with a preferred embodiment of the present invention the pixel displacements are vertical displacements.
Further in accordance with a preferred embodiment of the present invention the processor includes a calculator calculating pixel displacements along multiple vertical lines of pixel locations within the overlapping pixel region, and an
interpolator interpolating horizontally to calculate pixel displacements at pixel locations not situated on the vertical lines.
Still further in accordance with a preferred embodiment of the present invention the calculator operates by using a dynamic programming optimization algorithm.
Throughout the specification and claims, positional and directional terms such as up, down, right, left, top and bottom have been used for the purpose of explaining relationships between various images and portions thereof. It is to be
appreciated that these terms are to be considered as being relative only and that, for example top and bottom refers equally to right and left and that the present invention is not limited by the relative positions or directions of images, portions of
images, curves or lines constructed thereon. For example, images may be stitched together vertically rather than horizontally as described in the specification.
BRIEF DESCRIPTION OF THE DRAWINGS
The file of this patent contains at least one drawing executed in color. Copies of this patent with color drawing(s) will be provided by the Patent and Trademark Office upon request and payment of the necessary fee.
FIG. 1 is a prior art diagram illustrating the compositing of two images by feathering in accordance with the prior art;
FIGS. 2A and 2B are two images to be composited, photographed under significantly different lighting conditions;
FIGS. 3A and 3B are two corrected images, modified according to the present invention, corresponding respectively to FIGS. 2A and 2B;
FIG. 4 is a composite image obtained by feathering together FIGS. 3A and 3B;
FIG. 5A is a composite image obtained by prior art feathering exhibiting ghosting;
FIG. 5B is a composite image obtained in accordance with the present invention and illustrating curves used in accordance with the present invention;
FIGS. 6A-6D are composite images which illustrate operation the warping system of the present invention; and
FIGS. 7A-7E are simplified flow charts of a preferred embodiment of the present invention.
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
In digital stitching applications, multiple overlapping photographic images of a scene are taken, each image from a different camera position. The images are digitized, and automatically aligned and merged together, so as to cover an extended
view angle, up to 360.degree.. In addition, the images are projected onto a sphere or cylinder or cube, or other geometrical object, in order to provide a three-dimensional omniview.
Aligning the images involves digital image processing, and typically uses a metric such as coefficient of correlation to measure "goodness-of-fit." Some degree of misalignment is always to be expected. Coefficient of correlation is an
appropriate metric, because it is invariant to linear color adjustments. Specifically, if the images are darkened or lightened, then the coefficient of correlation remains invariant--which is a desirable feature, since the alignment should not be
affected by darkening or lightening.
Merging the images involves combining the respective pixel color values in the rectangular region of overlap, so as to come up with a single combined image. In distinction to aligning, merging is impacted by changes in darkness or lightness, as
the combined image reflects a side-by-side view of the two images. Specifically, if the images were taken under different lighting conditions, then merging the images together can lead to severe artifacts typified by awkward coloration bands in the
vicinity of the overlap region.
State of the art technology for merging two images, designated as "image A" and "image B," uses a technique known as "feathering," which computes a weighted combination of the pixel values of image A and image B in the rectangular overlap region. Specifically, if I.sub.A (x,y) and I.sub.B (x,y) denote the intensities of a color channel for image A and image B at a common pixel location (x,y) within the overlap region, then the combined image intensity is given by
The weight factor, w(x), varies from 1 to 0 linearly with horizontal position (i.e. x), with w=1 at the image A side of the overlap region, say the left end x=0, and w=0 at the image B side, say the right end x=W, where W denotes the total width
in pixels of the overlap region.
Prior art FIG. 1 illustrates two images A and B, designated by reference numerals 10 and 12, respectively, and their overlap region, designated by reference numeral 14. The vertical line 16 in the middle of the overlap region corresponds to the
"50/50 line," referred to hereinafter as the "splice line," where the weights used to combine image A and image B are both 1/2. The weight functions w(x) and 1-w(x) for image A and image B, respectively, are illustrated in FIG. 1.
A slight generalization of the above feathering, which is part of the present invention, involves explicit designation of the splice line, where the weight factor w is exactly 1/2. Whereas in the description above, the splice line falls in the
horizontal middle of the rectangular overlap region, x=W/2, in this generalization the splice line can be placed anywhere along the horizontal extent of the rectangular overlap region. The weight factor w(x) in equation (1) varies from w=1 at the left
end x=0 to w=1/2 at the splice line, and from w=1/2 at the splice line to w=0 at the right end x=W.
FIGS. 2A and 2B are two images, a left image 20, hereinafter denoted as "image A" and a right image 22, hereinafter denoted as "image B", which were taken under significantly different lighting conditions. In general, when two such images are
taken under significantly different lighting conditions, and their overlap region is narrow, then the above feathering produces annoying artifacts of color bands at the overlap region. The present invention teaches a method to adjust the color of the
images, based on pixel information from the overlap region, so as to bring the two images into line with one another. Specifically, brightness, contrast and gamma parameters, denoted by .alpha., .beta. and .gamma., respectively, are used to modify
image color intensity according to the equation
For each of the two images, A and B, and for each of the color channels, optimal values of the parameters .alpha., .beta. and .gamma. are sought so as to minimize the effect of the lighting difference between the two images. Different optimal
values .alpha., .beta. and .gamma. are used for each of the images and color channels, so that 18 parameters would be derived in the case of two images each having three color channels.
In a preferred embodiment, the present invention seeks to match as best as possible the color intensities of image A to an average image, using a least sum of squares error criterion, it being understood that any other error criterion could also
be used. Specifically, it seeks to minimize the deviation between the color intensities of the adjusted image A ##EQU1## for the three image A parameters, and ##EQU2## for the three image B parameters, where, I.sub.AB (x,y) is the average image of A and
B, given by
and, according to equation (2), I'.sub.A (x,y) denotes .alpha.+.beta..multidot.I.sub.A.sup..gamma. (x,y) and I'.sub.B (x,y) denotes .alpha.+.beta..multidot.I.sub.B.sup..gamma. (x,y).
In a preferred embodiment of the present invention, the algorithm used to solve the minimization in equation (3) is to reduce the minimization problem from a three parameter problem (over .alpha., .beta. and .gamma.) to a one parameter problem
(over .gamma.) by observing that for a fixed value of the parameter .gamma., one can find the optimal values of .alpha. and .beta. using the standard formulas for linear regression. The minimization in equation (3) thus transforms to the one parameter
problem ##EQU3## where the functions F(.gamma.) and G(.gamma.) are given by ##EQU4## and N is the total number of pixels in the pixel overlap region. In order to facilitate the computation of the functions F(.gamma.) and G(.gamma.), a table of values of
I.sup..gamma. vs. .gamma. is pre-computed, since there are only 256 values for I. Once an optimal value of .gamma. is determined, the corresponding values of .alpha. and .beta. are given by ##EQU5##
It is readily apparent to those skilled in the art that an alternative to the expression in equation (3) is to use the expression ##EQU6## to find optimal parameters .alpha., .beta. and .gamma. for the A image alone, and leave the B image
unchanged (or vice versa). This would be advantageous in case the lighting in image A is undesired, but the lighting in image B is desired. It is also readily apparent to those skilled in the art that a weighting factor .rho.(x,y)) can be incorporated
into the expression to be minimized in equation (3). For example, it makes sense to weight pixel locations near the center of the overlap region more than others.
Once the optimal brightness, contrast and gamma parameters are determined, they are applied to the image. Strictly speaking, applying them to image A, for example, would entail modifying the color intensity from I.sub.A (x,y) to I'.sub.A
(x,y)=.alpha.+.beta..multidot.I.sub.A.sup..gamma. (x,y). Equivalently, the intensity change
is adde | | |