<p>For these types of algorithms, you usually have to rely on multiple forms of texture synthesis. That doesn't mean you have to generate the whole texture from scratch. For example, you could regenerate the sides of the texture to achieve a seamless effect. This answer may not be complete because it's a large field, and different approaches will have various effectiveness depending on the input image.</p>

<h1>Naive blur along edges</h1>

<p>As an artist, one way to make seamless textures is to offset the image in two directions. Then, you can blur the edges.</p>

<p><a href="https://i.sstatic.net/Nf1L4.png" rel="noreferrer"><img src="https://i.sstatic.net/Nf1L4.png" alt="enter image description here"></a></p>

<p>This example isn't the best, but you can get decent results with results with certain texture types.</p>

<p>Alternatively, you could do a minimum cut on the edge here by overlapping the image with itself, and then taking the difference between the two images.</p>

<h1>Min-cut algorithms</h1>

<p>One of the most popular algorithms is <a href="http://dl.acm.org/citation.cfm?id=383296" rel="noreferrer">image quilting</a>. The idea behind this is separate the texture into a bunch of patches. You fill in the texture by first randomly picking a subset of patches from your total set of patches and picking the one with the least amount of error when you overlap the patch with it's neighboring patch(es). You then perform minimum cuts along the overlapping regions.</p>

<p>My experience with this algorithm is that it works well for many textures that have round details. If the texture is grass for instance, then it can perform poorly. The amount you overlap each patch also has a large impact on quality. The larger the overlap, the better the match, but the more likely there will be repetition. Also, if the subset of candidate patches is too large, then you'll get repetition. Otherwise, you might not find good matches.</p>

<p>There are extensions of this algorithm including PatchMatch (which was used in Photoshop).</p>

<h1>Gradient correction</h1>

<p>Another way to handle seamless textures is to remove the gradient. <a href="http://dl.acm.org/citation.cfm?id=882269" rel="noreferrer">Poisson image editing</a> can help with this if you break up your image and use the various pieces are foreground and background objects.</p>

<p>A simpler approach is to create a low-frequency (e.g., mipmap) of your texture and then remove the gradient of your image. Of course, high frequency data won't be seamless, but you can remove that with other algorithms.</p>

<h1>Computer vision approaches</h1>

<p>You could use various computer vision approaches as well. The idea here would be that you keep important features intact as you attempt to tile your textures. For instance, if there's a texture of dirt with a rock on the edge of the picture, using various feature detectors such as difference of Gaussians could help you identify this rock and remove it before you do the tiling. You might need to fill in the rest of the texture where the rock was removed, but this could help with making the image more seamless.</p>

<h1>Additional References</h1>

<ul>
<li><a href="http://www.connellybarnes.com/work/class/2014/comp_photo/proj1/" rel="noreferrer">Image quilting and PatchMatch high-level explanation</a></li>
<li><a href="http://www.connellybarnes.com/work/class/2014/comp_photo/proj2/" rel="noreferrer">Gradient domain compositing</a></li>
</ul>

CC BY-SA 3.0
2017-07-10T14:40:03.727Z
This is a very good answer, and I'm glad you took the time to go over multiple algorithms, rather than just one. I'll make sure to look at those links.
Daniel Kareh
CC BY-SA 3.0
2017-07-10T02:47:41.113Z
2017-07-13T10:43:15.777Z
2017-07-13T10:43:15.777Z
aces
<p>I understand how an artist would make seamless textures by hand, but how can a computer program automate that process? Software like <a href="https://www.pixplant.com/" rel="noreferrer">PixPlant</a> is capable of doing this, but I don't understand <strong>how</strong> it does this.</p>

