Project: Image Filters
Many common image manipulations can be described as the application of a
filter. An image filter is a square array of coefficients that describes how old
pixel values will be combined to find a new pixel value. Each entry in the array
is a coefficient to be multiplied by the color in that location. The resulting
RGB values are then added together to pro duce the final result. The center
of the filter corresponds to the position of the pixel whose color is currently
being computed.
For example, this is a 3 × 3 filter that takes 0 times the current color (in the
center) plus 1/8 times each of the colors in the surrounding pixels:
1/8 1/8

Get A Concise Introduction to Programming in Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.