This lesson is still being designed and assembled (Pre-Alpha version)

## Prerequisites

Before starting this lesson, you should be familiar with:

## Learning Objectives

After completing this lesson, learners should be able to:
• Design morphological filters using rank filters

• Execute morphological filters on binary or grayscale images and explain the output

## Motivation

Filters can be used to change size and shape of objects in an image. [*] Concept map below assumes bright objects on dark background. For dark objects on bright background effect of min and max filters is inverted.

## Concept

graph TD image --> max1[max] image --> min1[min] image --> max2[max] image --> min2[min] image --> d subgraph rank filter sequence max2 --> min3[min] min2 --> max3[max] max1 min1 d[max - min] end max1 --> dilation min1 --> erosion max3 --> opening min3 --> closing d --> gradient subgraph morphological filter name dilation erosion opening closing gradient end

## Activity

Open the image, `xy_8bit_binary_two_spots_different_size.tif`, and explore how structures grow and shrink, using erosion and dilation

## Formative assessment

### Exercise 1

Fill in the blanks, using those words: “shrinks”, “increases”, “decreases”, “enlarges”.

1. An erosion ___ objects in a binary image. 2. An erosion in a binary image ___ the number of foreground pixels. 3. A dilation in a grayscale image ___ the average intensity in the image. 4. A dilation ___ objects in a binary image.

### Exercise 2

True of false? Discuss with your neighbour!

1. Morphological openings on binary images can decrease the number of foreground pixels. 2. Morphological closings on binary images never decreases the number of foreground pixels. 3. Performing a morphological closing a twice in a row does not make sense, because the second closing does not further change the image.

## Follow-up material

We recommend reading these modules next:

• TODO