From: jalbers on
I am trying to find the skeletal subsets Skel(S;n) = (S (erosion) nE)
- (S (erosion) nE) (open) E) for a simple rectangle. Skel[n] is
returning a completely black image for n=0,1,2,3,...

I think that I should be getting the classic dog bone shaped skeleton
like you see with ImageAdjust[DistanceTransform[s]]. I am new to the
concepts of morphological image processing. Any help would be greatly
appreciated. Thanks

Here is some of the code I am trying to use:

EE = BoxMatrix[1]; (* structuring element *)
nEE[n_] := BoxMatrix[n];
Skel1[n_] := Erosion[s, nEE[n]]
Skel2[n_] := Opening[Erosion[s, nEE[n]], EE]
Skel[n_] := ImageSubtract[Skel1[n], Skel2[n]]

(* white rectangle with a black border *)
s = Image[ArrayPad[ConstantArray[1, {90, 180}], 50]]

(* n=3 for example *)
n = 3;
Skel1[n]
Skel2[n]
Skel[n]