Deformation is the process of transforming an image by changing its shape or perspective. It is often used for image correction, such as fixing distortions caused by camera lenses, or to create special effects in images. Additionally, we will explore the feedback technique, which involves iteratively applying image processing to create more complex and interesting effects.


<aside> 💡 Many examples on this page use GLSL shaders. To learn more about shaders, please read The Book of Shaders. The page on 2D Matrices ******will be particularly useful. このページでは多くのサンプルでGLSLシェーダを使用しています。シェーダについて詳しく知りたい場合は、The Book of Shadersを読んでください。特に二次元行列のページが役立つと思います。


Deformation 変形

0 0 0
0 0 1
0 0 0

We saw this example above at the end of the Convolution page. As you can see in the demo, this filter shifts the entire picture one pixel to the left. Because the cells in the filter with a value of zero have no effect, this simply copies the color of the pixel to the right of the current position. In other words, this filter copies the color of $(x+1, y)$ from the original image to the coordinate $(x, y)$.

畳み込みのページの最後で上の例を見ました。デモでわかるように、このフィルターは画像全体を1ピクセル左にずらします。値がゼロの部分は何もしないので、このフィルタは単に現在の位置から右にあるピクセルの色をコピーする働きをします。言い換えるとこのフィルターは座標$(x, y)$に元の画像の$(x + 1, y)$の色をコピーします。

Screenshot 2023-04-29 at 5.08.02 PM.png

Let's take a look at the following equation. $(x, y)$ is the destination coordinates and $(x', y')$ is the source coordinates. Instead of using pixels as the unit, we map the top-left corner to $(0,0)$ and the bottom-right corner to $(1,1)$.

次の式を見てみましょう。$(x, y)$ はコピー先、$(x', y')$ はコピー元の座標です。ピクセル単位ではなく左上を$(0,0)$、右下を$(1,1)$とします。

$(x', y') = (x + \frac{y}{2}, y)$

This equation causes the image to slant, as shown in the demo below.