# Patent

## Title
Patch-based synthesis techniques

## Abstract

Methods, apparatus, and computer-readable storage media for patch-based image synthesis. A patch matching technique provides an extended patch search space that encompasses geometric and photometric transformations, as well as gradient domain features. The geometric transformations may include translation, rotation, reflection, scale, and non-uniform scale. The photometric transformations may include gain and bias. Patch-based image synthesis techniques may leverage the extended patch search space in various image synthesis applications. The patch-based image synthesis techniques may also integrate image gradients into the patch representation and replace conventional color averaging with a technique that performs voting for colors and gradients and then solves a screened Poisson equation based on values for colors and gradients when blending patch(es) with a target image.

## Background
PRIORITY INFORMATION
This application claims benefit of priority of U.S. Provisional Application Ser. No. 61/528,601 entitled “GENERALIZED PATCH-BASED SYNTHESIS” filed Aug. 29, 2011, the content of which is incorporated by reference herein in its entirety.


BACKGROUND
Description of the Related Art
Patch-based Synthesis
Patch-based synthesis methods have become a popular tool for image and video synthesis and analysis. Applications include texture synthesis, image and video completion, retargeting, image reshuffling, image stitching, new view synthesis, morphing, denoising and more.
SUMMARY
Various embodiments of methods, apparatus, and computer-readable storage media for providing patch-based synthesis are described. A patch matching technique is described that provides an extended patch search space that encompasses geometric and photometric transformations, as well as gradient domain features. The geometric transformations may include translation, rotation, reflection, uniform scale (referred to herein as simply a scale transform), and non-uniform scale. The photometric transformations may include searching over gain and bias metrics to handle brightness and contrast differences between source and target images or regions of an image. Combinations of two or more transformations (e.g., scale and reflection, non-uniform scale and bias, rotation and gain, reflection, gain, and bias, etc.) may also be included in the search space. Combining these various geometric and photometric transformations may, for example, allow embodiments to better handle source and destination regions (patches) with different color, contrast and/or geometric characteristics than do conventional techniques.
Patch-based image synthesis techniques as described herein may leverage the extended patch search space in various image synthesis applications. The patch-based image synthesis techniques may also integrate image gradients into the patch representation and replace conventional color averaging with a technique that performs voting for colors and gradients and then solves a screened Poisson equation based on values for colors and gradients when blending patch(es) with a target image. The patch-based synthesis techniques may be applied in a general patch-based synthesis framework that handles inconsistencies within and across image sources.
Embodiments may provide augmented patch-based image synthesis methods by giving the algorithm the freedom to apply additional geometric and photometric variations to the synthesis. In addition, embodiments may integrate image gradient features into an optimization process and thus may combine the strengths of gradient domain blending and patch-based synthesis. Embodiments of the patch-based synthesis techniques may thus provide substantial improvement in applications such as image completion, hole filling with large intra-image variations, hole filling from multiple source images, object cloning, morphing, image blending, image stitching, and panoramic image stitching when compared to conventional techniques.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 schematically shows an example system that can determine a correspondence between image regions, according to some embodiments of methods for determining correspondence between image regions.
FIGS. 2A through 2C show examples of mappings between image regions, according to some embodiments of methods for determining correspondence between image regions.
FIGS. 3 through 5 show flowcharts of example methods for determining correspondence between image regions, according to some embodiments.
FIGS. 6A-6B, 7A-7B, 8A-8B, 9A-9B, and 10A-10B illustrate some example failure cases for conventional patch-based fill methods.
FIGS. 11A through 11E compare conventional fill methods that incorporate only translation to embodiments that incorporate geometric transformations such as rotation and scale.
FIG. 12 illustrates that embodiments may apply reflection and non-uniform scale geometric transformations.
FIG. 13 illustrates methods for retrieving high quality patches, according to at least some embodiments.
FIGS. 14, 15, and 16 show results generated using embodiments that employ geometric transformations when synthesizing the missing regions shown in FIGS. 7A, 8A, and 9A, respectively.
FIGS. 17A and 17B illustrate applying gradients in a patch-based synthesis process, according to at least some embodiments.
FIGS. 18A and 18B show results generated using embodiments that employ the geometric transformations (specifically, reflection) and photometric transformations when synthesizing a missing region.
FIG. 19A through 19D show an example of using one source image to fill a region in a second image, according to at least some embodiments.
FIGS. 20A through 20C show an example that illustrates using gradients, according to at least some embodiments.
FIGS. 21A through 21D show an example that illustrates using gradients, according to at least some embodiments.
FIGS. 22A through 22F show an example of multi-image hole filling, according to at least some embodiments.
FIGS. 23A through 23G show an example of multi-image hole filling, according to at least some embodiments.
FIG. 24A through 24C show an example of cloning, according to at least some embodiments.
FIGS. 25A through 25D show an example of image stitching, according to at least some embodiments.
FIG. 26 is a high-level flowchart of a content-aware synthesis method that implements patch-based synthesis techniques, according to at least some embodiments.
FIG. 27 is a flowchart of a content-aware synthesis framework that implements patch-based synthesis techniques, according to at least some embodiments.
FIG. 28 is a flowchart of a method for generating a reconstructed image that implements a patch matching technique, according to at least some embodiments.
FIGS. 29A through 29E illustrate image completion according to at least some embodiments, and compare results to conventional techniques.
FIG. 30 illustrates an example module that may implement embodiments of the image processing techniques as described herein.
FIG. 31 illustrates an example computer system that may be used in embodiments.



While the invention is described herein by way of example for several embodiments and illustrative drawings, those skilled in the art will recognize that the invention is not limited to the embodiments or drawings described. It should be understood, that the drawings and detailed description thereto are not intended to limit the invention to the particular form disclosed, but on the contrary, the intention is to cover all modifications, equivalents and alternatives falling within the spirit and scope of the present invention. The headings used herein are for organizational purposes only and are not meant to be used to limit the scope of the description. As used throughout this application, the word “may” is used in a permissive sense (i.e., meaning having the potential to), rather than the mandatory sense (i.e., meaning must). Similarly, the words “include”, “including”, and “includes” mean including, but not limited to.
DETAILED DESCRIPTION OF EMBODIMENTS
In the following detailed description, numerous specific details are set forth to provide a thorough understanding of claimed subject matter. However, it will be understood by those skilled in the art that claimed subject matter may be practiced without these specific details. In other instances, methods, apparatuses or systems that would be known by one of ordinary skill have not been described in detail so as not to obscure claimed subject matter.
Some portions of the detailed description which follow are presented in terms of algorithms or symbolic representations of operations on binary digital signals stored within a memory of a specific apparatus or special purpose computing device or platform. In the context of this particular specification, the term specific apparatus or the like includes a general purpose computer once it is programmed to perform particular functions pursuant to instructions from program software. Algorithmic descriptions or symbolic representations are examples of techniques used by those of ordinary skill in the signal processing or related arts to convey the substance of their work to others skilled in the art. An algorithm is here, and is generally, considered to be a self-consistent sequence of operations or similar signal processing leading to a desired result. In this context, operations or processing involve physical manipulation of physical quantities. Typically, although not necessarily, such quantities may take the form of electrical or magnetic signals capable of being stored, transferred, combined, compared or otherwise manipulated. It has proven convenient at times, principally for reasons of common usage, to refer to such signals as bits, data, values, elements, symbols, characters, terms, numbers, numerals or the like. It should be understood, however, that all of these or similar terms are to be associated with appropriate physical quantities and are merely convenient labels. Unless specifically stated otherwise, as apparent from the following discussion, it is appreciated that throughout this specification discussions utilizing terms such as “processing,” “computing,” “calculating,” “determining” or the like refer to actions or processes of a specific apparatus, such as a special purpose computer or a similar special purpose electronic computing device. In the context of this specification, therefore, a special purpose computer or a similar special purpose electronic computing device is capable of manipulating or transforming signals, typically represented as physical electronic or magnetic quantities within memories, registers, or other information storage devices, transmission devices, or display devices of the special purpose computer or similar special purpose electronic computing device.
Various embodiments of methods, apparatus, and computer-readable storage media for providing patch-based synthesis are described. Patch-based synthesis methods including patch matching and patch blending techniques are described that may be applied in image synthesis tasks such as hole-filling, image blending, image stitching, cloning, image morphing, image retargeting, and reshuffling.
A patch matching technique is described that provides an extended patch search space that encompasses geometric and photometric transformations, as well as gradient domain features. The geometric transformations may include, but are not limited to, translation, rotation, reflection, uniform scale (referred to herein as simply a scale transform), and non-uniform scale. The photometric transformations may include, but are not limited to, searching over a range of gain and bias parameters to handle brightness and contrast differences between source and target images or regions of an image. In at least some embodiments, the patch matching technique may search over combinations of two or more transformations, for example by applying both reflection and gain transformations to a given source patch, or by applying non-uniform scale, bias, and gain transformations to a given source patch.
A patch-based synthesis technique is described that is based on a framework that iteratively performs a search of source patches in the extended patch search space using the patch matching technique to identify transformed source patches in source image(s) that best match target patches in the target image, and a voting technique that applies the transformed source patch(s) to the target image. A patch may be defined as a region in an image, of fixed or varying shape. As a non-limiting example, patches may be fixed-shape 5×5 or 7×7 (in pixels) squares. A transformed patch is a patch to which one or more transformations have been applied. The patch-based image synthesis techniques may also integrate image gradients into the patch representation and replace conventional color averaging with a technique that performs voting for colors and gradients and then solves a screened Poisson equation based on values for colors and gradients when blending image data (e.g., colors) from the transformed source patch(es) with a target image.
Embodiments of the patch-based synthesis techniques may apply the extended search space provided by the patch matching technique to various image synthesis applications, for example hole-filling, object cloning, and image stitching. Using the patch matching techniques described herein, the patch-based synthesis techniques may extend the search space for similar patches to one or more of rotation, uniform and non-uniform scale, reflection, color, and gradients, and combinations thereof, and may combine a voting step with gradient domain blending techniques. Embodiments may provide augmented patch-based image synthesis methods by giving the algorithm the freedom to apply more geometric and photometric variations than in conventional techniques. Extending the search space for source patches may also allow embodiments to better utilize multiple images as sources for patches than do conventional techniques, as differences between images (e.g., color, brightness, and contrast differences, as well as geometric differences) may be compensated for by the extended transformations. In addition, embodiments may integrate gradient features into the optimization process and thus combine the strengths of gradient domain blending and patch-based synthesis. Embodiments of the patch-based synthesis techniques may thus provide substantial improvement in applications such as hole filling with large intra-image variations, hole filling from multiple images, object cloning, and stitching challenging panoramas when compared to conventional techniques.
Embodiments of the patch matching techniques and patch-based synthesis techniques may extend patch-based synthesis to handle more transformations than in conventional techniques, and may provide additional features, capabilities, and applications, for example as described below.
Geometric transformations—In conventional patch-based synthesis techniques, the search for patches is conducted only over the space of translations. Embodiments of the patch-based synthesis techniques described herein may add rotation, uniform scale, non-uniform scale, and reflection to the search space. These additional geometric transformations may address one or more of, but not limited to:

    
    
        Misaligned edges—Misaligned edges are hard to handle in conventional patch-based synthesis techniques. As an example, take the simple disconnected line in 1D. If there is only the option to translate lines to fill the hole, the intersection will be either blurry or jaggy. By applying rotation and/or other geometric transformations as described herein, embodiments may easily connect these two lines.
        Obvious repetitions—By rotating and scaling the patches, embodiments may expand the number of patches available for synthesis, and therefore may reduce artifacts due to repetition of cloned patches. Also, when repetitions do occur, slight geometric transformations may make it harder for the user to perceive the repetition because it is harder for humans to detect rotated and scaled copies than it is to detect simple translated copies.
        Symmetry—Using reflection enables embodiments to improve the quality of the synthesis when symmetric objects are depicted in the input image.
    
    


