In image composition, a new image can be blended from a background image and a foreground image through use of an alpha matte of the image. On the other hand, separation of the alpha matte, the foreground and the background from a given image is a more difficult process, often referred to as the pulling of matte problem, or simply matting.
For example, in blue screen matting, the alpha matte and foreground can be readily reconstructed because the background is known (e.g., from a user-controlled environment). In contrast, for natural image matting, the alpha matte, the foreground and the background need to be estimated. Further, natural image matting is inherently under-constrained due to the number of unknowns of the matting equation. Thus, a need exists for improved natural image matting techniques. Various exemplary techniques described herein aim to address this and other issues associated with matting.
Natural image matting is an important tool for digital image editing such as for cutting and pasting selected objects from one image to another image and replacing the background of the selected objects. Various exemplary techniques presented herein reconstruct a matte from a continuous matte gradient field by solving Poisson equations using boundary information, for example, from a given trimap. Refinement may occur by interactively manipulating the matte gradient field using a number of filtering tools. A local result can be seamlessly integrated into the global result.
Non-limiting and non-exhaustive examples are described with reference to the following figures, wherein like reference numerals generally refer to like parts throughout the various views unless otherwise specified.
As described herein, Poisson matting is applied to natural images, including those with complex scenes. Traditional techniques typically optimize a pixel's alpha, background and foreground colors in a statistical manner, in contrast, Poisson matting can operate directly on the gradient of a matte, which can reduce error caused by mis-classification of color samples. An exemplary method uses Poisson matting to estimate a gradient matte from an image and then reconstruct the matte by solving a set of Poisson equations. Various other exemplary techniques are also discussed.
An exemplary method for natural image matting includes solving Poisson equations with a matte gradient field. Such a method is, at times, referred to herein as Poisson matting. Such a method can generate a matte from a continuous matte gradient field by solving Poisson equations using boundary information, for example, from a user-supplied trimap (i.e., a three region map for an image). An exemplary method may include refinement of a matte gradient field using a number of tools (e.g., filtering, cloning, etc.), whereby a user can further improve Poisson matting results. Further, a modified local result may be seamlessly integrated into a final global result. Various examples are presented using complex natural images to demonstrate the quality of matting results through use of Poisson matting. Poisson matting is optionally used with other matting techniques, for example, Bayesian matting.
The discussion that follows includes various equations for purposes of illustrating how the Poisson equation may be applied to a pulling of matte problem or to matte refinement. The Poisson equation is a second-order partial differential equation (e.g., including a term of the form ΔΦ, where Δ is the Laplacian operator or the vector Laplacian, ∇2, may be included). Various exemplary techniques may use variants of the Poisson equation or, for example, use equations that include a second-order partial differential term for an alpha matte.
For a color image, the foreground F and the background B can be specified as color components together with an alpha channel matte, for example, RGB:
An alpha channel has various uses, including, for example, masking objects, making them transparent, or adding specific color instructions. In the {α, F, B} matrix, the alpha channel is a matte that distinguishes the foreground and background in an RGB image. As described herein, a user may desire constructing such a matrix for an image through a process referred to as matting, which aims to find an appropriate α and F.
Matting is inherently under-constrained because the matting equation has too many unknowns. Therefore, user interaction is often required to obtain good mattes. For example, in natural image matting, a user may be required to supply a trimap that partitions the image into three regions: “definitely foreground”, “definitely background” and “unknown region”.
Given an alpha matte, in image composition, a new image I(x, y) can be blended from a background image B(x, y) and a foreground image F(x, y) using the alpha matte α(x, y). A matting equation ((x,y) arguments deleted for clarity) may be specified as follows:
I=αF+(1−α)B (1)
As already mentioned, separation of α, F and B from a given image I is called the pulling of matte problem, or simply matting. In blue screen matting, α and F are generally reconstructed where B is known from a user-controlled environment. In contrast, for natural image matting, all variables α, F and B need to be determined. Ease of such a determination depends on complexity of the image and the desired quality of the result. Where the highest quality result is desired, many have resorted to tedious pixel-by-pixel editing. Various exemplary techniques described herein aim to reduce or eliminate a need for such editing.
Various exemplary techniques described herein rely on one or more assumptions. For example, an initial assumption can be that intensity change in the foreground and background of an image gradient is smooth. Given this assumption and a trimap for the image, an exemplary method uses global Poisson matting to approximate a matte from an image gradient. Accordingly, foreground and background colors can be robustly estimated.
In instances where global Poisson matting fails to produce high quality mattes, for example, due to a complex background, an exemplary technique uses local Poisson matting, which can be used to manipulate a continuous gradient field in a local region.
Local Poisson matting optionally relies on user input or interaction into a “pulling the matte” loop. In most cases, image gradients caused by foreground and background colors are visually distinguishable locally. Knowledge from a user can be integrated into Poisson matting using, for example, a set of tools that can operate on the gradient field of the matte.
Local Poisson matting can maintain continuities of thin long threadlike shapes of foreground objects in a complex scene, such as that of the image 100 of
The exemplary matting engine 210 operates to receive an image 202 and to generate a matte 230. Again, the matte 230 may be an alpha matte that allows for extracting an object or foreground from the image 202. The exemplary matting engine 210 typically allows for iterative operation, for example, where a user may examine the matte 230 and, in turn, use one or more local operations to refine or otherwise increase the quality of the matte 230. Such operations may require recalculation of the matte 230 using the global or local matting components 212, 214.
An exemplary method for matting 250 also appears in
After the global Poisson matting operation 258, the method 250 enters a local matting block 260 that uses information from the global matting operation 258 together with information about a local region of the received image to generate a local matting solution by solving a set of Poisson equation with boundary conditions pertaining to the local region. This local operation may be repeated one or more times for the same, overlapping or different local regions of the received image.
A decision block 262 decides if the matte result produced using global Poisson matting and local Poisson matting is acceptable. If the matte is acceptable (i.e., OK), then the method 250 terminates in an end block 270. However, if the matte is unacceptable (i.e., not OK), then the method 250 continues in a local operations block 266 where one or more local operations are used to refine the matte. After applying the one or more local operations, in this example, the method 250 returns to the local Poisson matting block 260.
As already mentioned, a result from local Poisson matting can be incorporated into a global result. Further, a plurality of local results may be incorporated into a global result.
Details and examples follow whereby Poisson matting and related techniques are used for matting. For example, a technique is mentioned for use in solving a set of Poisson equations with associated boundary conditions. Further, various local operations are mentioned. Again, such examples are given to demonstrate the exemplary techniques as other solvers and other local operations may be used, as appropriate.
An exemplary technique uses Poisson matting where an approximate gradient field of matte is computed from an input image and then a resulting matte is obtained from its gradient field by solving Poisson equations.
A general relationship between a matte (α) and a matte gradient (g) may be specified depending on the whether one wishes to derive a matte (α) from a matte gradient (g) or vice versa. For example, g=−∇α or Δα=div(g) where ∇=(∂/∂x, ∂/∂y) is the gradient operator, Δ=(∂2/∂x2+∂2/∂y2) is the Laplacian operator and div=(∂gx/∂x+∂gy/∂y) is the divergence operator. The equation for deriving a matte (α) from a matte gradient (g) is in the form of a Poisson equation.
Various boundary conditions may be specified for a Poisson equation, where the surface vector (ds) is directed outwardly from a region Ω. For example, a Dirichlet boundary condition may specify a value for α at the boundary ∂Ω; whereas a Neumann boundary condition may specify a value for the derivative of α with respect to the surface vector (ds). Other boundary conditions may be used as appropriate or a combination of boundary values (e.g., Dirichlet, Neumann, Cauchy, etc.).
The exemplary method 310 includes a reception block 312 where a matting engine receives an image. An operation block 316 follows that divides the image into a three regions: a background region, a foreground region and an unknown region. Such an operation block may specifying a background region, a foreground region and an unknown region wherein a boundary exists between the foreground region and the unknown region and wherein another boundary exists between the unknown region and the background region. A solution block 320 solves a set of Poisson equations having boundary conditions for the two boundaries to provide a matte that distinguishes a foreground region from a background region in the unknown region.
Yet further,
As described herein, various exemplary techniques use gradient manipulation. Gradient manipulation may occur locally or globally. For Poisson matting, a differential matting equation can be used, depending on various conditions or assumptions. In order to get an approximate gradient field of matte and, hence, a differential matting equation, one takes the partial derivatives of both sides of the matting equation, which results in Equation 2:
∇I=(F−B)∇α+α∇F+(1−α)∇B (2)
This is the differential form of the matting equation. For color images or other multi-component images, channels, etc., may be specified (e.g., Fr, Fg and FB, etc.).
Various assumptions may be made or conditions satisfied that allow for simplification of the differential matting equation. For example, in situations where foreground F and background B are smooth (i.e., α∇F+(1−α)∇B is relatively small with respect to (F−B)∇α), an approximate matte gradient field may be specified as follows:
∇α≈(F−B)−1∇I (3)
Thus, according to Equation 3, the matte gradient is proportional to the image gradient. Others have used an approximate equation of such form for other purposes that included estimation of opacity around the boundaries of a solid object through integration of the gradient of matte along a 1D path perpendicular to the boundary of the object. Various exemplary techniques described herein use such an approximation to reconstruct a matte more efficiently through solving Poisson equations in a 2D image space directly.
Referring again to the image 300 of
To recover the matte in the unknown region Ω given an approximate (F−B) and image gradient ∇I involves minimization of the following variational problem:
with Dirichlet boundary condition α|∂Ω={circumflex over (α)}|∂Ω. These conditions are specified as follows:
{circumflex over (α)}p|∂Ω=1 pεΩF; 0 pεΩB (5)
Such a definition is consistent with a user-supplied trimap. The associated set of Poisson equations with the same boundary condition is as follows:
Δα=div(∇I(F−B)−1) (6)
Obtaining the unique solution of Poisson equations is a well studied problem. For example, various examples presented herein included use of the Gauss-Seidel iteration with overrelaxation method to provide solutions. In such examples, for color images, both (F−B) and ∇I were measured in the grayscale channel.
An exemplary technique uses iterative optimization for global Poisson matting. A particular technique involves:
1. (F−B) initialization. Absolute values of F and B are not necessary, since (F−B) provides enough information to determine the matte. Initially, for each pixel p in Ω, Fp and Bp are approximated by corresponding the nearest foreground pixel in ΩF and background pixel in ΩB. Then, the constructed (F−B) image is smoothed by a Gaussian filter to suppress significant changes due to noise and inaccurate estimation of F and B.
2. α reconstruction. α is reconstructed by solving Poisson equations (6) using the current (F−B) and ∇I.
3. F, B refinement occurs, for example, by letting Ω+F={pεΩ|αp>0.95, Ip≈Fp}. The condition αp>0.95 and Ip≈Fp guarantees that the pixels in Ω+F are mostly foreground. Similarly, such refinement lets Ω+B={pεΩ|αp<0.05, Ip≈Bp}. Here, Fp, Bp and Ip represent the color vectors at pixel p. In this example, update of Fp and Bp occurs according to the color of the nearest pixels in ΩF∪Ω+F and in ΩB∪Ω+B, respectively. Also, in this example, a Gaussian filter is applied to smooth (F−B).
According to this exemplary technique, iteration occurs for the above steps 2 and 3 until change in the matting results is sufficiently small or, for example, both Ω+F and Ω+B are empty in step 3. For many images, only a few iterations are typically needed. For each iteration, the selection of Ω+F and Ω+B has little associated error, which acts to guarantee that more accurate colors in these two regions are further propagated into less accurate neighboring pixels.
Global Poisson matting works well in scenes with a smooth foreground and background. However, for a complex image, Equation 3 may not be a good approximation of the matte gradient globally, where the background and foreground gradients cannot be ignored. Thus, as described herein, an exemplary technique can use local Poisson matting, for example, to locally refine the global Poisson matting result.
Equation (2) can be rewritten as:
Εα=A(∇I−D) (7)
where A=(F−B)−1 and D=[α∇F+(1−α)∇B]. A affects the matte gradient scale in that increasing A would sharpen boundaries (i.e., decreasing F−B). D is a gradient field caused by the background and foreground. Hence, estimation of A and D allows one to approach the ground truth, A* and D*.
In an exemplary global Poisson matting process, A is automatically estimated from the image and D is assumed to be zero. When the background or foreground has strong gradients, global Poisson matting may require attention to produce a desired result.
An exemplary process for refining a result of global Poisson matting includes local Possion matting. For example, a user can specify a region ΩL for refinement or enhancement and then apply local Poisson matting. Referring to the image I 300 of
with Dirichlet boundary condition α|∂Ω={circumflex over (α)}|∂Ω. The local Dirichlet boundary condition {circumflex over (α)}|∂Ω is defined as:
αp|∂Ω=1 pεΩF; 0 pεΩB; αg pεΩ (9)
where αg is the current matte value in an unknown region on the local boundary.
In the example image 300, which corresponds to the image 100 of
An exemplary method allows for modification of A or D in a local region. For example, a user can modify A or D in a selected local region in an effort to produce a better approximation of ∇α. Further, two exemplary operations are optionally provided for such modification: channel selection and local filtering. Channel selection aims to reduce error associated with D whereas local filtering involves manipulation of A and D directly. Use of such operations can avoid a need to optimize a matte in a pixel-wise manner, and thereby allow for increased efficiency. Further, such operations may speed calculation of results.
For color images, Equation (3) can be measured in different channels (e.g., any single R/G/B or grayscale channel). In various examples described herein, for global Poisson matting, the grayscale channel was used, ∇α=Ag(∇Ig−Dg).
In general, the smooth background or foreground assumption makes |Dg| small such that Ag∇Ig is a typically good approximation of ∇α. Similarly, in a local region, an exemplary process constructs a new channel γ=aR+bG+cB with a smooth background or foreground in which |Dγ| is smaller than |Dg|. Thus, such an exemplary process may minimize the variance of the foreground or background colors, and the new channel γ as follows:
1. A user selects either background or foreground color samples {(Ri Gi Bi}i=1N in an image using, for example, a simple brush. Such a process is optionally automated in a manner that reduces user input.
2. Computation of weights (a b c) occurs to minimize sample variances ΣiN(γi−γ)2 in the new channel, which poses a linearly constrained quadratic optimization problem:
where (R G B) is the mean color value of the samples. The weights (a b c) are obtained by solving an augmented linear system. Such an exemplary process was used to produce the improved optimized channel matte 538 of
As already mentioned, filtering may be used to refine or otherwise improve results. Filtering can operate directly on A and D. Local filters can be used to manipulate a matte gradient field. Described herein are various exemplary filter operations, referred to as a boosting brush, a highpass filter, a diffusion filter and a clone brush.
An exemplary boosting brush filter operation can be used, for example, when a matting result is smoother or sharper than what user may expect. In particular, such a boosting brush can be used to increase or decrease A directly (e.g., A=(F−B)−1). Image series 610 of
where p0 is the coordinate of the brush center, σ and λ are user defined parameters to control the size and strength of the boosting effect. Hence, the user can boost the whole or partial region by using brushes of various sizes. If λ>0, this filter will increase A.
With respect to the series 610 of
An exemplary process optionally includes highpass filtering. For example, a channel selection operation can generate a smooth background or foreground, leading to low frequency background or foreground gradients. In such an example, D can be estimated using the low-frequency part of the image gradient:
D=K*∇I
where K=N(p; p0, σ2) is a Gaussian filter centered at pixel p0 and * is the convolution operator. From Equation (7), ∇α=A(∇I−K*∇I), where (∇I−K*∇I) corresponds to a highpass filter. The series 620 of
With respect to the series 620 of
An exemplary process optionally includes diffusion filtering. On the boundary of a solid object where alpha matte changes quickly, A∇I generally provides a good approximation; however, the image gradient ∇I is sensitive to noise and blocking effects that may be present in, for example, JPEG images. In the example series 730 of
An exemplary process optionally includes cloning, for example, using a clone brush. Such a clone brush can copy a matte gradient from a local region to another region. In the series 740 of
According to an exemplary clone technique, in some situations, cloning can be used to directly copy a matte gradient A(∇I−D) from a source region to a target region. In the series 740 of
Other exemplary processes for enhancing images or mattes include an erase brush for erasing that can, for example, remove unwanted alpha matte regions directly; and an inverse brush that can inverse an incorrect sign of a matte gradient.
As described above, various enhancement or refinement processes may be used to arrive at a suitable result. For example, with various aforementioned local operations, a user can refine a matte in a selected region. An exemplary process is based on a global Poisson matting result and uses local Poisson matting as follows:
1. Apply channel selection to reduce the errors in D. For solid object boundaries, apply the diffusion filter to remove possible noise;
2. Apply the highpass filtering to obtain an approximation of D;
3. Apply the boosting brush to manipulate A; and
4. Optionally apply the clone brush if gradients are indistinguishable.
The aforementioned, erase brush and inverse brush can be optionally applied in any step. At each step, local Poisson matting can typically generate results very quickly (e.g., depending on resources and local region size).
An exemplary GUI utility provides a user with an option to observe the matting result and select any remaining unsatisfactory regions for further refinement.
An exemplary process can be applied to matting with multiple backgrounds.
where
is the mean background. In general,
An exemplary process can be applied to de-fog an image.
A fog model can be represented as a matting equation:
I=Ic·e−βd+Fog·(1−e−βd) (13)
where Fog is the color of fog, Ic is the clear image without fog, β is the scattering coefficient of the atmosphere and d is the depth value. According to the exemplary process 900, local assignment of information produces acceptable results. Consider taking the partial derivatives of (13) to obtain ∇Ic=∇I·eβd with respect to assigned depth d. The aforementioned boosting brush is applied to locally modify eβd in the selected region to fine tune the defogged image gradient. By solving Poisson equations, any modification to the image can be automatically and seamlessly propagated to generate the de-fogged image without any visible boundaries.
The result 1022 relies on an exemplary local Poisson matting process. Most images are very complex not only in foreground and background colors, but also in their gradient fields. Therefore, in this example, Bayesian matting, which relies on sampling color pixels, does not perform as well.
A close inspection of input images and matting results, indicates that Bayesian matting fails in places where foreground and background colors are similar, or their colors have large change so that correct samples are buried in the local region. However, Bayesian matting can have some advantages for certain natural images. An exemplary method optionally includes use of Poisson matting and Bayesian matting.
As discussed herein, various exemplary digital matting methods include use of Poisson equations or what is referred to as Poisson matting. By solving Poisson equations, Poisson matting can reconstruct a faithful matte from its approximated gradient field estimated from an input image.
Exemplary Computing Environment
The various exemplary technologies may be implemented in different computer environments. For example, various exemplary methods are typically computer-implementable. The computer environment shown in
Various exemplary methods are operational with numerous other general purpose or special purpose computing system environments or configurations. Examples of well known computing systems, environments, and/or configurations that may be suitable for implementation or use include, but are not limited to, personal computers, server computers, hand-held or laptop devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like.
Various exemplary methods, applications, etc., may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Such instructions may be stored on one or more computer-readable media. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform particular tasks or implement particular abstract data types. Various exemplary methods may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network or other communication (e.g., infrared, etc.). In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
With reference to
Computer 1110 typically includes a variety of computer readable media. Computer readable media can be any available media that can be accessed by computer 1110 and includes both volatile and nonvolatile media, removable and non-removable media. By way of example, and not limitation, computer readable media may comprise computer storage media and communication media. Computer storage media includes both volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can accessed by computer 1110. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. The term “modulated data signal” means a signal that has one or more of its characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, RF, infrared and other wireless media. Combinations of the any of the above should also be included within the scope of computer readable media.
The system memory 1130 includes computer storage media in the form of volatile and/or nonvolatile memory such as read only memory (ROM) 1131 and random access memory (RAM) 1132. A basic input/output system 1133 (BIOS), containing the basic routines that help to transfer information between elements within computer 1110, such as during start-up, is typically stored in ROM 1131. RAM 1132 typically contains data and/or program modules that are immediately accessible to and/or presently being operated on by processing unit 1120. By way of example, and not limitation,
The computer 1110 may also include other removable/non-removable, volatile/nonvolatile computer storage media. By way of example only,
The drives and their associated computer storage media discussed above and illustrated in
The computer 1110 may operate in a networked environment using logical connections to one or more remote computers, such as a remote computer 1180. The remote computer 1180 may be a personal computer, a server, a router, a network PC, a peer device or other common network node, and typically includes many or all of the features described above relative to the computer 1110. The logical connections depicted in
When used in a LAN networking environment, the computer 1110 is connected to the LAN 1171 through a network interface or adapter 1170. When used in a WAN networking environment, the computer 1110 typically includes a modem 1172 or other means for establishing communications over the WAN 1173, such as the Internet. The modem 1172, which may be internal or external, may be connected to the system bus 1121 via the user input interface 1160, or other appropriate mechanism. In a networked environment, program modules depicted relative to the computer 1110, or portions thereof, may be stored in a remote memory storage device. By way of example, and not limitation,
Although various exemplary methods, devices, systems, etc., have been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described. Rather, the specific features and acts are disclosed as exemplary forms of implementing the claimed subject matter.