By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,928 Members | 1,210 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,928 IT Pros & Developers. It's quick & easy.

PIL - "despeckle" image ?

P: n/a
Hi - I have some images which I would like to remove specks from using
the PIL. I would like to be able to say that if a pixel is in a blob of
less than n contiguous pixels then all pixels in that blob should be
removed.

The images are 8 bit images with only 0 and 255 values.

I can think of quite crude ways of doing this but I'm sure there are
some smart ways of doing it - would anyone be able to point me in the
right direction ?

Lastly in case it matters the reason I'm doing this is that the images
are scanned images of sheets of papers on which sample signatures have
been placed. Typically the signatures are much smaller than the sheets
of paper so I would like to 'autocrop' the images to remove the white
space around the signature. At some point in the process the images
having picked up small islands of pixels (dust on scanner or paper ?)
which are nowhere near the signature but which are causing my autocrop
efforts to go awry.

Thanks

Richard.

Nov 17 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Nov 16, 10:58 pm, shearich...@gmail.com wrote:
Hi - I have some images which I would like to remove specks from using
the PIL. I would like to be able to say that if a pixel is in a blob of
less than n contiguous pixels then all pixels in that blob should be
removed.

The images are 8 bit images with only 0 and 255 values.

I can think of quite crude ways of doing this but I'm sure there are
some smart ways of doing it - would anyone be able to point me in the
right direction ?

Lastly in case it matters the reason I'm doing this is that the images
are scanned images of sheets of papers on which sample signatures have
been placed. Typically the signatures are much smaller than the sheets
of paper so I would like to 'autocrop' the images to remove the white
space around the signature. At some point in the process the images
having picked up small islands of pixels (dust on scanner or paper ?)
which are nowhere near the signature but which are causing my autocrop
efforts to go awry.
What if you break up your sheet into zones of some arbitrary size (1/2"
say), and compute a pixel density? (Density isn't really required,
since all zones are the same size - raw pixel count per zone will do
just as well.) Then locate the signature based on the zones with
density above threshold X (determine X by trial and error). Lastly,
clip within these zones if this is still necessary.

-- Paul

Nov 17 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.