How to remove specific noise from image with OpenCV
How I can remove this noise (rectangle 2x2px) from binary image?
Solution
Median filtering (cv::medianBlur()) / morphology operations (cv::morphologyEx(), you need opening, I believe) are often used for your case - they enable cleaning out the isolated pixels. See more in here.