Learn R Programming

imager (version 0.42.10)

bucketfill: Bucket fill

Description

Bucket fill

Usage

bucketfill(
  im,
  x,
  y,
  z = 1,
  color,
  opacity = 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.

color

a vector of values (of length spectrum(im)), or a colour name (e.g. "red"). If missing, use the colour at location (x,y,z).

opacity

opacity. If the opacity is below 1, paint with transparency.

sigma

Tolerance for neighborhood values: spread to neighbours if difference is less than sigma (for grayscale). If there are several channels, the sum of squared differences is used: if it below sigma^2, the colour spreads.

high_connexity

Use 8-connexity (only for 2d images, default FALSE).

See Also

px.flood

Examples

Run this code
# NOT RUN {
#Change the colour of a sail 
boats.new <- bucketfill(boats,x=169,y=179,color="pink",sigma=.2) 
layout(t(1:2))
plot(boats,main="Original")
plot(boats.new,main="New sails")

#More spreading, lower opacity, colour specified as vector
ugly <- bucketfill(boats,x=169,y=179,color=c(0,1,0),sigma=.6,opacity=.5)
plot(ugly)
# }

Run the code above in your browser using DataLab