# convol2d

### 呼び出し手順

`C = convol2d(A,B)`

A

B

C

### 説明

`convol2d` は 完全な二次元離散畳み込みを計算するためにfftを使用します. 結果 `C` の次元は `size(A)+size(B)-1`で指定されます. `B`の中心要素の添字は `floor((size(B)+1)/2)`で定義されます.

### 例

```s = [1 2 1; 0 0 0; -1 -2 -1] // Sobel horizontal edge kernel
A = zeros(10,10); A(3:7,3:7) = 1
C = convol2d(s, A);
clean(C)```
```--> s = [1 2 1; 0 0 0; -1 -2 -1] // Sobel horizontal edge kernel
s  =
1.   2.   1.
0.   0.   0.
-1.  -2.  -1.

--> A = zeros(10,10); A(3:7,3:7) = 1
A  =
0.   0.   0.   0.   0.   0.   0.   0.   0.   0.
0.   0.   0.   0.   0.   0.   0.   0.   0.   0.
0.   0.   1.   1.   1.   1.   1.   0.   0.   0.
0.   0.   1.   1.   1.   1.   1.   0.   0.   0.
0.   0.   1.   1.   1.   1.   1.   0.   0.   0.
0.   0.   1.   1.   1.   1.   1.   0.   0.   0.
0.   0.   1.   1.   1.   1.   1.   0.   0.   0.
0.   0.   0.   0.   0.   0.   0.   0.   0.   0.
0.   0.   0.   0.   0.   0.   0.   0.   0.   0.
0.   0.   0.   0.   0.   0.   0.   0.   0.   0.

--> C = convol2d(s, A);
--> clean(C)
ans  =
0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.
0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.
0.   0.   1.   3.   4.   4.   4.   3.   1.   0.   0.   0.
0.   0.   1.   3.   4.   4.   4.   3.   1.   0.   0.   0.
0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.
0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.
0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.
0.   0.  -1.  -3.  -4.  -4.  -4.  -3.  -1.   0.   0.   0.
0.   0.  -1.  -3.  -4.  -4.  -4.  -3.  -1.   0.   0.   0.
0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.
0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.
0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.   0.
```

### 参照

• conv2 — 離散 2-D 畳み込み.
• conv — 離散一次元畳み込み
• convol — 畳込み(コンボリューション)
• real — 実部
• clean — 行列を消去 (小さなエントリをゼロに丸める)

### 履歴

 バージョン 記述 5.4.0 関数convol2dが導入されました.
 Report an issue << convol Correlation Convolution corr >>