CC BY-SA 3.0
2017-07-03T07:38:21.600Z
I've no idea what that tool uses, but one approach might be to use seam carving. A quick internet search, for example, turned up this project report:  https://inst.eecs.berkeley.edu/~cs194-26/fa15/upload/files/projFinalUndergrad/cs194-dm/Alex_Liu_Report.pdf   Another possibility is to build textures via texture synthesis.
Simon F
CC BY-SA 3.0
2017-07-03T16:01:55.743Z
That looks like a very interesting report. I'll make sure to check that out.
Daniel Kareh
<texture><algorithm><image-processing>
Seamless Textures
Daniel Kareh
# Seamless Textures

(Asked by: username_0 on 2017-07-03)

I understand how an artist would make seamless textures by hand, but how can a computer program automate that process? Software like [PixPlant](https://www.pixplant.com/) is capable of doing this, but I don't understand **how** it does this.

**Tags:** texture, algorithm, image-processing

> **Comments:**
> **username_1**: I've no idea what that tool uses, but one approach might be to use seam carving. A quick internet search, for example, turned up this project report:  https://inst.eecs.berkeley.edu/~cs194-26/fa15/upload/files/projFinalUndergrad/cs194-dm/Alex_Liu_Report.pdf   Another possibility is to build textures via texture synthesis.  
> **username_0**: That looks like a very interesting report. I'll make sure to check that out.  

---

## 1 answers

### Answer by username_2 on 2017-07-10. Score: 10 | Accepted answer

For these types of algorithms, you usually have to rely on multiple forms of texture synthesis. That doesn't mean you have to generate the whole texture from scratch. For example, you could regenerate the sides of the texture to achieve a seamless effect. This answer may not be complete because it's a large field, and different approaches will have various effectiveness depending on the input image.

# Naive blur along edges

As an artist, one way to make seamless textures is to offset the image in two directions. Then, you can blur the edges.

[![enter image description here](https://i.sstatic.net/Nf1L4.png)](https://i.sstatic.net/Nf1L4.png)

This example isn't the best, but you can get decent results with results with certain texture types.

Alternatively, you could do a minimum cut on the edge here by overlapping the image with itself, and then taking the difference between the two images.

# Min-cut algorithms

One of the most popular algorithms is [image quilting](http://dl.acm.org/citation.cfm?id=383296). The idea behind this is separate the texture into a bunch of patches. You fill in the texture by first randomly picking a subset of patches from your total set of patches and picking the one with the least amount of error when you overlap the patch with it's neighboring patch(es). You then perform minimum cuts along the overlapping regions.

My experience with this algorithm is that it works well for many textures that have round details. If the texture is grass for instance, then it can perform poorly. The amount you overlap each patch also has a large impact on quality. The larger the overlap, the better the match, but the more likely there will be repetition. Also, if the subset of candidate patches is too large, then you'll get repetition. Otherwise, you might not find good matches.

There are extensions of this algorithm including PatchMatch (which was used in Photoshop).

# Gradient correction

Another way to handle seamless textures is to remove the gradient. [Poisson image editing](http://dl.acm.org/citation.cfm?id=882269) can help with this if you break up your image and use the various pieces are foreground and background objects.

A simpler approach is to create a low-frequency (e.g., mipmap) of your texture and then remove the gradient of your image. Of course, high frequency data won't be seamless, but you can remove that with other algorithms.

# Computer vision approaches

You could use various computer vision approaches as well. The idea here would be that you keep important features intact as you attempt to tile your textures. For instance, if there's a texture of dirt with a rock on the edge of the picture, using various feature detectors such as difference of Gaussians could help you identify this rock and remove it before you do the tiling. You might need to fill in the rest of the texture where the rock was removed, but this could help with making the image more seamless.

# Additional References

* [Image quilting and PatchMatch high-level explanation](http://www.connellybarnes.com/work/class/2014/comp_photo/proj1/)
* [Gradient domain compositing](http://www.connellybarnes.com/work/class/2014/comp_photo/proj2/)

> **Comments:**
> **username_0**: This is a very good answer, and I'm glad you took the time to go over multiple algorithms, rather than just one. I'll make sure to look at those links.  

---

