This lecture transitions from the spatial and frequency filtering techniques discussed previously to Morphological Image Processing. While standard spatial filters (like the Sobel or Laplacian operators) rely on numerical arithmetic to find edges, morphology relies on set theory to analyze and manipulate the geometric shape of features within an image.

Morphological operations are typically performed on binary images (where pixels are either 0 or 1) to extract boundaries, skeletons, or to clean up imperfections introduced during the segmentation process.


1. Structuring Elements (SE)

In spatial filtering, you use a "kernel" or "mask" containing numerical weights. In morphology, you use a Structuring Element (SE), which is simply a shape mask.


2. The Fundamental Primitives

All morphological algorithms are built upon two primitive operations: Dilation and Erosion.

A. Dilation (AB)

Dilation expands objects, fills in small holes, and connects disjoint shapes.

B. Erosion (AB)

Erosion shrinks objects by etching away their boundaries. It is highly effective at removing small noise, thin branches, or bridges between larger shapes.


3. Compound Operations

By combining erosion and dilation, we can achieve more complex structural filtering without drastically altering the overall size of the original objects.


4. Advanced Applications

Hit-or-Miss Transform (HMT)

The HMT is a strict shape detection tool. Instead of using one SE, it uses two: B1 defines the shape of the object you want to find (the "hit"), and B2 defines the exact local background that must surround it (the "miss").

The Hit-or-Miss Transform (HMT) is a strict shape detection tool that requires two distinct conditions to be met simultaneously. Using the numerical example from slides 48 and 49, the objective is to locate a specific, isolated cross shape within a 9×11 image grid.

Pasted image 20260511200342.png

To achieve this precision, the HMT utilizes two paired structuring elements:

Here is the mathematical breakdown of how the algorithm processes the matrix:

Step 1: Finding the Hits (AB1)

First, we erode the original Image A using the B1 mask. The algorithm places the center of the B1 cross over every pixel in the image and checks if all five active pixels of the cross are present. If you scan the 9×11 matrix row by row, you will find exactly three locations where a complete cross exists:

  1. Centered at Row 3, Col 2

  2. Centered at Row 6, Col 4

  3. Centered at Row 5, Col 8

At this stage, the intermediate matrix for Step 1 registers 1s at these three coordinates.

Step 2: Checking the Local Background (AcB2)

Next, the algorithm must verify if those three identified crosses are isolated. It does this by eroding the complement of the image (Ac) by B2. Practically, this means checking the four corner pixels surrounding our three candidate crosses to ensure they are all empty (0) in the original image.

Step 3: The Intersection (AB)

The final HMT matrix is the logical AND (intersection) of Step 1 and Step 2. Because the cross at (5,8) failed the background check, it is eliminated. Only the two perfectly isolated crosses at (3, 2) and (6, 4) survive the final cut.


Boundary Extraction

Morphology offers a highly efficient way to outline objects, providing an alternative to derivative-based edge detection (like Sobel).