ee.Image.connectedPixelCount

Generate an image where each pixel contains the number of 4- or 8-connected neighbors (including itself).

UsageReturns
Image.connectedPixelCount(maxSize, eightConnected)Image
ArgumentTypeDetails
this: inputImageThe input image.
maxSizeInteger, default: 100The maximum size of the neighborhood in pixels.
eightConnectedBoolean, default: trueWhether to use 8-connected rather 4-connected rules.