# Wave function collapse

Learn to procedurally generate images based on a sample image using the wave function collapse algorithm during the artificial intelligence master’s course Computer Graphics & Computer Vision by Dr. Umut Güçlü at Radboud University. Lynn, Michelle and myself are present as teaching assistants.

In the weird world of quantum mechanics, quantum particles can be in lots of different states simultaneously, represented by a wave function. Imagine you are trying to catch a butterfly but don’t know exactly where it is; it could be on a flower, in the air or somewhere else. The wave function then describes the probability of all these different states of the butterfly. However, when we actually *observe* the butterfly’s state, the wave function *collapses* and the butterfly is forced to take on __one__ specific state. It’s like you caught the butterfly and can now see its exact colors. 🦋✨

The synthesis algorithm **wave function collapse** is loosely inspired on the concept from quantum mechanics; it uses a set of probabilities to describe all the possible states of a texture in superposition, which are then collapsed one-by-one to generate the resulting output pattern.

*The gifs show the process of synthesis by gradually collapsing the states in the output images. Starting in superposition, each state collapse brings the image closer to a fully-collapsed pattern that looks locally similar to the input sample image (shown as the smaller image on the left).*