Photometric transformations—To handle brightness and contrast differences between source and target images or regions of an image, at least some embodiments of the patch-based synthesis techniques may search over the space of gain and bias per patch, and at the synthesis (blending) phase may adjust the colors of a source patch to better match colors of the target image according to the recovered gain and bias parameters.
Including gradients in the objective function—At least some embodiments may integrate gradient features into the optimization process, and thus may combine the strengths of gradient domain blending with patch-based synthesis. With this addition, embodiments may, for example, perform hole filling under smoothly varying color and texture where conventional patch-based synthesis techniques may fail.
Hole filling from multiple images—Because embodiments are able to compensate for rotation, scale and color differences, at least some embodiments may be configured to fill holes in one image using source content from a collection of two or more other source images, for example a set of images in a database or a set of layers in an image.
Stitching different images—At least some embodiments may provide a framework that can produce smooth transition from one object to another by synthesizing new textures. This ability may be applied, for example, in an image stitching technique to stitch different objects and/or different images together.
Embodiments of the patch matching techniques described herein may leverage and extend the patch matching technology as described in Barnes, C., Shechtman, E., Finkelstein, A., and Goldman, D. (2009), PatchMatch: A randomized correspondence algorithm for structural image editing, Association of Computing Machinery (ACM) Transactions on Graphics (Proceedings of SIGGRAPH); and Barnes, C., Shechtman, E., Goldman, D., and Finkelstein, A. (2010), The generalized patchmatch correspondence algorithm, European Conference on Computer Vision (ECCV). FIGS. 1 through 5 and the following section, titled Determining Correspondence Between Image Regions, broadly illustrate and describe these patch matching techniques for determining correspondence between image regions, i.e. patches. Later in this document, in a section titled Generalized patch-based synthesis, embodiments of patch matching techniques and patch-based synthesis techniques are described that leverage and extend the technology described in Barnes, et al. (2009), Barnes, et al. (2010), and in the section Determining Correspondence Between Image Regions to handle more transformations than in conventional patch-based synthesis techniques, and to provide additional features, capabilities, and applications, for example as described above. In addition, additional Figures and discussion are provided that, for example, compare conventional techniques to the patch-based synthesis techniques described herein. In particular, the section titled Generalized patch-based synthesis describes embodiments of a content-aware synthesis method that may be implemented to apply the features and capabilities of the patch matching techniques and patch-based synthesis methods described herein to tasks such as filling holes or regions in images, for example regions occluded by an undesirable object, using patches located in the same image and/or in one or more other images according to the patch searching techniques that leverage geometric and photometric transformations described herein.
Determining Correspondence Between Image Regions
This section describes methods for determining correspondence between image regions, as illustrated in FIGS. 1 through 5.
FIG. 1 provides examples of determining correspondences between image regions, according to at least some embodiments. Referring to FIG. 1, S and T represent images stored in any of a number of different formats, such as a pixel-based format where the images S and T are made up of the same or different numbers of pixels. In some implementations, it may be useful to determine a correspondence between one or more regions of the image S and the image T. For example, it may be useful to determine whether for image content 102 (e.g., a flower) in the image S there is any corresponding image content 104 in the image T. As another example, a correspondence between two or more regions of a single image, for example two or more regions within the image S, may need to be determined. Regions can include dense subsets of the total number of pixels that make up the entire image.
A patch may be defined as a region in an image, of fixed or varying shape. As a non-limiting example, patches may be defined as fixed-shape 5×5 or 7×7 squares. In some implementations, a goal is to find, for each of patch 106 in the image S, one or more corresponding patches 108A-C in the image T under a patch distance function. In some implementations, one can search over a space of offsets into the target image (e.g., the image T), rather than over the space of patches in the target image. For example, a notation can be used such that a patch P in the image S is defined as P=S(i,j), namely the patch in the image S having its upper left corner at column i and row j of the pixels in the image S. A patch T(k,l) in the image T can be similarly defined. In some implementations, an offset between patches S(i,j) and T(k,l) can be defined as (k−i, l−j). For example, if the two images S and T were identical, the best mapping from S to T when translation without warping is performed can be expressed as:

arg mink,l(D[S(i,j),T(k,l)])=(k−i,l−j)

for all (i,j) and (k,l), where D is a patch distance function.

One or more offset objects Os and one or more offset objects OT can be defined. Here, OS is the current offsets (k−i, l−j) determined for all patches S(i,j). Similarly, OT is the current offsets (i−k, j−l) determined for all patches T(k,l). The offsets can be termed a nearest-neighbor field ƒ such that:

ƒ:R2R2.

The nearest-neighbor field ƒ can be improved using a randomized patch-matching algorithm that is performed for a predefined number of iterations or until convergence. Initial offsets for all patches are defined as a starting point, and in each iteration the algorithm seeks to improve every offset using two sets of candidates: propagation candidates and random-search candidates. The propagation candidates for offset ƒ(x, y) are the known offsets above or to the left (ƒ(x−1, y) and ƒ(x, y−1)). On alternating iterations, propagation can instead be done in reverse scan order, such that offsets below and to the right are examined. Generally, a propagation candidate that provides a smaller patch distance D should replace the current offset.
The random search can be performed to prevent the evaluation of propagation candidates from ending up in a local minimum. The random-search candidates are sampled from an exponential distribution relative to the current offset (e.g., offsets located at an exponentially decreasing distance from the current offset in a random direction). The current offset is replaced if the random-search candidate has a smaller patch distance D.
In some implementations, the offsets can be stored in images of the same size as the images S and T. For example, a pixel OS(i,j) contains the current offset (k−i, l−j) such that the corresponding patch Q in the image T is found at coordinate (k,l). In some implementations, the algorithm can proceed by iteratively improving the estimates OS and OT so that they approach:

minQ⊂TD(P,Q) and minP⊂SD(Q,P)

in the limit.

Any distance function can be used. Some implementations can use common distance functions for natural images and/or other data sources including video and three-dimensional shapes, such as an Lp, L1, or clamped L2, etc., or any other scalar function.
When searching for similar image regions for a current patch, it may be desirable to search also for patches that after being warped are similar or identical to the current patch. In some implementations, the similarity search is first performed with the target patches in an unaltered (i.e., not yet warped) state, and the candidate matches are registered. Thereafter, one or more warping actions are applied to the candidate matches and a search is performed for any patches that, after being warped, are similar to the current patch. Any type of warping can be used that allows parameterization over one or more warping parameters. In some implementations, the candidate patches can be warped using one or more warping actions of: rotation, scaling, transformation (e.g., affine or polar), homography, and combinations thereof. In some implementations, as another example, the candidate patches can remain unaltered (not warped), while instead the current patch is warped, before making a similarity measurement between the two registered patches.
As a first example of warping, arbitrary rotating and/or scaling can be performed in the process of seeking matching patches. In some implementations, rotating and/or scaling is used in applications such as object detection, denoising or super-resolution, where it may be desirable to match patches across a range of one or more possible warping actions, such as rotations and/or scales. For example, a patch 108B in T is here rotated around its center, a patch 108C in T is scaled, a patch 108D is transformed, and a patch 108E is warped, all compared to the other patches 108A.
To search a range of rotations θε[θ1, θ2] and a range of scales sε[S1, S2], a patch-matching algorithm is created that has a search space of (x, y, θ, s). For example, this can be done by extending an algorithm that has the (x, y) search space with parameters for additional search dimensions. That is, the matching algorithm can be characterized as a function ƒ such that:

ƒ:R2R4.

