image thumbnail

Data Spike Removal for Images

version 1.0.4 (4.56 KB) by Evan Czako
Rectifies pixel data spikes in images with adjustable threshold.


Updated Fri, 22 Nov 2019 22:27:27 +0000

From GitHub

View License on GitHub

This code is intended to mitigate speckle noise, salt-and-pepper/impuse noise, and otherwise spikey data in images. Its intended application is image data that contains a scattering of pixels that have sharp intensity values differing significantly from those of their neighboring pixels. This type of noise is a common artifact of interferograms and radar images. Note that this function may not be an effective method of reducing other types of noise or image artifacts.

The code functions by identifying the nearest neighbors of each pixel and calculating the mean and standard deviation values of those neighbors. If the pixel of interest is further than a user-set threshold of standard deviations away from the mean value of its neighboring pixels, it will be considered a data spike. It will then be removed and replaced using the regionfill function of the Image Processing Toolbox.

NOTE: If you do not have the Image Processing Toolbox, you should replace the call to the regionfill function in this code with a call to my fill_region function (included in this folder), which accomplishes the same task with comparable computational efficiency. Either will run reasonably quickly, even for higher-resolution images.

Please read function descriptions for full instructions on their use. Please see examples embedded in function descriptions for demonstrations of use.

Cite As

Evan Czako (2022). Data Spike Removal for Images (, GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2018b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.