Page 1 of 1

How to remove black pixel noise based on the surrounding area.

Posted: 2014-12-10T00:11:15-07:00
by sizlinspirit
I have an image to which I've applied threshold ( so all pixels below a threshold limit have been converted to 100% black).

As a result of applying threshold, there are some stray black pixels, i.e. ones that have no other black pixel in their neighbourhood.
I was looking to eliminate such such pixels, and retain only contagious areas of black in the image.

So say any black pixel ( or a small group of black pixels, say 3x3) that do not have any other black pixel (or a 3x3 black pixel group) in its immediate neighbourhood should be turned white. How do i do this with imagemagick?

Re: How to remove black pixel noise based on the surrounding area.

Posted: 2014-12-10T10:16:13-07:00
by fmw42