[Numpy-discussion] image processing using numpy-scipy?

Stéfan van der Walt stefan@sun.ac...
Fri Feb 27 11:26:23 CST 2009


Hi Prashant

2009/2/27 Prashant Saxena <animator333@yahoo.com>:
> This a little wiered problem. I am having a black and white image. (black
> background)
> Entire image is filled with noisy white patterns of different size and
> shape. I need to fill the
> white patches if there area is more then given one. Logically this could
> possible to use a quickfill algorithm
> for every pixel and if the filled area generated by that pixel is more then
> given area(in pixel) then paint that
> patch (filled area) with black.
>
> I have read the docs of PIL but there is no function for this. Can I use
> numpy-scipy for the matter?

Sure, there are a couple of options.  First, look at scipy.ndimage if
there is anything there you can use (i.e. maybe binary dilation is
sufficient).

Otherwise, I've got some connected component code at:

http://mentat.za.net/source/connected_components.tar.bz2

(The repository is at http://mentat.za.net/hg/ccomp if you prefer)

Using that code, you can identify connected regions, and then fill
them up as required.

Regards
Stéfan


More information about the Numpy-discussion mailing list