erode

Perform morphological $(LINK3 https://en.wikipedia.org/wiki/Erosion_(morphology),erosion).

Use given kernel matrix to estimate image erosion for given image slice. Given slice is considered to be binarized with threshold method.

For given input slice:

1 1 1 1 1 1 1 1 1 1 1 1 1 1
2 1 1 1 1 1 1 0 1 1 1 1 1 1
3 1 1 1 1 1 1 1 1 1 1 1 1 1
4 1 1 1 1 1 1 1 1 1 1 1 1 1
5 1 1 1 1 1 1 1 1 1 1 1 1 1
6 1 1 1 1 1 1 1 1 1 1 1 1 1
7 1 1 1 1 1 1 1 1 1 1 1 1 1
8 1 1 1 1 1 1 1 1 1 1 1 1 1
9 1 1 1 1 1 1 1 1 1 1 1 1 1
10 1 1 1 1 1 1 1 1 1 1 1 1 1
11 1 1 1 1 1 1 1 1 1 1 1 1 1
12 1 1 1 1 1 1 1 1 1 1 1 1 1
13 1 1 1 1 1 1 1 1 1 1 1 1 1

... And erosion kernel of:

1 1 1
1 1 1
1 1 1

... Resulting slice is:

1 0 0 0 0 0 0 0 0 0 0 0 0 0
2 0 1 1 1 1 0 0 0 1 1 1 1 0
3 0 1 1 1 1 0 0 0 1 1 1 1 0
4 0 1 1 1 1 1 1 1 1 1 1 1 0
5 0 1 1 1 1 1 1 1 1 1 1 1 0
6 0 1 1 1 1 1 1 1 1 1 1 1 0
7 0 1 1 1 1 1 1 1 1 1 1 1 0
8 0 1 1 1 1 1 1 1 1 1 1 1 0
9 0 1 1 1 1 1 1 1 1 1 1 1 0
10 0 1 1 1 1 1 1 1 1 1 1 1 0
11 0 1 1 1 1 1 1 1 1 1 1 1 0
12 0 1 1 1 1 1 1 1 1 1 1 1 0
13 0 0 0 0 0 0 0 0 0 0 0 0 0

Note: Erosion works only for 2D binary images.

Slice!(kind, [2], T*)
erode
(
alias BoundaryConditionTest = neumann
T
SliceKind kind
)
(
Slice!(kind, [2], T*) slice
,
Slice!(kind, [2], T*) kernel = radialKernel!T(3)
,
Slice!(kind, [2], T*) prealloc = emptySlice!([2], T)
,
TaskPool pool = taskPool
)
if (
isBoundaryCondition!BoundaryConditionTest
)

Parameters

slice
Type: Slice!(kind, [2], T*)

Input image slice, to be eroded.

kernel
Type: Slice!(kind, [2], T*)

Erosion kernel. Default value is radialKernel!T(3).

prealloc
Type: Slice!(kind, [2], T*)

Optional pre-allocated buffer to hold result.

pool
Type: TaskPool

Optional TaskPool instance used to parallelize computation.

Return Value

Type: Slice!(kind, [2], T*)

Eroded image slice, of same type as input image.

Meta