The function ƒ can be initialized by uniformly sampling from the range of possible positions, orientations and scales. In the propagation phase, the relative offsets between pixels (Δx, Δy) can be transformed using a transformation matrix T(θ, s). In the random search phase, a sampling window of exponentially decreasing size can be used, and all four dimensions of the search space can be contracted around the current state.
Similarly, when using any other warping action(s) on the patches, the patch-matching algorithm can be defined to have a search space that includes one or more dimensions for the corresponding warping parameter(s). For example, when the warping involves affine transformation, the action can be parameterized in terms of a linear transformation (e.g., amount(s) of rotation, scaling or shear) and a translation (e.g., amount of shift). As another example, when the warped candidate patch is a homography of the unwarped candidate patch, then rotation and translation parameters are defined, optionally with one or more additional parameters, such as a camera projection matrix.
Any warping action can be represented by a warping object WS in analogy with the offset object OS mentioned above. That is, WS(i,j) can represent the warping action(s) currently associated with the patch at (i,j). Similarly, a warping object WT corresponds to the offset object OT.
FIGS. 2A through 2C show examples of mappings between image regions. In FIG. 2A, an image realm 200 includes images A and B. A patch 202 is located in a region of the image A. The patch 202 is associated with one or more mappings 204 to another image region. In some situations, this mapping represents an initial guess of what image region(s) best correspond to the patch 202, for example using the offset vectors mentioned above. For example, the other image region(s) can be located in the image B, such as the region(s) represented by one or more patches 206. The patch(es) 206 can correspond to any or all of the patches 108A-C discussed above; that is, the patch(es) 206 can include a rotated patch (cf. patch 108B), a scaled patch (cf. patch 108C), a non-rotated and non-scaled patch (cf. patch 108A), or combinations thereof. Each patch in the image A can have one or more mappings associated with it. A mapping can be improved in one or more iterations, for example as will now be described.
In some implementations, a propagation phase can be carried out as schematically illustrated in FIG. 2B. For example, assume that a patch 208 in the image A has been mapped to one or more patches 210 in the image B, the mapping(s) not shown in the figure for clarity. Neighbors of the patch 208 can now be evaluated to determine what mappings they have, and whether any of these mappings can be applied to the patch 208 for a better result. In some implementations, the offset vectors mentioned above can be used. For example, the algorithm can look at the offset vectors of neighboring or nearby patches, and use one of these offset vectors if it provides a better result. In some implementations, an algorithm can look at the four immediately adjacent pixels, or all pixels in a circular or square neighborhood of diameter 2 or 4, and/or any subset of the pixels within a fixed distance of the pixel at which propagation occurs, to name just a few examples. Here, for example, it may be determined that if one applies the mapping of a patch 212, then the patch 208 can be provided with a mapping 214 to a patch 216, which has a better correspondence to the patch 208 than the earlier mapping to the patch 210. The term propagation indicates that good mappings for one patch can be propagated to neighboring patches to improve their mappings. Thus, for example, if a local maximum of correspondence exists in mappings of a neighborhood around the patch 208, it can be detected in the propagation phase.
In some situations, the propagation phase may not find the globally best mapping. A perturbation such as a random-search phase can therefore be used as schematically illustrated in FIG. 2C. Here, the patch 208 initially has a mapping 214′, for example resulting from the propagation phase. One or more randomly selected mappings can then be evaluated. For example, patches 218A, 218B and 218C can be randomly selected in the image B. In some implementations, the patches 218A-C are selected to have gradually increasing or decreasing distance from the location of the original mapping target in the image B. For example, a random distribution can be used that includes nearby locations (e.g., the patch 218A) and locations further away (e.g., the patch 218C), wherein the distribution places more weight in the distribution function on distances of nearby locations than would be obtained from uniform sampling. In some implementations, an algorithm can sample at uniform from the entire image with probability 1⁄2, and sample from a circle with small radius around the current mapping with probability 1⁄2, giving a random distribution where smaller distances are preferentially selected, and/or sample according to a Gaussian distribution around the current mapping, to preferentially select smaller distances. As another example, the probability density function can be generally decreasing, meaning that it does not have to be monotonic, but generally decreases as radius increases. In some implementations, the random search can be performed by sampling only those points whose distance is within an exponentially decreasing threshold from the mapping of the first patch. The patches 218A-C can be evaluated to determine whether a better correspondence with the patch 208 can be achieved using a randomly selected patch.
FIGS. 3 through 5 show flowcharts of example methods for determining correspondence between image regions, according to some embodiments. In some implementations, more or fewer steps can be performed, and/or one or more steps can be performed in a different order.
The method illustrated in FIG. 3 relates to determining correspondence between image regions. As indicated at 410 first and second regions of visual content including pixels are selected. The first region includes a first patch to be mapped to the second region. For example, referring to FIG. 1, the regions corresponding to the patch 106, and to one or more of the patches 108A-C, can be selected. As indicated at 420, iterations are performed to find mappings for the first patch. The iterations may include nearby-pixel mapping evaluation and random-perturbation mapping evaluation. As indicated at 430, second patches in the second region found using the iterations are recorded.
The method illustrated in FIG. 4 relates to determining correspondence between image regions using a selected image descriptor and/or distance metric. As indicated at 510, an image descriptor is selected for first and second regions. The first region includes a first patch to be mapped to the second region. In some implementations, a descriptor of 7×7 patches is used. As indicated at 520, a distance metric for evaluating mappings for the first patch is selected. For example, the distance metric can be selected from the L2 norm; a modified L2 distance that involves correction for limited changes in lighting by normalizing the mean and standard deviation in luminance to be equal; or any other algorithm that supplies a total ordering, with the implicit assumption that patches with close spatial proximity should also be more likely to have similar offsets for their best nearest-neighbors. As indicated at 530, iterations are performed to find the mappings for the first patch, the iterations including nearby-pixel mapping evaluation and random-perturbation mapping evaluation. The iterations use the selected image descriptor and the selected distance metric. As indicated at 540, at least one second patch in the second region found using the iterations is recorded.
The method illustrated in FIG. 5 relates to determining correspondence between image regions using one or more warping actions. For example, the warping can involve one or more of scaling, rotation, transformation, homography, and combinations thereof. As indicated at 610, first and second regions of visual content including pixels are selected. The first region comprises a first patch to be mapped to the second region. For example, the regions corresponding to the patch 106, and to one or more of the patches 108A-C, can be selected. As indicated at 620, iterations are performed to find mappings for the first patch, the iterations including nearby-pixel mapping evaluation and random-perturbation mapping evaluation. A warping action is performed on the candidate patch in at least one of the iterations. For example, the patch 108B and/or the patch 108C (FIG. 1) can be used. As indicated at 630, at least one other patch in the second region found using the iterations is recorded.
Generalized Patch-Based Synthesis
This section describes embodiments of generalized patch matching techniques and generalized patch-based synthesis techniques that leverage and extend the methods described in the above section titled Determining Correspondence Between Image Regions. The patch-based synthesis techniques described herein, using the patch matching techniques that extend the search space for patches in both the geometric and photometric domains, may handle more transformations than do conventional patch-based synthesis techniques, and may provide additional features, capabilities, and applications, for example geometric transformations, photometric transformations, gradient domain blending, hole filling from multiple images, and image stitching. This section also describes embodiments of a content-aware synthesis method that may be implemented to apply the features and capabilities of the patch matching techniques and patch-based synthesis methods described herein to tasks including but not limited to filling holes or regions in images, for example regions occluded by an undesirable object, using patches located in the same image and/or in one or more other images according to the patch searching techniques and transformations described herein. In addition, Figures and discussion are provided that, for example, compare conventional techniques to the patch-based synthesis techniques described herein.
FIG. 26 is a flowchart that broadly describes a content-aware synthesis method, according to at least some embodiments, and is not intended to be limiting. As indicated at 700, one or more source images and an indication of a region to be filled in a target image may be obtained. As indicated at 702, a patch matching technique as described herein may be applied to identify one or more transformed source patches in at least one source image that best match one or more destination (or target) patches each at least partially in the region to be filled in the target image (a target patch may overlap the image outside the fill region and the region itself). The patch matching technique may employ one or more geometric transformations and/or one or more photometric transformations, and combinations of the transformations, as described herein to identify the one or more transformed source patches according to geometric properties and/or photometric properties of the patches. In at least some embodiments, the patch matching technique may identify transformed source patches according to gradient information instead of or in addition to the geometric and/or photometric criteria. The geometric transformations may include, but are not limited to, translation, and one or more of rotation, reflection, scale, and non-uniform scale. The photometric transformations may include, but are not limited to, gain and bias.
As indicated at 704, the method may fill the region in the target image using image data from the one or more transformed source patches. In at least some embodiments, filling the region in the target image may involve applying one or more geometric operations and/or one or more photometric operations to the source patches to adjust (or transform) the source patches to properties of the target image, thus generating the transformed source patches. In at least some embodiments, filling the region in the target image may also involve applying a gradient domain blending technique that may smooth texture when blending source image data from the transformed source patches with image data in the target image.
As indicated by the arrow returning from element 704 to element 702, the method may iteratively perform searching for source patches and blending of the located transformed source patches to perform the image synthesis task (e.g., hole filling). As indicated at 706, once the synthesis task (e.g., hole filling) is complete, the method may output the final image.
The following (Algorithm 1) is example pseudocode for a content-aware synthesis method that incorporates the patch matching technique and patch-based synthesis technique described herein, according to at least some embodiments, and is not intended to be limiting. In conventional patch-based synthesis techniques, the search for patches was conducted only over the space of translations. The content-aware synthesis methods described herein incorporate geometric transformations, photometric transformations, and gradient feature handling not provided in those conventional techniques. Embodiments of the content-aware synthesis method may add geometric transformations including rotation, uniform scale, non-uniform scale, and reflection spaces to the search space. In addition, to better handle brightness and contrast differences, at least some embodiments may search over the space of gain and bias per patch, and at the synthesis phase may adjust the colors according to the recovered gain and bias parameters. At least some embodiments may integrate gradient features into the optimization process, and thus may combine the strengths of gradient domain blending with patch-based synthesis. With these additions, embodiments may, for example, perform hole filling under smoothly varying color and texture where conventional patch-based synthesis techniques may fail. The ability to compensate for rotation, scale and color differences may enable at least some embodiments to fill holes in one image using source content from a collection of other source images, for example a set of images in a database or a set of layers in an image. Furthermore, at least some embodiments may provide a framework that can produce smooth transitions from one object to another by synthesizing new textures. This ability may be applied, for example, in an image stitching technique to stitch different objects and/or different images together.










Algorithm 1 - Example content-aware synthesis method















Input: input image Iorig and input mask that indicates hole pixels to be synthesized


Output: final image with filled hole pixels


1.  Down-sample input image and input mask to scale s0 : I and H correspondingly


2.  Set initial guess for hole colors in I by a smooth interpolation from the hole boundary


  pixels


3.  Compute intensity gradient channels ∇I x and ∇I y and add them to the three color


  channels


4.  Generate a full-resolution scale-space pyramid Ipyr from image Iorig


5.  for scale s from s0 to 1 with step size m


6.   If s > s0, upscale I to scale s


