Skip to contents

Remove small foreground objects (e.g., dirt) from root binary images

Usage

remove_small_foreground_objects(img, min_size = 100, connectivity = 8)

Arguments

img

A binary image of root systems (imager cimg object)

min_size

Minimum size in pixels for foreground objects to keep

connectivity

Type of connectivity for connected components: 4 or 8 (default: 8)

Value

A processed binary image with small foreground objects removed (0=background, 1=foreground)

Examples

if (FALSE) { # \dontrun{
data("seg_Oulanka2023_Session01_T067")
img <-  seg_Oulanka2023_Session01_T067
cleaned <- remove_small_foreground_objects(img, min_size = 100)
plot(cleaned)
} # }