# Convolutions and Filters

## What is a Convolution?

To better understand all the sections which follow, Let's understand some of the jargon present within this space; A **Convolution** is a function which takes in an image and an **Area** let's call this `N`

`N` refers to what is known as a **Kernel size** in context of CV we perform modifications to the pixels across an area or the Kernel, think of it as a stencil -- you place it on a 2D list of pixels and do some calculation on whatever pixels are contained within this stencil, this would mean that a kernel of dimensions 3x3 would encapsulate the current pixel, and eight other neighboring pixels. Rinse and repeat for every pixel within the image and you've got yourself a Convolution. Here is a visualization of what a kernel is.

<div><figure><img src="https://1119901190-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmtkBruvWiL80eAdJOUJG%2Fuploads%2FeS1Cs8NkOEAwaMrDa9nt%2Fkernel-2x2.png?alt=media&#x26;token=ea195faf-47d8-41fc-900e-d2b9a9c99287" alt=""><figcaption><p>Kernel 2x2</p></figcaption></figure> <figure><img src="https://1119901190-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmtkBruvWiL80eAdJOUJG%2Fuploads%2FDhgoXDxHJRZRdg4bg9dG%2Fkernel-3x3.png?alt=media&#x26;token=ec4ac85e-142a-4e0d-bee0-f291a49ec305" alt=""><figcaption><p>Kernel 3x3</p></figcaption></figure></div>

> **Note** I will use pixels and array of integers interchangeably, when I say pixel it always implies it encapsulates three integers for RGB (for most cases)

The terms **filter** and **mask** can also be used interchangeably with convolution functions. You may see me do this in the modules that follow.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://aadv1k.gitbook.io/computer-vision-guide/convolutions-and-filters.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
