Perform a flood-fill operation on the binary image bw1. The flood-filling starts in the pixel (r, c). If r and c are vectors of the same length, each pixel pair (r(i), c(i)) will be a starting point for a flood-fill operation. The argument n changes the neighborhood connectivity for the flood-fill operation. n can be either 4 or 8, and has a default value of 8.
The output is the processed image bw2 and the indexes of the filled pixels idx — Function File: [bw2, idx] = bwfill(bw1, "holes", n)
If the string "holes" is given instead of starting points for the flood-fill operation, the function finds interior holes in bw1 and fills them.