DeleteSmallComponents
DeleteSmallComponents[image] replaces small connected components in a binary image image with background pixels.
DeleteSmallComponents[m] replaces positive integers in a label matrix m with 0 if their tally is small.
DeleteSmallComponents[…,n] replaces components consisting of n or fewer elements.
Please visit the official Wolfram Language Reference for more details and examples on core symbols.