ee.Image.connectedComponents

Finds connected components with the same value of the first band of the input and labels them with a globally unique value. Connectedness is specified by the given kernel. Objects larger than maxSize are considered background, and are masked.

UsageReturns
Image.connectedComponents(connectedness, maxSize)Image
ArgumentTypeDetails
this: imageImageThe image to label.
connectednessKernelConnectedness kernel.
maxSizeIntegerMaximum size of objects to be labeled.