FUNCTION REFERENCE
imerode
Erode an image.
Erode an image.
Syntax
J = imerode(I, SE)Grey erosion by a flat element: J(x) is the minimum of I over the positions x + b for the members b of SE. A logical image gives a logical result; other classes keep their class. Pixels outside the image count as +Inf (true for binary images), so the border never removes pixels by itself. As in min, NaN is ignored unless every value read is NaN. Each 2-D plane of an N-D image is eroded separately.
Example
imerode(true(3), strel('square', 3)) % true(3)Example
imerode(uint8([1 5 2]), [1 1]) % uint8([1 2 2]): J(x) = min(I(x), I(x+1))Differences from MATLAB: no 'same'/'full' shape argument and no packed binary images. Large flat elements are not decomposed: a call whose work, pixels times neighbourhood reads per pixel (the members of SE; rows plus columns for a full rectangle; twice that for imopen, imclose, imtophat and imbothat), exceeds 2^35 (about 3.4e10) reads is refused before it starts with an error that names the limit; use a smaller element or image.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.