Learn R Programming

imager (version 0.14)

selectSimilar: Select a region of homogeneous colour

Description

The underlying algorithm is the same as the bucket fill (AKA flood fill). Unlike with the bucket fill, the image isn't changed, the function simply returns a binary mask of the selected region

Usage

selectSimilar(im, x, y, z = 1, sigma = 0, high_connexity = FALSE)

Arguments

im
an image
x
X-coordinate of the starting point of the region to fill.
y
Y-coordinate of the starting point of the region to fill.
z
Z-coordinate of the starting point of the region to fill.
sigma
Tolerance concerning neighborhood values.
high_connexity
Use 8-connexity (only for 2d images, default FALSE).

See Also

bucketfill

Examples

Run this code
#Select part of a sail
impart <- selectSimilar(boats,x=169,y=179,sigma=20)
layout(t(1:2))
plot(boats,main="Original")
plot(impart,main="Selected region")

Run the code above in your browser using DataLab