# mmdairport
Detecting runways in satellite airport imagery.

## Description

In this example, a satellite image of an airport is processed. The aim is to detect the runways which are characterized by thin, long and straight features. An open top-hat is first used to enhance the runways. A rough thresholding followed by a thinning operator gives most of the thin structures of the image. They can filtered by selecting only closed features with sufficient length. This result is used as a marker to reconstruct the original gray-scale image, giving as output a gray-scale enhanced airport runways, which can be finally thresholded.

## Demo Script

### Reading

The satellite image of the airport is read.

    >>> f = mmreadgray('galeao.jpg')

    >>> mmshow(f)

f |

### First, enhance the runways by an open top-hat.

The disk of radius 5 (diameter 11) is chosen to detect features smaller than this size. For visualization, the top-hat image is brightened by 150 gray-levels.

    >>> th=mmopenth(f,mmsedisk(5))

    >>> mmshow(mmaddm(th, 150))

    Warning: Converting input image from int32 to uint8.

mmaddm(th, 150) |

### Followed by a thresholding.

A thresholding is applied to detect the features enhanced by the top-hat. This is a standard top-hat sequence.

    >>> bin=mmthreshad(th,30)

    Warning: Converting input image from int32 to uint8.

    >>> mmshow(f,bin)

f,bin |

### Thinning, pruning and area open.

The thinning (red) and pruning (green) detect closed structures which characterized the runways structure. The area open (blue) selects only very long features, with more than 1000 pixels.

    >>> m1=mmthin(bin)

    >>> m2=mmthin(m1,mmendpoints())

    >>> m=mmareaopen(m2,1000,mmsebox())

    >>> mmshow(f,m1,m2,m)

f,m1,m2,m |

### Reconstruction.

The previous result is a sample of the runway pixels. It is used as a marker for gray-scale morphological reconstruction. The runways are enhanced in the reconstructed image.

    >>> g=mminfrec(mmgray(m), th)

    >>> mmshow(g)

g |

### Final thresholding.

A thresholding is applied to the reconstructed image, detecting the airport runways.

    >>> final=mmthreshad(g, 20)

    Warning: Converting input image from int32 to uint8.

    >>> mmshow(f, final)

f, final |

[Up] [`mmdarea`] |
Copyright (c) 2003, Roberto A. Lotufo, UNICAMP-University of Campinas; Rubens C. Machado, CenPRA-Renato Archer Research Center.