Skip to main content

Python package to remove spike in 2D images

Project description

Build Coverage PyPI Status Version Python License

Python package to remove spikes in 2D images


The spikes in 2D-images correspond to high-energy pixels generated by cosmic rays, sensor noise or dead pixels. They use to have values very different from the rest of their neighboor.

To find them, we use a moving box (5×5 pixels by default) on the image and we compare the mean/median of this sub-image to the central pixel. If the value is n (3 by default) times larger than the observed standard deviation we use the median value a the surrounding pixels (8 pixels by default) to replace the spike.


With pip:

$ pip install despike

With the source files:

$ git clone
$ cd despike ; python install


>>> import despike

>>> despike.spikes(img) # Search the location of spikes in the image

>>> despike.clean(img) # Clean the image from spikes

An example can be find in this Jupyter NoteBook.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

despike-0.1.0.tar.gz (158.0 kB view hashes)

Uploaded source

Built Distribution

despike-0.1.0-py2.py3-none-any.whl (4.8 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page