Part 1: Frequency Domain

Part 1.1: Warmup

Pick your favorite blurry image and "sharpen" it using the unsharp masking technique we covered in class.

In [9]:
#

Part 1.2: Hybrid Images

In [13]:
#
In [14]:
FFT
In [117]:
#Obama and Biden
In [121]:
#Hermione and Harry

Part 1.3: Gaussian and Laplacian Stacks

In [19]:
 
In [20]:
 
In [21]:
 

Multi Resolution Blending

Orange and apple colored stacks

In [52]:
# 

Orange and apple mask stacks

In [72]:
# 
In [73]:
 

Orange and apple stacks, and oraple

In [71]:
 
(300, 300)
(300, 300)
(300, 300)
(300, 300)
(300, 300)

Earth and Oreo

Earth and Oreo Mask stacks

In [124]:
 

Earth and Oreo Stacks

In [77]:

Earth and Oreo combined: Eareo

In [78]:
 
(768, 768)
(768, 768)
(768, 768)
(768, 768)
(768, 768)

Tortoise and the beach

Tortoise and beach stacks

In [82]:
 
In [84]:
 
In [85]:
 

Tortoise and beach stacks with masks multiplied. Tortobeach. Also, see Poisson Blending result for the same.

In [86]:
 
(715, 1500)
(715, 1500)
(715, 1500)
(715, 1500)
(715, 1500)
In [122]:
 
In [ ]:
 
In [ ]:
 

Poisson Blending.

This is a technique of taking two images, a source and a target, and blending them. A naive approach to blend the images would be to just copy and paste the pixels, however, no context information is taken into account. For instance, if merging a ball from one beach to a different beach, the differing colors of the sand creates issues for the human eye, which is able to tell the changing gradient very easily.

To counter this, we enforce the constraint that the gradients of the source image must be minimized (sum of squares) when inside the target's cut out region. At the border, we enforce that pixels not only maintain the gradient, but also have similar intensities to the pixels outside the border (inside the target image). This will produce a massive strike in the least squares error if the boundaries do not match in color -- and least squares will attempt to spread this error over the entire source image, changing its intensities to blend well within the target

Solving the vanilla least squares problem. Left: input. Right: output.

In [18]:
show_images([s, v_shaped])

Part 2.2

Part 2.2 Examples

Example I: Penguin blended (provided example)

In [56]:
#

Example II: Corgi blended into park

In [58]:
#

Example 3: Superman approaches Campanile!

In [59]:
#

Example 4: Failure –– corgi becomes a pig :(

My understanding for why this did not work is because the boundaries mismatch by a lot, making the brightness too high for the corgi. In addition, the image is placed at the boundary of the sand and the water, which further confuses the gradients and ends up making the corgi look like a pig...

In [65]:
#

Example 5: Compare to Multiresolution blending. Tortoise on beach

In [72]:
#
Out[72]:
<matplotlib.image.AxesImage at 0x12d03c128>
In [73]:
#
In [1]:
#
In [ ]: