# closing

##### Morphological Closing

Perform morphological closing of a window, a line segment pattern or a point pattern.

##### Usage

```
closing(w, r, ...)
## S3 method for class 'owin':
closing(w, r, \dots, polygonal=NULL)
## S3 method for class 'ppp':
closing(w, r, \dots, polygonal=TRUE)
## S3 method for class 'psp':
closing(w, r, \dots, polygonal=TRUE)
```

##### Arguments

- w
- A window (object of class
`"owin"`

or a line segment pattern (object of class`"psp"`

) or a point pattern (object of class`"ppp"`

). - r
- positive number: the radius of the closing.
- ...
- extra arguments passed to
`as.mask`

controlling the pixel resolution, if a pixel approximation is used - polygonal
- Logical flag indicating whether to compute a polygonal
approximation to the erosion (
`polygonal=TRUE`

) or a pixel grid approximation (`polygonal=FALSE`

).

##### Details

The morphological closing (Serra, 1982) of a set $W$ by a distance $r > 0$ is the set of all points that cannot be separated from $W$ by any circle of radius $r$. That is, a point $x$ belongs to the closing $W*$ if it is impossible to draw any circle of radius $r$ that has $x$ on the inside and $W$ on the outside. The closing $W*$ contains the original set $W$.

For a small radius $r$, the closing operation has the effect of smoothing out irregularities in the boundary of $W$. For larger radii, the closing operation smooths out concave features in the boundary. For very large radii, the closed set $W*$ becomes more and more convex.

##### Value

- If
`r > 0`

, an object of class`"owin"`

representing the closed region. If`r=0`

, the result is identical to`w`

.

##### References

Serra, J. (1982) Image analysis and mathematical morphology. Academic Press.

##### See Also

`opening`

for the opposite operation.

`dilation`

, `erosion`

for the basic
operations.
`owin`

,
`as.owin`

for information about windows.

##### Examples

```
data(letterR)
v <- closing(letterR, 0.25, dimyx=256)
plot(v, main="closing")
plot(letterR, add=TRUE)
```

*Documentation reproduced from package spatstat, version 1.19-2, License: GPL (>= 2)*