7.   Create a 2D array A for hole colors (of the dimensions of I with 5 channels) and


   set A=0


8.   Create a 2D array W for weights (of the dimensions of I with 1 channel) and set


   W=0.


9.   for Iteration i = 1 to n


10.   for all pixels p in I with coordinate x, y


11.     Extract a patch P around pixel p of size k × k


12.     Use the generalized patch matching techniques with Ipyr to find an


     approximate nearest neighbor patch Q outside the hole with the translation


     tx, ty (continuous values), non-uniform scale tsx and tsy, orientation to,


     reflection tr, color gain tg and color bias tb in I (or in a separate image)


13.     Extract the patch Q from Ipyr by sampling color values around location tx,


     ty and with the transformations tsx, tsy, to, tr, tg and tb


14.     Calculate vertical and horizontal gradients ∇I x and ∇I y of patch Q


15.     for all coordinates x′ from 1 to k and y′ from 1 to k


16.     for channel c = {r, g, b, ∇I x , ∇I y }


17.      A(x+x′, y+y′, c) ← A(x+x′, y+y′, c) + f(x+x′, y+y′)*Q(x′, y′, c)


18.      W(x+x′, y+y′, c) ← W(x+x′, y+y′) + f(x+x′, y+y′)


19.     end for


20.     end for


21.   end for


22.   I ← SolveScreenedPoissonEquation(A./W, hole boundary conditions)


23.   end for


24.  end for









As noted at (12) in the above pseudocode, one or more generalized patch matching techniques may be employed that handle geometric transformations such as reflection, scale, and non-uniform scale, and that may also search according to photometric gain and bias. When measuring the distance between patches, at least some embodiments may also calculate the gradient of each source patch and then compare it with the gradient of the target image patch. In some implementations, to retrieve higher quality patches for synthesis, a bank of pre-filtered images may be created from the original image over multiple scale spaces, for example 10 to 15 scale spaces, and for each scaled patch the best pre-filtered image in which to conduct the search is chosen. In at least some embodiments, the generalized patch matching techniques used at (12) in the above pseudocode may leverage and extend the patch matching technology as described in Barnes, et al., 2009, and Barnes, et al., 2010, and in the section titled Determining Correspondence Between Image Regions.
Discrete screened Poisson technology is described in Bhat, P., Curless, B., Cohen, M., and Zitnick, L. (2008), Fourier analysis of the 2D screened Poisson equation for gradient domain problems, European Conference on Computer Vision (ECCV), and/or in Bhat, P., Zitnick, C. L., Cohen, M., and Curless, B. (2010), Gradientshop: A gradient-domain optimization framework for image and video filtering, Proceedings of the Association of Computing Machinery (ACM) Transactions on Graphics. 
At least some embodiments may add distances between gradients of source and target patches into the energy function being optimized, as shown in FIG. 17A. When solving this least square equation, an optimal solution for the energy function may be to do voting (e.g., averaging) both for colors and gradients, and then solve a screened Poisson equation based on values for colors and gradients, as shown in FIG. 17B. This adjusts the color of the image based on the given gradients, which is simply the average of the gradients from the voting phase. Note, however, that in other embodiments, other methods may be used.
FIGS. 27 and 28 are flowcharts of methods for implementing a content-aware synthesis method, for example as illustrated by Algorithm 1.
FIG. 27 illustrates a content-aware, patch-based image synthesis framework, according to at least some embodiments, and is not intended to be limiting. As indicated at 800, an input image and an indication of a region (e.g., a mask) to be synthesized may be obtained. As indicated at 802, initialization may be performed. In at least some embodiments, initialization may include initializing a target image for results of the synthesis. In at least some embodiments, initialization may include downsampling the input image and mask to a lowest scale. In at least some embodiments, initialization may include computing intensity gradients for the input image and adding them as additional channels (along with the color channels) in the input image. In at least some embodiments, initialization may include generating initial guesses for colors in a region to be synthesized in the input image.
For each scale at which processing is to be performed, the method then iteratively performs searching and voting, as described herein. As indicated at 804, a next scale is obtained. (In at least some embodiments, initially, this will be the lowest scale). In at least some embodiments, if the current scale is greater than the lowest scale, then the image may be upscaled to the current scale. As indicated at 806, a search is performed at the current scale. As indicated at 808, a voting technique is performed according to results of the search 806 to blend the patch(es) into the target image. The voting technique votes on both colors and gradients so that blending is performed in both the color and the gradient domains. An embodiment of a method for performing the search and voting at 806 and 808 is illustrated in FIG. 28. As indicated at 810, the method may solve a screened Poisson equation based on values for colors and gradients generated at elements 806 and 808 to adjust the colors of the image based on the given gradients. For an example screened Poisson equation, see equation 2 below. Discrete screened Poisson technology is further described in Bhat et al. (2008) and/or in Bhat et al. (2010). Output of element 810 is a current version of the target image generated according to the color and gradient components produced by the search and voting steps (elements 806 and 808). At 812, if there are more iterations to be performed at this scale, then the method returns to 806. Otherwise, at 814, if there are more scales to be processed, then the method returns to 804. At 814, if all scales have been processed, then a final image (the final version of the target image) is output at 816.
In at least some embodiments, to implement elements 806 and 808, a method is used that reconstructs a temporary image including color and gradient components according to the source image and the current target image by performing a search step followed by a voting step that votes on both colors and gradients. An example embodiment of a method that may be used is illustrated in FIG. 28.
In embodiments, the method of searching (element 806), voting (element 808) and solving the screened Poisson equation (element 810) combines the benefits of alpha blending and gradient domain methods. First, edges and structures are aligned before blending by a search across geometric variations, and warping the patches accordingly during voting. Second, wide photometric and appearance variations can be matched by the use of a gain and bias per channel as well as matching of gradients. Third, integration of colors and gradients using the screened Poisson equation allows local patch-based edits to propagate globally, leading to smooth and gradual transition of color from one source to another.
FIG. 28 illustrates a method for generating a reconstructed image, according to at least some embodiments. This method may, for example, be used in a content-aware synthesis method, for example to implement elements 806 and 808 of FIG. 27. The method may also be used in other applications, for example in blending two images or in morphing between two images. As indicated at 900, a source image and a target image may be obtained. As indicated at 902, a reconstructed image may be initialized. As indicated at 904, an image pyramid may be generated for the input image. In at least some embodiments, the pyramid is a full-resolution, scale space image pyramid.
For each pixel in the target image, the method then creates a target patch, finds a matched patch for the target patch in the image pyramid, and fills the corresponding region of the reconstructed image according to a blending of the matched patch and the target patch. As indicated at 906, a next pixel in the target image is obtained. As indicated at 908, a target patch is created at the pixel. As indicated at 910, a patch matching technique is then used to find a matched patch in the image pyramid. The patch matching technique may employ one or more geometric transformations and/or one or more photometric transformations as described herein to identify the matched patch according to geometric properties and/or photometric properties. In at least some embodiments, the patch matching technique may identify the matched patch according to gradient information instead of or in addition to the geometric and/or photometric criteria. In at least some embodiments, the patch matching technique may leverage and extend the patch matching technology as described in Barnes, et al. (2009) and Barnes, et al. (2010), and in the section titled Determining Correspondence Between Image Regions. 
As indicated at 912, the method may then calculate vertical and horizontal gradients for the matched patch. As indicated at 914, the patch region in the reconstructed image may then be filled according to a voting technique to blend the matched patch with the target patch of target image. In at least some embodiments, this voting may be performed according to each of the color channels (e.g., the R, G, and B channels in RGB color space, or the L, a, and b channels in L*a*b* color space) and the two gradient channels so that the patch is blended with the image according to both the color and gradient domains.
At 916, if there are more pixels to be processed, then the method returns to element 906. Otherwise, the method outputs the reconstructed image, as indicated at 918.
Embodiments of the algorithms, methods, and techniques as illustrated and described herein, for example in FIGS. 26 through 28 and in Algorithm 1, may be implemented, for example, as or in a module or modules, for example a module as illustrated in FIG. 30. FIG. 31 shows an example computer system on which embodiments may be implemented.
Generalized Patch-Based Synthesis Details
This section discusses aspects of the patch-based synthesis algorithms, methods, and techniques as illustrated and described in FIGS. 26 through 28 and in Algorithm 1 in more detail, using single source image synthesis as an example. Note that the techniques discussed in this section may be extended to apply to multi-source image synthesis, image morphing, multi-image blending, and other applications.
Single source image synthesis, or image completion, is a relatively simple application of the content-aware, patch-based image synthesis techniques described herein. FIGS. 29A through 29E illustrate image completion according to at least some embodiments, and compare results to conventional techniques. FIG. 29A shows three sample input images. FIG. 29B shows regions or “holes” to be replaced, indicated by the white regions. FIGS. 29C and 29D show results of conventional techniques for comparison with FIG. 29E. FIG. 29E shows results generated by an embodiment of the single source image synthesis technique described herein. FIG. 29E illustrates that embodiments can successfully fill large holes using a richer search space than used by conventional techniques. Embodiments can exploit rotational and reflection symmetry and complete edges and textures using examples from different orientations, scales and colors.
For the special case of image completion, input may include a user-defined mask dividing the image into source region S and target region T (the region of all patches overlapping the “hole” to be filled). See, e.g., FIG. 29B, where the white regions in the three images illustrate the target region T and everything outside the region T may be included in the source region S. The objective is to replace the contents of region T using contents from region S. The regions of the input image may be inconsistent due to spatially varying illumination or geometric transformations as can be seen in FIG. 29A. The task may be posed as a patch-based optimization problem with an energy function. In at least some embodiments, the following energy function may be used:




  
    
      
        
          
            E
            ⁡
            
              (
              
                T
                ,
                S
              
              )
            
          
          =
          
            
              ∑
              
                q
                ⋐
                T
              
            
            ⁢
            
              
                min
                
                  p
                  ⋐
                  S
                
              
              ⁢
              
                (
                
                  
                    D
                    ⁡
                    
                      (
                      
                        Q
                        ,
                        P
                      
                      )
                    
                  
                  +
                  
                    λ
                    ⁢
                    
                      
                    
                    ⁢
                    
                      D
                      ⁡
                      
                        (
                        
                          
                            ∇
                            Q
                          
                          ,
                          
                            ∇
                            P
                          
                        
                        )
                      
                    
                  
                
                )
              
            
          
        
        ,
      
    
    
      
        (
        1
        )
      
    
  




