## Main functions

There are 5 main functions and 2 wrappers:

### Convolution functions

```
# Build kernels
# Kernel 1: For bottom edge recognition
<- matrix(c(-1, -2, -1,
kernel1 0, 0, 0,
1, 2, 1),
nrow = 3)
# Kernel 2: Diagonal weighting
<- matrix(c(-2, 0, 0,
kernel2 0, 1, 0,
0, 0, 2),
nrow = 3)
# Apply filters
<- convolution2D(X = wbImage, kernel = kernel1)
convolutionExample <- convolutionQuantile(X = wbImage, kernel = kernel2, probs = 0.1) convQuantileExample
```

In order to compare results, we will plot both data (original and
filtered) using `image`

function, as shows in figures 1 and
2.

**Original**

**Filtered**

### Median-filter asociated functions

```
# Add some noise (NA) to the image (matrix)
set.seed(7)
<- sample(x = seq(prod(dim(myMatrix))), size = as.integer(0.4*prod(dim(myMatrix))), replace = FALSE)
naIndex <- NA
myMatrix[naIndex]
# Build kernel
<- 3
radius
# Apply filters
<- meanFilter(X = myMatrix, radius = radius)
meanfilterExample <- quantileFilter(X = myMatrix, radius = radius, probs = 0.1)
quantilefilterExample <- medianFilter(X = myMatrix, radius = radius, times = 10) medianfilterExample
```

Now, we will plot both data (original and filtered) using
`image`

function, as shows in figures 1 and 2.

**Original**

**Filtered**