Learn R Programming

ggbrain (version 0.9.0)

count_neighbors: This function counts the number of neighboring/touching pixels in a 2D binary image

Description

This function counts the number of neighboring/touching pixels in a 2D binary image

Value

A matrix of the same size as im containing the number of neighboring pixels

Arguments

im

A boolean matrix representing a binary image

diagonal

Whether to count diagonal elements as valid neighbors

Author

Michael Hallquist

Details

This is an internal function used by geom_outline to clean up outlines