Missing Pixel Filler
This is the official code repository for the Missing Pixel Filler by SpaceML.
missing-pixel-filler is a python package that, given images that may contain missing data regions (like satellite imagery with swath gaps), returns these images with the regions filled. These regions of missing data are filled using a dynamic method that incorporates randomly chosen, non-null neighboring pixels. The missing data filling algorithms can be changed according to user preferences.
The command-line tool is intended to obscure regions of null or missing data from machine learning pattern-recognition algorithms. However, this package can be used to fill in an image's missing data or a given RGB value in the image for any purpose.
This package can be installed by typing the following into your command line:
pip install git+https://github.com/spaceml-org/Missing-Pixel-Filler.git#egg=missing_pixel_filler
Filling Method 1
fill_swath_with_random_rgb(img) - Selects pixel values from a random Gaussian distribution to fill missing pixel values.
Filling Method 2
fill_swath_with_random_pixel_from_image_new(img) - Fills swath gap with random pixel from non-missing portion of data.
get_random_pixel_from_image(x_arr, y_arr) - Selects other pixel values from non-missing portions of the image.
Filling Method 3
fill_swath_with_neighboring_pixel(img) - Fills "dynamic" system to fill swath, with nearest pixels having higher probability of selection.
get_neighboring_pixel() - Selects pixel pixel values from non-missing portions of the image to fill missing pixel values with probability inversely proportional to distance.
The function arguments are as follows:
img - numpy array of input image in utf8 form.
color - Optional parameter - color of missing data to fill in (0 - black, 256 - white). Default is black.
current_window_size - for adaptive nearest neighbors method (method 3), radius for selecting neighbor pixels. Default is 10 pixels.
Below are some examples with missing data regions filled by our python function (filling method 3). The function call is as follows: