1. A method for matting a foreground object F having an opacity α in an image having a background B, the respective opacity of selected pixels in the foreground object F and the background B being constrained by associating a characteristic with said pixels, the method comprising: (a) dividing the image into small windows, w; (b) determining weights for all edges of neighboring pixels for the image in said windows; (c) assuming within each window w, that α is a linear combination of color channels, c, α i ≈ ∑ c a c I i c + b , ∀ i ∈ w , (d) using a cost function J ( α , a , b ) = ∑ j ∈ I ( ∑ i ∈ w j ( α i - ∑ c a c j I i c - b j ) 2 + ɛ ∑ c a j c 2 ) eliminate a, b to obtain a cost function involving only α of the form J(α)=α T Lα where L(i,j) is of the form: ∑ k  ( i , j ) ∈ w k ( δ ij - 1  w k  ( 1 + ( I i - μ k ) ( ∑ k + ɛ  w k  I 3 ) - 1 ( I j - μ k ) ) ) where δ ij is the Kronecker delta, μ k and σ k 2 are the mean and covariance of the intensities in the window w k around k and |w k | is the number of pixels in this window; (e) solve for α where α=arg min α T Lα s.t. α i =s i , ∀iεS, S is the group of selected pixels, and s i is the value indicated by said characteristic; (f) solve for F and B in the equation I i =α i F i +(1−α i )B i with additional smoothness assumptions on F and B; (g) compositing the foreground object F on a selected background B′ so as to generate an image; and (h) storing data representative of the image in memory for subsequent display.