Kent Johnson Kent Johnson - 26 days ago 8
R Question

Flood fill in place in R

Is there an existing package that will perform a flood fill operation in place?

I have images roughly 1500x1000 to 1800x1400 with hundreds of regions I need to fill with different values. Using EBImage::floodFill, the runtime seems to be dominated by the GC as each fill operation allocates a new copy of the image. Is there an existing, fast function that will flood fill in place? I looked at imager and it also seems to allocate a new image for each operation. Should I look at implementing my own flood fill using RCpp?

Answer Source

As of version 4.19.9, EBImage supports this by passing a list of points to floodFill. See for discussion.