cmatrix.Matrix.convolve

Matrix.convolve()

Convolve filtering data matrix using the given mask.

Parameters

Type

Description

mask

Matrix

The convolution mask as a matrix

Returns
Matrix

The convolution product result between self matrix and the given mask

Examples

>>> mask=gaussian(3,0,1)
>>> print(mask)
| +0.062 | +0.125 | +0.062 |
| +0.125 | +0.250 | +0.125 |
| +0.062 | +0.125 | +0.062 |
printed
>>> m=rand(5)
>>> print(m)
| +11.000 | +11.000 | +11.000 | +24.000 | +4.000 |
| +2.000 | +17.000 | +2.000 | +11.000 | +17.000 |
| +1.000 | +19.000 | +22.000 | +14.000 | +14.000 |
| +7.000 | +20.000 | +18.000 | +17.000 | +15.000 |
| +19.000 | +1.000 | +1.000 | +5.000 | +18.000 |
printed
>>> print(m.convolve(mask))
| +9.625 | +15.625 | +14.438 | +11.562 | +6.750 |
| +10.625 | +15.875 | +14.938 | +11.188 | +6.875 |
| +11.688 | +14.062 | +14.188 | +10.500 | +8.000 |
| +9.000 | +9.750 | +10.188 | +7.875 | +6.688 |
| +11.312 | +10.438 | +8.938 | +5.438 | +6.938 |
printed