1 | initial version |
If the objects you want to remove are literally only several pixels large, than simply apply erosion and dilation morphological operators. The will yield better results if a far simpler way.
If you perform enough erosion for small blobs to disappear, you can easily reconstruct the larger ones with a followed dilation operator.