File: convolution.rst

package info (click to toggle)
thumbor 7.7.7-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 40,528 kB
  • sloc: xml: 295,435; python: 18,668; ansic: 1,479; makefile: 360; sh: 27
file content (56 lines) | stat: -rw-r--r-- 1,311 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Convolution
===========

Usage: `convolution(matrix\_items, number\_of\_columns, should\_normalize)`

Description
-----------

This filter runs a convolution matrix (or kernel) on the image. See
`Kernel (image
processing) <http://en.wikipedia.org/wiki/Kernel_(image_processing)>`__
for details on the process. Edge pixels are always extended outside the
image area.

Arguments
---------

-  ``matrix_items`` - Semicolon separated matrix items.
-  ``number_of_columns`` - Number of columns in the matrix.
-  ``should_normalize`` - Whether or not we should divide each matrix item by the sum of all items.

Example
-------

.. image:: images/tom_before_brightness.jpg
    :alt: Picture before the convolution filter

Normalized Matrix:

::

    1 2 1
    2 4 2
    2 1 2

::

    http://localhost:8888/unsafe/filters:convolution(1;2;1;2;4;2;1;2;1,3,true)/http://upload.wikimedia.org/wikipedia/commons/5/50/Vd-Orig.png

.. image:: images/tom_after_convolution1.jpg
    :alt: Picture after the convolution filter

Matrix:

::

    -1 -1 -1
    -1  8 -1
    -1 -1 -1

::

    http://localhost:8888/unsafe/filters:convolution(-1;-1;-1;-1;8;-1;-1;-1;-1,3,false)/http://upload.wikimedia.org/wikipedia/commons/5/50/Vd-Orig.png

.. image:: images/tom_after_convolution2.jpg
    :alt: Picture after the convolution filter