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.
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 |
---|---|
Part III Seam Finding
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 |
---|---|
Cut - Row | Cut - Column |
---|---|
4 More Examples
Text | White | Stone | Grass |
---|---|---|---|
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 |
---|---|---|
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
Compared to non-iterative texture transfer, the borders are smoother, but the images have more noisy points.