Image Quilting

Part I & II: Random & Simple Quilting

I used two image quilting methods to generate an image of brick wall twice as big as the sample.

bricks_small

quilt_random (left) chose patches randomly and pasted them without overlap. The border bewteen patches was obvious.

quilt_simple (right) considered the similarity of the overlapping regions. It chose the one cloest enough to previous patches, so the border was nicer.

Randomly Sampled Texture Overlapping Patches
1_random_result 2_overlapping_result

Part III Seam Finding

3_seam_result_0

The third method is with seam finding. My quilt_cut found the minimum cost cut through the error surface at the overlap, to reduce the border.

Analysis

Use these illustrations as an example. quilt_cut first identified the overlapping regions and found the patch with small difference, as quilt_simple did.

Then it computed the error patch and used it to find the minimum cost cut edge. Our goal is to make the edge as close to the boundary of the sample as possible.

Patch Output
3_cut_overlap_patch 3_cut_overlap_output
Cut - Row Cut - Column
3_cut_cost_row 3_cut_cost_col

4 More Examples

Text White Stone Grass
text_small white_small stone_small grass_small
3_seam_result_1 3_seam_result_2 3_seam_result_3 3_seam_result_4

Part IV Texture Transfer

The last part is texture_transfer. Besides the similarity among patches, we need to consider the matches between patches and target images.

In the following examples, I used black and white images as targets, and matched the luminance with patches, to let the output has the patterns of the targets.

Source Target Result
sketch feynman 4_transfer_result_0
sketch Audrey-Hepburn 4_transfer_result_1

Difficulties

I encountered some difficulties. For example, there might be overflow or underflow when quilting patches. I created an output image that is larger than outsize, and cropped it in the end, to prevent tedious checks of boundaries.

Also, sometimes I concatenated my masks to three dimensions to match the dimensions of other images.

Implement cut.m

I implemented mycut.m based on the given code. First, compute errpatch to record the cost of cut, and start from the left-most column, store the minimum cost to arrive at each node, and output the smallest. And finally we created a mask depending on the path, indicating which part belonged to output and which belonged to the newest patch.

Iteration of Texture Transfer

For iteration when N=3, we have

4_transfer_result_it_0

4_transfer_result_it_1

Compared to non-iterative texture transfer, the borders are smoother, but the images have more noisy points.