where

Q=N(q)

is a w×w patch with target pixel q at its upper left corner, and P=ƒ(N (p)) is a w×w patch that is a result of a geometric and photometric transformation ƒ applied on a small neighborhood N around source pixel p. Note that other formulations of an energy function may be used in some embodiments.

In at least some embodiments, all patches have five channels: three color channels and two gradient channels of the luminance at each pixel. In at least some embodiments, in L*a*b* color space may be used, although other color spaces (e.g., RGB) may be used in some embodiments. In the L*a*b* color space, the five channels may be denoted as (L, a, b, ∇xL, ∇yL). However, to simplify the notation, P (or Q) may be used to denote only the three color channels of the patch, and ∇P (or ∇Q) may be used to denote the two luminance gradient channels. The transformations f encompass translation, rotation, non-uniform scale and reflection, as well as gain and bias in each channel. In at least some embodiments, these transformations may be limited to predefined ranges that can vary depending on the task or on prior information (e.g., small expected geometric variations). D is the sum of squared distances (SSD) over all channels, and the gradient dimensions may be weighted by λ with regard to the color channels. This energy function defines the optimal fill in which every local neighborhood appears most similar to some local neighborhood within the source, under a restricted set of transformations.
This energy function searches over local geometric and appearance (photometric) transformations of the patches in the source, as opposed to only shifted patches as is done in conventional techniques. This extension is important, for example, in the case of multiple sources that contain larger variations in geometry and color. This energy function also includes patch gradients in the distance metric in addition to colors. This may improve robustness to large-scale illumination and structure variations. Note that adding gradients not only boosts the high frequencies of local descriptors, but also affects the step that updates the colors, as described below.
In at least some embodiments, an iterative algorithm may be used to optimize such an objective function by alternating in every scale between two steps—patch search and color voting, where each step is guaranteed to decrease the energy function. In the search step, similar (nearest neighbor) input patches are retrieved for all overlapping patches in the output. These patches are then blended together in the voting step by averaging the color “votes” that each such patch casts on every output pixel, resulting in a new output image. The iterations continue until the colors converge, and are repeated across scales in a coarse-to-fine fashion. Embodiments of the patch-based synthesis techniques may modify this iterative algorithm in the search and voting steps to guarantee that each reduces the energy function, for example as given in Equation 1, as described below.
In the search step, to find the closest patch P in the energy function (e.g., equation 1), embodiments may employ the generalized patch matching technique as described herein. The patch matching technique efficiently finds dense approximate nearest neighbor source patches for all target image patches, with a search space of three degrees of freedom: translations, rotations and scales. The search space may be further extended to handle reflections and non-uniform scale in the geometric domain, as well as gain and bias in the photometric domain, as these transformations occur often in natural images, as can be seen in FIG. 29A.
In at least some embodiments, to obtain invariance to illumination, exposure, and color changes, gain g and bias b adjustments may be applied in each channel of a source patch to best match the target patch (in the L2 sense). In at least some embodiments, these adjustments may be limited within some reasonable predefined ranges. In at least some embodiments, the adjustments may be computed as follows, where c is the color channel:

g(Pc)=min{max{σ(Qc)/σ(Pc),gmin},gmax},

b(Pc)=min{max{μ(Qc)−g(Pc)μ(Pc),bmin},bmax},

where cε(L,a,b), σ( ) and μ( ) are the standard deviation and mean of the input patch at each channel c, and [gmin, gmax] and [bmin, bmax] are the gain and bias ranges. The gain and bias are used to adjust the colors of the source patch:

Pc:Pc←g(Pc)Pc+b(Pc).

In the voting step, note that the energy function given as equation 1 is quadratic in all patch terms, where every target pixel participates in w×w terms—one for each overlapping patch. Therefore, an optimal target image satisfies:




  
    
      
        
          T
          =
          
            
              
                arg
                ⁢
                
                  
                
                ⁢
                min
              
              I
            
            ⁢
            
              {
              
                
                  D
                  ⁡
                  
                    (
                    
                      I
                      ,
                      
                        T
                        _
                      
                    
                    )
                  
                
                +
                
                  λ
                  ⁢
                  
                    
                  
                  ⁢
                  
                    D
                    ⁡
                    
                      (
                      
                        
                          ∇
                          I
                        
                        ,
                        
                          
                            ∇
                            T
                          
                          _
                        
                      
                      )
                    
                  
                
              
              }
            
          
        
        ,
      
    
    
      
        (
        2
        )
      
    
  




where T and ∇T are images with the same size as I and their values at pixel (i, j) correspond to:





  
    
      
        
          
            
              T
              _
            
            ⁡
            
              (
              
                i
                ,
                j
              
              )
            
          
          =
          
            
              ∑
              
                
                  k
                  =
                  
                    
                      0
                      ⁢
                      
                        
                      
                      ⁢
                      ...
                      ⁢
                      
                        
                      
                      ⁢
                      w
                    
                    -
                    1
                  
                
                
                  l
                  =
                  
                    
                      0
                      ⁢
                      
                        
                      
                      ⁢
                      ...
                      ⁢
                      
                        
                      
                      ⁢
                      w
                    
                    -
                    1
                  
                
              
            
            ⁢
            
              
                
                  NN
                  ⁡
                  
                    (
                    
                      Q
                      
                        
                          i
                          -
                          k
                        
                        ,
                        
                          j
                          -
                          l
                        
                      
                    
                    )
                  
                
                ⁢
                
                  (
                  
                    k
                    ,
                    l
                  
                  )
                
              
              
                w
                2
              
            
          
        
        ,
        
          

        
        ⁢
        
          
            
              
                ∇
                T
              
              _
            
            ⁡
            
              (
              
                i
                ,
                j
              
              )
            
          
          =
          
            
              ∑
              
                
                  k
                  =
                  
                    
                      0
                      ⁢
                      
                        
                      
                      ⁢
                      ...
                      ⁢
                      
                        
                      
                      ⁢
                      w
                    
                    -
                    1
                  
                
                
                  l
                  =
                  
                    
                      0
                      ⁢
                      
                        
                      
                      ⁢
                      ...
                      ⁢
                      
                        
                      
                      ⁢
                      w
                    
                    -
                    1
                  
                
              
            
            ⁢
            
              
                
                  
                    ∇
                    
                      NN
                      ⁡
                      
                        (
                        
                          Q
                          
                            
                              i
                              -
                              k
                            
                            ,
                            
                              j
                              -
                              l
                            
                          
                        
                        )
                      
                    
                  
                  ⁢
                  
                    (
                    
                      k
                      ,
                      l
                    
                    )
                  
                
                
                  w
                  2
                
              
              .
            
          
        
      
    
    
      
        (
        3
        )
      
    
  




NN(Qi,j) is the nearest neighbor patch in source S (referred to as a source patch) to the target patch Qi,j (assuming that the top left of the patch is its coordinate), and NN(Qi,j)(k, l) selects the pixel (k, l) within that source patch (after transformation). That is, T collects the average colors of the overlapping transformed source patches. The gradient channel ∇T is assigned in the same manner. In at least some embodiments, equation 2 may be used as the discrete screened Poisson equation applied to the color and gradient channels computed using the voting technique. (See, e.g., element 810 of FIG. 27).
In at least some embodiments, the search and voting steps may be iterated until convergence. In at least some embodiments, the iterations may be stopped after 10-30 iterations. It at least some embodiments, more iterations may be performed at coarse scales and fewer at finer scales. In at least some embodiments, the process is repeated at multiple scales in a coarse-to-fine manner, using a Gaussian pyramid and initializing with colors interpolated from the hole boundaries with inverse distance weighting.
Generalized Patch-Based Synthesis Examples
FIGS. 6A through 25D graphically illustrate various aspects of the patch matching techniques, the patch-based synthesis techniques, and content-aware synthesis methods such as a content-aware fill method, according to at least some embodiments. In addition, some of these Figures compare results of conventional techniques to results of the patch-based synthesis techniques as described herein.
FIGS. 6A-6B, 7A-7B, 8A-8B, 9A-9B, and 10A-10B illustrate some example failure cases for conventional patch-based fill methods. In each of these cases, the image on the left (FIGS. 6A, 7A, 8A, 9A, and 10A) shows an input image and indicates a region to be filled (e.g., the region inside the white rectangle in FIG. 6A). The image on the right (FIGS. 6B, 7B, 8B, 9B, and 10B) shows results (e.g., the region inside the white dashed rectangle in FIG. 6B) of a conventional fill method that only employs translation and that does not implement the geometric transformations, photometric transformations, and gradient features as implemented in embodiments of the content-aware synthesis methods described herein.
FIGS. 6A and 6B illustrate a case that shows edge misalignment in the filled region in FIG. 6B. This edge misalignment may result from the perspective; the conventional fill method used in this example fails in connecting the lines across the fill region. FIGS. 7A and 7B illustrate that completing the orange shown in FIG. 7A using the conventional fill method fails to produce satisfactory results by translating the patches, even with constraints. FIGS. 8A and 8B illustrate that completing a human face as shown in FIG. 8A using the conventional fill method fails to produce satisfactory results. FIGS. 9A and 9B illustrate that completing the right eye of the human face as shown in FIG. 9A using the conventional fill method fails to produce satisfactory results.
In FIG. 10A, the missing region is in a boundary of darker and brighter regions. The conventional fill method tries to synthesize the missing region by putting a step-like change in the middle, as shown in FIG. 10B. The conventional fill method does not consider gradient or edge features in its attempt to synthesize the missing region. While in some cases this might produce acceptable (if not correct) results, in other cases the results may be unacceptable.
FIGS. 11A through 16 illustrate geometric transformations included in the patch-based synthesis techniques, according to at least some embodiments.
FIGS. 11A through 11E compare conventional fill methods that incorporate only translation (FIG. 11A) to embodiments that incorporate geometric transformations such as rotation and scale (FIG. 11B) to generate transformed source patches. As illustrated in FIG. 11B, embodiments may apply rotation and/or scale geometric transformations on the source patches both for search and synthesis, to generate transformed source patches. FIGS. 11C through 11E illustrate aligning edges, according to at least some embodiments. FIG. 11C illustrates two edges that need to be aligned. The misaligned edges are hard to handle in conventional fill methods that perform only translation. Generally, by only applying translation to lines to fill the hole, the intersection will tend to be blurry and/or jaggy (FIG. 11D; also see, e.g., FIG. 6B). As shown in FIG. 11E, by applying rotation to the patches, the lines can be more easily and cleanly connected (also see, e.g., FIG. 14). By rotating and scaling the source patches, the number of source patches that can be used in synthesis is increased, and therefore repetition, an undesirable artifact in many cases where fewer patches are available, may be reduced. In addition, applying rotation and scale geometric transformations to source patches during synthesis may make it harder for the user to perceive repetition when compared to patches that are only translated.
FIG. 12 illustrates that embodiments may also apply reflection and non-uniform scale geometric transformations to generate transformed source patches. A non-uniform scale transformation scales the source patch by different factors in one direction than in another, or scales the source patch in one direction but not another, for example. Reflection may, for example, enable embodiments to improve the quality of synthesis when there is a symmetrical relationship between the source image or region and the target image or region. An example of a symmetrical relationship are the eyes on a face, for example as shown in FIGS. 9A and 9B. As can be seen in FIG. 9B, conventional fill methods that do not address reflection produce very poor results. By applying reflection when searching for source patches and using the transformed source patches in synthesis, results of synthesizing the missing portion of the right eye in FIG. 9A may be improved over the results of conventional fill methods that do not employ reflection, as can be seen by comparing FIG. 18B to FIG. 9B.
FIG. 13 illustrates methods for retrieving high quality transformed source patches, according to at least some embodiments. Applying the geometric transformations to the source patches during synthesis may result in the need to apply interpolation for subpixel coordinates. Since at least some embodiments solve L2 minimization, it is possible to get stuck at a potentially blurry local minimum. Therefore, to generate higher quality transformed source patches, at least some embodiments may employ a high-resolution scale space pyramid (generated for each source image) and a high-order filtering technique, for example Lancsoz3 filtering, for interpolation.
FIGS. 14, 15, and 16 show results generated using embodiments that employ the geometric transformations as described above when synthesizing the missing regions shown in FIGS. 6A, 7A, and 8A, respectively. These results can be compared to the results of a conventional fill technique that employs only translation, as shown in FIGS. 6B, 7B, and 8B, respectively.
FIG. 14 shows results generated using embodiments that employ the geometric transformations when synthesizing the missing region shown in FIG. 6A. FIG. 14 can be compared to FIG. 6B, which shows edge misalignment due to perspective and the conventional fill technique's difficulty in connecting lines across the fill region. As can be seen in FIG. 14, the results of embodiments that employ the geometric transformations are improved over the results in FIG. 6B. By applying rotation and scale geometric transformations to source patches, embodiments can warp the image to connect the lines. At least some embodiments may include line constraints to further improve the quality.
FIG. 15 shows results generated using embodiments that employ the geometric transformations when synthesizing the missing region shown in FIG. 7A. FIG. 15 can be compared to FIG. 7B. As can be seen in FIG. 15, the missing region of the orange can be synthesized without user interaction.
FIG. 16 shows results generated using embodiments that employ the geometric transformations when synthesizing the missing region of the human figure shown in FIG. 8A. FIG. 16 can be compared to FIG. 8B. As can be seen in FIG. 16, by employing reflection and thus taking advantage of symmetry present in many objects such as human faces or figures, an object that exhibits symmetry can be more accurately completed using embodiments.
As noted above, FIGS. 11A through 16 illustrate geometric transformations. In addition to applying the geometric transformations to patches, at least some embodiments may also use photometric properties of patches, for example gain and bias properties, in both searching for patches and patch adjustment during synthesis. At least some embodiments may search for patches according to photometric properties (e.g., gain and bias) in all color channels. The following is an example formulation for applying gain (g) and bias (b) in patch adjustment. D is a patch distance function. T is the target, and S is the source:



  
    
      {
      
        
          g
          ^
        
        ,
        
          b
          ^
        
      
      }
    
    =
    
      
        
          arg
          ⁢
          
            
          
          ⁢
          min
        
        
          g
          ,
          b
        
      
      ⁢
      
        D
        ⁡
        
          (
          
            T
            ,
            
              g
              ×
              
                (
                
                  S
                  +
                  b
                
                )
              
            
          
          )
        
      
    
  




  
    
      s
      .
      t
      .
      
        

      
      ⁢
      
        g
        min
      
    
    <
    g
    <
    
      g
      max
    
  




  
    
      b
      min
    
    <
    b
    <
    
      b
      max
    
  




  
    
      S
      new
    
    =
    
      
        g
        ^
      
      ×
      
        (
        
          S
          +
          
            b
            ^
          
        
        )
      
    
  



FIGS. 17A and 17B illustrate applying gradients in the patch-based synthesis process, according to at least some embodiments. At least some embodiments may incorporate distance d between gradients of source (Q) and target (P) patches:

d=ΣP⊂TminQ⊂S(∥P−ƒ(Q)∥)

into the optimization energy, as shown in FIG. 17A. The color and gradient vote may be formulated as:





  T
  =
  
    
      1
      N
    
    ⁢
    
      
        ∑
        
          j
          =
          1
        
        N
      
      ⁢
      
        f
        ⁡
        
          (
          Q
          )
        
      
    
  




In at least some embodiments, as shown in FIG. 17B, when solving this least square equation, an optimal solution for the energy function that may be used is to do voting both for colors and gradients and then solve the Poisson equation with the voted values and color constraints in the boundary. Distance d becomes:

d=ΣP⊂TminQ⊂S(∥P−ƒ(Q)∥+λ∥∇P−∇ƒ(Q)∥)

s.t. 

T(q⊂Ω)=S(p⊂Ω)

The color and gradient vote may be formulated as:




  
    T
    =
    
      
        1
        N
      
      ⁢
      
        
          ∑
          
            j
            =
            1
          
          N
        
        ⁢
        
          f
          ⁡
          
            (
            Q
            )
          
        
      
    
  




  
    
      ∇
      T
    
    =
    
      
        
          ∑
          
            j
            =
            1
          
          N
        
        ⁢
        
          ∇
          
            
          
          ⁢
          
            f
            ⁡
            
              (
              Q
              )
            
          
        
      
      N
    
  



FIGS. 18A and 18B show results generated using embodiments that employ the geometric transformations (in this case, specifically reflection) and photometric transformations when synthesizing the missing region of the right eye as shown in FIG. 18A (FIG. 18A is the same as FIG. 9A). FIG. 18B can be compared to FIG. 9B. As can be seen in FIG. 18B, embodiments may take advantage of symmetry between the eyes to fill the right eye from the left eye, and photometric transformations may also be used to also adjust the color and other visual aspects to produce a more natural look.
FIG. 19A through 19D show an example of using one source image to fill a region in a second image, according to at least some embodiments. The region shown by the white box in FIG. 19B is to be filled from the image shown in FIG. 19A. This is a relatively complex example as the lighting and view angles of the two images shown in FIGS. 19A and 19B are different. FIGS. 19C and 19D show results from a conventional patch-based fill method and results from an embodiment that employs geometric transformations and photometric transformations, respectively, with the filled region indicated by the white dashed box. As can be seen by comparing FIGS. 19C and 19D, embodiments may more successfully recover missing regions in more complex cases such as this example than can conventional methods.
FIGS. 20A through 20C show an example that illustrates using gradients, according to at least some embodiments. FIG. 20A shows an image of the sky, with a region to be filled indicated by the white box. FIG. 20B shows results generated by a patch-based fill method that does not incorporate gradients. FIG. 20C shows results generated by an embodiment that incorporates gradients. By including gradients, the missing portion of the sky can be more successfully synthesized by interpolating gradients of neighbor patches.
FIGS. 21A through 21D show another example that illustrates using gradients, according to at least some embodiments. In FIG. 21A, the missing region is in a boundary of darker and brighter regions. The conventional fill method tries to synthesize the missing region by putting a step-like change in the middle, as shown in FIG. 21B. Embodiments of the patch-based synthesis method without gradients produce better results, as shown in FIG. 21C. However, adding gradients causes the method to follow the gradients of the rest of the image, producing the image shown in FIG. 21D.
FIGS. 22A through 25D illustrate several example applications of the patch-based synthesis methods described herein. These applications may include, but are not limited to, multi-image hole filling, object cloning, and image stitching (e.g., panorama creation).
In multi-image hole filling, embodiments may be applied to, for example, fill a hole in an image when an object, for example a person, needs to be removed from the image using one or more other images as a source for the background to be filled in. The colors, angles and scales may be different in the images, which would make it difficult if not impossible for conventional hole-filling methods to successfully fill the region. Using embodiments, the rotation, scale, and color misalignments may be fixed to more successfully recover and fill with the background content from the source image(s) to synthesize content for the hole in the target image.
FIGS. 22A through 22F show an example of multi-image hole filling, according to at least some embodiments. When there is an occlusion in front of a scene as in this case, the user can move around and capture different views and thus parts of the scene at each of multiple shots. FIGS. 22A through 22C show three source images of a scene taken from different angles. Note that the window frame partially occludes all three images. FIG. 22D shows the target image (similar to the image in FIG. 22C), with the region to be filled indicated by the gray rectangle. FIG. 22E shows results generated using a conventional patch-based fill technique that does not incorporate rotation, scale, and color alignment. FIG. 22F shows results generated using an embodiment of the patch-based synthesis method that may obtain patches from the images (e.g. from FIGS. 22A and 22B) using geometric and photometric transformations when searching for patches, and that may correct for rotation, scale, and color misalignments. Note that repetition, visible for example in the treetops of FIG. 22E, is much less noticeable in FIG. 22F.
FIGS. 23A through 23G show an example of multi-image hole filling, according to at least some embodiments. FIGS. 23A and 23B illustrate two source images of a scene. However, the user may wish to remove the person's head from FIG. 23B and fill the region with content from FIG. 23A. FIG. 23C shows a zoom-in to FIG. 23B that shows a masked region to be filled in. FIG. 23D shows results of a conventional patch-based fill method that does not employ the geometric and photometric transformations as described herein. FIG. 23E shows results of a conventional homography, warp plus blend technique for combining the images. FIG. 23F shows results generated using an embodiment of the patch-based synthesis method that may obtain patches from image 23A using geometric and photometric transformations when searching for patches, and that may correct for rotation, scale, and color misalignments. FIG. 23G shows a zoom-in to the region in FIG. 23A that is occluded in FIG. 23B for comparison to the results of these methods. Note that the image in FIG. 23F is much more true to the original than the image in FIG. 23D, and does not show misalignment artifacts such as edges and color changes as does the image in FIG. 23E.
FIG. 24A through 24C show an example of cloning, according to at least some embodiments. FIG. 24A shows an original image; the background shows a desert environment; the lizard and region around the image has been copied in from another image. The object is to add the lizard to the background desert, but due to texture differences the boundaries can be clearly seen. FIG. 24B shows a mask around the lizard. The masked region was re-synthesized based on the two source images using an embodiment of the patch-based synthesis methods described herein to achieve the output image shown in FIG. 24C. As can be seen, the method provides a more seamless cut, provides some smooth light adjustment as can be seen on the sand regions, and performs some feathering and warping. At some regions, where possible, the method generates a smooth transition from stone to sand.
FIGS. 25A through 25D show an example of image stitching, according to at least some embodiments. FIGS. 25A and 25B show two images of a scene take from different angles and with different lighting. The object is to combine the two images. Conventional methods for combining the two images would generally result in quite visible edges and seams. FIG. 25C shows a mask on FIG. 25A that indicates a region to be filled from FIG. 25B. FIG. 25D shows a resulting output image that provides a seamless transition between the regions of the image.
Additional applications of the patch-based synthesis methods to those described above may include, but are not limited to, morphing, summarizing videos, and face fusion.
At least some embodiments may apply constraints on one or more of the geometric transformations, photometric transformations, and/or gradients. At least some embodiments may include additional geometric operations than the ones described herein, for example an affine transform. At least some embodiments may include additional photometric operations than the ones described herein, for example a Laplacian operation.
Embodiments have been described herein primarily in the context of performing fill or other synthesis operations on similar images. However, it is to be noted that embodiments may be applied to perform synthesis operations using two or more dissimilar or completely different images.
Example Implementations
Embodiments of the techniques described herein, including the patch matching techniques, patch-based synthesis techniques, and content-aware synthesis methods may be used in any image editing or image processing application. Examples of applications in which embodiments may be used include, but are not limited to, Adobe® Photoshop®. “Adobe” and “Photoshop” are either registered trademarks or trademarks of Adobe Systems Incorporated in the United States and/or other countries. An example module that may implement the patch matching techniques, patch-based synthesis techniques, and content-aware synthesis methods is illustrated in FIG. 30. An example system on which such a module may be implemented is illustrated in FIG. 31.
Some embodiments may include a means for image editing using the techniques, including the patch matching techniques, patch-based synthesis techniques, and content-aware synthesis methods as described herein. For example, a module may be provided that may implement an embodiment of a content-aware synthesis method, for example as described in Algorithm 1 and/or as described in reference to FIGS. 26, 27, and 28. The module may, for example, receive one or more images and an indication of a region in one of the images to be filled as input, and apply a content-aware synthesis method as described herein to fill the region from one or more of the input images. The module may in some embodiments be implemented by a non-transitory, computer-readable storage medium and one or more processors (e.g., CPUs and/or GPUs) of a computing apparatus. The computer-readable storage medium may store program instructions executable by the one or more processors to cause the computing apparatus to perform a content-aware synthesis method as described herein, for example as described in Algorithm 1 and/or as described in reference to FIGS. 26, 27, and 28. Other embodiments of the module may be at least partially implemented by hardware circuitry and/or firmware stored, for example, in a non-volatile memory.
FIG. 30 illustrates an example module that may implement embodiments of the image processing techniques as described herein, including the patch matching techniques, patch-based synthesis techniques, and a content-aware synthesis method such as a hole-filling method that leverages the patch matching and patch-based synthesis techniques. Module 1920 receives as input one or more images 1910 and, in some implementations, an indication of a region 1912 to be filled in one of the images (a target image). The module 1920 may, for example, implement a content-aware synthesis method 1922 that iteratively performs a search 1924 using a patch matching technique as described herein to search for patches to be used in filling an indicated region 1912 in a target image, and a voting 1926 technique that implements gradient-domain blending to fill the region in the target image using the located patches. As noted above, geometric transformations, photometric transformations, and gradients may be applied at both the search stage and the voting (blending) stage. The module 1920 may generate as output an output image 1930 with the indicated region 1912 filled using patches from the one or more images that may have been adjusted according to geometric and/or photometric features, for example to account for rotation, scale, color, texture, and/or lighting differences, when blending with the target image. Output image 1930 may, for example, be stored to a storage medium 1940, such as system memory, a disk drive, DVD, CD, etc., displayed on a display 1960, and/or passed to one or more other modules 1950 for further image processing. FIG. 31 illustrates an example computer system on which embodiments of module 1920 may be implemented. Note that a module 1920 may be implemented that leverages the patch matching and patch-based synthesis techniques as described herein to perform other content-aware synthesis tasks such as cloning, morphing, and image stitching.
Example System
Embodiments of the various image processing techniques as described herein, including the patch matching techniques, patch-based synthesis techniques, and content-aware synthesis methods, may be executed on one or more computer systems, which may interact with various other devices. One such computer system is illustrated by FIG. 31. In different embodiments, computer system 2000 may be any of various types of devices, including, but not limited to, a personal computer system, desktop computer, laptop, notebook, or netbook computer, mainframe computer system, handheld computer, workstation, network computer, a camera, a set top box, a mobile device, a consumer device, video game console, handheld video game device, application server, storage device, a peripheral device such as a switch, modem, router, or in general any type of computing or electronic device.
In the illustrated embodiment, computer system 2000 includes one or more processors 2010 coupled to a system memory 2020 via an input/output (I/O) interface 2030. Computer system 2000 further includes a network interface 2040 coupled to I/O interface 2030, and one or more input/output devices 2050, such as cursor control device 2060, keyboard 2070, and display(s) 2080. In some embodiments, it is contemplated that embodiments may be implemented using a single instance of computer system 2000, while in other embodiments multiple such systems, or multiple nodes making up computer system 2000, may be configured to host different portions or instances of embodiments. For example, in one embodiment some elements may be implemented via one or more nodes of computer system 2000 that are distinct from those nodes implementing other elements.
In various embodiments, computer system 2000 may be a uniprocessor system including one processor 2010, or a multiprocessor system including several processors 2010 (e.g., two, four, eight, or another suitable number). Processors 2010 may be any suitable processor capable of executing instructions. For example, in various embodiments, processors 2010 may be general-purpose or embedded processors implementing any of a variety of instruction set architectures (ISAs), such as the x86, PowerPC, SPARC, or MIPS ISAs, or any other suitable ISA. In multiprocessor systems, each of processors 2010 may commonly, but not necessarily, implement the same ISA.
In some embodiments, at least one processor 2010 may be a graphics processing unit. A graphics processing unit or GPU may be considered a dedicated graphics-rendering device for a personal computer, workstation, game console or other computing or electronic device. Modern GPUs may be very efficient at manipulating and displaying computer graphics, and their highly parallel structure may make them more effective than typical CPUs for a range of complex graphical algorithms. For example, a graphics processor may implement a number of graphics primitive operations in a way that makes executing them much faster than drawing directly to the screen with a host central processing unit (CPU). In various embodiments, the image processing methods disclosed herein may, at least in part, be implemented by program instructions configured for execution on one of, or parallel execution on two or more of, such GPUs. The GPU(s) may implement one or more application programmer interfaces (APIs) that permit programmers to invoke the functionality of the GPU(s). Suitable GPUs may be commercially available from vendors such as NVIDIA Corporation, ATI Technologies (AMD), and others.
System memory 2020 may be configured to store program instructions and/or data accessible by processor(s) 2010. In various embodiments, system memory 2020 may be implemented using any suitable memory technology, such as static random access memory (SRAM), synchronous dynamic RAM (SDRAM), nonvolatile/Flash-type memory, or any other type of memory. In the illustrated embodiment, program instructions and data implementing desired functions, such as those described above for embodiments of the various image processing techniques as described herein are shown stored within system memory 2020 as program instructions 2025 and data storage 2035, respectively. In other embodiments, program instructions and/or data may be received, sent or stored upon different types of computer-accessible media or on similar media separate from system memory 2020 or computer system 2000. Generally speaking, a computer-accessible medium may include storage media or memory media such as magnetic or optical media, e.g., disk or CD/DVD-ROM coupled to computer system 2000 via I/O interface 2030. Program instructions and data stored via a computer-accessible medium may be transmitted by transmission media or signals such as electrical, electromagnetic, or digital signals, which may be conveyed via a communication medium such as a network and/or a wireless link, such as may be implemented via network interface 2040.
In one embodiment, I/O interface 2030 may be configured to coordinate I/O traffic between processor(s) 2010, system memory 2020, and any peripheral devices in the device, including network interface 2040 or other peripheral interfaces, such as input/output devices 2050. In some embodiments, I/O interface 2030 may perform any necessary protocol, timing or other data transformations to convert data signals from one component (e.g., system memory 2020) into a format suitable for use by another component (e.g., processor(s) 2010). In some embodiments, I/O interface 2030 may include support for devices attached through various types of peripheral buses, such as a variant of the Peripheral Component Interconnect (PCI) bus standard or the Universal Serial Bus (USB) standard, for example. In some embodiments, the function of I/O interface 2030 may be split into two or more separate components, such as a north bridge and a south bridge, for example. In addition, in some embodiments some or all of the functionality of I/O interface 2030, such as an interface to system memory 2020, may be incorporated directly into processor(s) 2010.
Network interface 2040 may be configured to allow data to be exchanged between computer system 2000 and other devices attached to a network, such as other computer systems, or between nodes of computer system 2000. In various embodiments, network interface 2040 may support communication via wired or wireless general data networks, such as any suitable type of Ethernet network, for example; via telecommunications/telephony networks such as analog voice networks or digital fiber communications networks; via storage area networks such as Fibre Channel SANs, or via any other suitable type of network and/or protocol.
Input/output devices 2050 may, in some embodiments, include one or more display terminals, keyboards, keypads, touchpads, scanning devices, voice or optical recognition devices, or any other devices suitable for entering or retrieving data by one or more computer system 2000. Multiple input/output devices 2050 may be present in computer system 2000 or may be distributed on various nodes of computer system 2000. In some embodiments, similar input/output devices may be separate from computer system 2000 and may interact with one or more nodes of computer system 2000 through a wired or wireless connection, such as over network interface 2040.
As shown in FIG. 31, memory 2020 may include program instructions 2025, configured to implement embodiments of the various image processing techniques as described herein, and data storage 2035, comprising various data accessible by program instructions 2025. In one embodiment, program instructions 2025 may include software elements of embodiments of the various image processing techniques as described herein and as illustrated in the Figures. Data storage 2035 may include data that may be used in embodiments. In other embodiments, other or different software elements and data may be included.
Those skilled in the art will appreciate that computer system 2000 is merely illustrative and is not intended to limit the scope of the various image processing techniques as described herein. In particular, the computer system and devices may include any combination of hardware or software that can perform the indicated functions, including a computer, personal computer system, desktop computer, laptop, notebook, or netbook computer, mainframe computer system, handheld computer, workstation, network computer, a camera, a set top box, a mobile device, network device, internet appliance, PDA, wireless phones, pagers, a consumer device, video game console, handheld video game device, application server, storage device, a peripheral device such as a switch, modem, router, or in general any type of computing or electronic device. Computer system 2000 may also be connected to other devices that are not illustrated, or instead may operate as a stand-alone system. In addition, the functionality provided by the illustrated components may in some embodiments be combined in fewer components or distributed in additional components. Similarly, in some embodiments, the functionality of some of the illustrated components may not be provided and/or other additional functionality may be available.
Those skilled in the art will also appreciate that, while various items are illustrated as being stored in memory or on storage while being used, these items or portions of them may be transferred between memory and other storage devices for purposes of memory management and data integrity. Alternatively, in other embodiments some or all of the software components may execute in memory on another device and communicate with the illustrated computer system via inter-computer communication. Some or all of the system components or data structures may also be stored (e.g., as instructions or structured data) on a computer-accessible medium or a portable article to be read by an appropriate drive, various examples of which are described above. In some embodiments, instructions stored on a computer-accessible medium separate from computer system 2000 may be transmitted to computer system 2000 via transmission media or signals such as electrical, electromagnetic, or digital signals, conveyed via a communication medium such as a network and/or a wireless link. Various embodiments may further include receiving, sending or storing instructions and/or data implemented in accordance with the foregoing description upon a computer-accessible medium. Accordingly, the present invention may be practiced with other computer system configurations.
Conclusion
Various embodiments may further include receiving, sending or storing instructions and/or data implemented in accordance with the foregoing description upon a computer-accessible medium. Generally speaking, a computer-accessible medium may include storage media or memory media such as magnetic or optical media, e.g., disk or DVD/CD-ROM, volatile or non-volatile media such as RAM (e.g. SDRAM, DDR, RDRAM, SRAM, etc.), ROM, etc., as well as transmission media or signals such as electrical, electromagnetic, or digital signals, conveyed via a communication medium such as network and/or a wireless link.
The various methods as illustrated in the Figures and described herein represent example embodiments of methods. The methods may be implemented in software, hardware, or a combination thereof. The order of method may be changed, and various elements may be added, reordered, combined, omitted, modified, etc.
Various modifications and changes may be made as would be obvious to a person skilled in the art having the benefit of this disclosure. It is intended that the invention embrace all such modifications and changes and, accordingly, the above description to be regarded in an illustrative rather than a restrictive sense.

## Claims

1. A method, comprising:
synthesizing, by one or more computing devices, a region in a target image from image data obtained from one or more source images, said synthesizing comprises:
identifying transformed source patches in the one or more source images that best match target patches in the target image, said identifying comprises:
for each target patch, applying one or more transformations from a set of supported transformations to each of a plurality of candidate source patches in the one or more source images, the set of supported transformations including one or more geometric or photometric transformations; and
comparing each transformed source patch to the respective target patch to identify a transformed source patch that best matches the respective target patch; and

blending image data, using color gradient domain blending techniques, according to each identified geometrically or photometrically transformed source patch from the one or more source images into the target image.

2. The method as recited in claim 1, wherein the one or more geometric transformations include one or more of a reflection transformation or a non-uniform scale transformation.

3. The method as recited in claim 2, wherein the one or more geometric transformations further include one or more of a uniform scale transformation, a translation transformation, or a rotation transformation.

4. The method as recited in claim 1, wherein the one or more photometric transformations include one or more of a gain transformation to adjust for brightness differences between the one or more source images and the target image or a bias transformation to adjust for contrast differences between the one or more source images and the target image.

5. The method as recited m claim 1, wherein the set of supported transformations includes one or more geometric transformations and one or more photometric transformations.

6. The method as recited in claim 1, further comprising iteratively performing said identifying and said blending.

7. The method as recited in claim 1, further comprising iteratively performing said identifying and said blending at each of a plurality of scales from a coarsest scale to a finest scale.

8. The method as recited in claim 1, wherein said identifying further comprises comparing gradient values determined at each transformed source patch to gradient values at the respective target patch in the target image.

9. The method as recited in claim 1, wherein said color gradient domain blending techniques comprises a voting technique that averages color and gradient values from the identified transformed source patches, the method further comprising applying a screened Poisson technique to the averaged color and gradient values to integrate the averaged color and gradient values into the target image.

10. The method as recited in claim 1, wherein the one or more source images include the target image, and wherein the plurality of candidate source patches include patches in the target image that are located outside the region being synthesized.

11. The method as recited in claim 1, wherein there are two or more source images, wherein the plurality of candidate source patches includes patches in each of the two or more source images, and wherein at least one transformed source patch is identified in each of at least two of the two or more source images.

12. A system, comprising:
at least one processor; and
a memory comprising program instructions, the program instructions executable by the at least one processor to synthesize a region in a target image from image data obtained from one or more source images, to synthesize the region, the program instructions executable by the at least one processor to implement operations comprising:
identifying transformed source patches in the one or more source images that best match target patches in the target image, to identify a source patch that best matches a particular target patch, the program instructions executable by the at least one processor to implement operations comprising:
applying one or more transformations from a set of supported transformations to each of a plurality of candidate source patches in the one or more source images, the set of supported transformations including one or more geometric or photometric transformations; and
comparing each transformed source patch to the particular target patch to identify a transformed source patch that best matches the respective target patch; and

blending image data, using color gradient domain blending techniques, according to each identified geometrically or photometrically transformed source patch from the one or more source images into the target image.

13. The system as recited in claim 12, wherein the one or more geometric transformations include one or more of a reflection transformation or a non-uniform scale transformation.

14. The system as recited in claim 12, wherein the one or more photometric transformations include one or more of a gain transformation to adjust for brightness differences between the one or more source images and the target image or a bias transformation to adjust for contrast differences between the one or more source images and the target image.

15. The system as recited in claim 12, wherein the program instructions are executable by the at least one processor to iteratively perform said identifying and said blending at each of a plurality of scales from a coarsest scale to a finest scale.

16. The system as recited in claim 12, wherein, to identify the source patches, the program instructions are further executable by the at least one processor to compare gradient values determined at each transformed source patch to gradient values at the respective target patch in the target image.

17. The system as recited in claim 12, wherein, the color gradient domain blending techniques comprise a voting technique that averages color and gradient values from the identified transformed source patches, and wherein the program instructions are further executable by the at least one processor to apply a screened Poisson technique to the averaged color and gradient values to integrate the color and gradient values into the target image.

18. The system as recited in claim 12, wherein there are two or more source images, wherein the plurality of candidate source patches includes patches in each of the two or more source images, and wherein at least one transformed source patch is identified in each of at least two of the two or more source images.

19. A non-transitory computer-readable storage medium storing program instructions, the program instructions computer-executable to implement operations comprising:
synthesizing a region in a target image from image data obtained from one or more source images, in said synthesizing, the program instructions computer-executable to implement operations comprising:
identifying transformed source patches in the one or more source images that best match target patches in the target image, in said identifying, the program instructions computer-executable to implement operations comprising:
for each target patch, applying one or more transformations from a set of supported transformations to each of a plurality of candidate source patches in the one or more source images, the set of supported transformations including one or more geometric or photometric transformations; and
comparing each transformed source patch to the respective target patch to identify a transformed source patch that best matches the respective target patch; and

blending image data, using color gradient domain blending techniques, according to each identified geometrically or photometrically transformed source patch from the one or more source images into the target image.

20. The non-transitory computer-readable storage medium as recited in claim 19, wherein the one or more geometric transformations include one or more of a reflection transformation or a non-uniform scale transformation.

21. The non-transitory computer-readable storage medium as recited in claim 19, wherein the one or more photometric transformations include one or more of a gain transformation to adjust for brightness differences between the one or more source images and the target image or a bias transformation to adjust for contrast differences between the one or more source images and the target image.

22. The non-transitory computer-readable storage medium as recited in claim 19, wherein the program instructions are computer-executable to implement iteratively performing said identifying and said blending at each of a plurality of scales from a coarsest scale to a finest scale.

23. The non-transitory computer-readable storage medium as recited in claim 19, wherein, in said identifying, the program instructions are further computer-executable to implement comparing gradient values determined at each transformed source patch to gradient values at the respective target patch in the target image.

24. The non-transitory computer-readable storage medium as recited in claim 19, wherein the color gradient domain blending techniques comprise a voting technique that averages color and gradient values from the identified transformed source patches, and wherein the program instructions are further computer-executable to implement applying a screened Poisson technique to the averaged color and gradient values to integrate the color and gradient values into the target image.

25. The non-transitory computer-readable storage medium as recited in claim 19, wherein there are two or more source images, wherein the plurality of candidate source patches includes patches in each of the two or more source images, and wherein at least one transformed source patch is identified in each of at least two of the two or more source images.