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.

Overview

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.

More information on our work with this package can be found on Arxiv, or Colab Demo

Usage

Installation

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

Functions

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.

Arguments

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.

Example

Below are some examples with missing data regions filled by our python function (filling method 3). The function call is as follows:

fill_swath_with_neighboring_pixel(img).

Image results:

Pre-fill: beachImagesPreFill

Post-fill: beachImagesPostFill

FAQs

What type of images can be used with the python package?

Our package works best if less than 25% of the image data is missing. This package was originally developed to fill missing data from NASA WorldView, in which an image containing 10% to 25% of the total image is still considered for training data.

How does missing-pixel-filler recognize "missing data"?

By default, our code recognizes "missing data" as [0,0,0] RGB, i.e. black, pixels. However, the user has the option to change what RGB values are recognized as "missing data" using the color parameter to the functions.

How has missing-pixel-filler been used?

Our code was created as a part of research done under SpaceML and alongside NASA's Impact Team. Our goal was to reduce the effects of swath gaps found in NASA Terra and Aqua satellite images in unsupervised machine learning, as missing data may pose a notable pattern that incorrectly attracts the attention of unsupervised models. More information on our work can be found here.

Citation

If missing-pixel-filler is useful in your research, please consider citing

@article{caochen2020swathgaps,
  title={Reducing Effects of Swath Gaps in Unsupervised Machine Learning},
  author={Chen, Sarah and Cao, Esther and Koul, Anirudh and Ganju, Siddha and Praveen, Satyarth and Kasam, Meher Anand},
  journal={Committee on Space Research Machine Learning for Space Sciences Workshop},
  year={2021}
}
You might also like...
HTML2Image is a lightweight Python package that acts as a wrapper around the headless mode of existing web browsers to generate images from URLs and from HTML+CSS strings or files.
HTML2Image is a lightweight Python package that acts as a wrapper around the headless mode of existing web browsers to generate images from URLs and from HTML+CSS strings or files.

A package acting as a wrapper around the headless mode of existing web browsers to generate images from URLs and from HTML+CSS strings or files.

HtmlWebShot - A python3 package which Can Create Images From url, Html-CSS, Svg and from any readable file and texts with many setup features.
HtmlWebShot - A python3 package which Can Create Images From url, Html-CSS, Svg and from any readable file and texts with many setup features.

A python3 package which Can Create Images From url, Html-CSS, Svg and from any readable file and texts with many setup features

Instagram-like image filters.

PyGram Instagram-like image filters. Usage First, import the client: from filters import * Instanciate a filter and apply it: f = Nashville("image.jp

A python script for extracting/removing exif data from images by @AbirHasan2005

Image-Exif A Python script for extracting exif metadata from images. How to use? Using this script you can extract exif data from image and save in .c

This app finds duplicate to near duplicate images by generating a hash value for each image stored with a specialized data structure called VP-Tree which makes searching an image on a dataset of 100Ks almost instantanious
This app finds duplicate to near duplicate images by generating a hash value for each image stored with a specialized data structure called VP-Tree which makes searching an image on a dataset of 100Ks almost instantanious

Offline Reverse Image Search Overview This app finds duplicate to near duplicate images by generating a hash value for each image stored with a specia

A tool for hiding data inside of images

Stegenography-tool a tool for hiding data inside of images Quick test: do python steg-encode.py test/message.txt test/covid19.png to generate the test

📷 Python package and CLI utility to create photo mosaics.
📷 Python package and CLI utility to create photo mosaics.

📷 Python package and CLI utility to create photo mosaics.

A Python package implementing various CFA (Colour Filter Array) demosaicing algorithms and related utilities.
A Python package implementing various CFA (Colour Filter Array) demosaicing algorithms and related utilities.

Colour - Demosaicing A Python package implementing various CFA (Colour Filter Array) demosaicing algorithms and related utilities. It is open source a

A Python package implementing various HDRI / Radiance image processing algorithms.
A Python package implementing various HDRI / Radiance image processing algorithms.

Colour - HDRI A Python package implementing various HDRI / Radiance image processing algorithms. It is open source and freely available under the New

Comments
  • Few issues like Variable missing, resize code and missing region

    Few issues like Variable missing, resize code and missing region

    Hi, I have run your code on Google Colab and found few things for you to note. https://colab.research.google.com/drive/1dD0yJKb159io4ZS_LsUCZ8IHGwMrKlPA?usp=sharing Check the blog - https://www.gopichandrakesan.com/day-96-facing-image-region-missing-on-your-photo-lets-check-the-image-on-missing-pixel-filler/

    1. Code is getting img variable missing and I fixed the code.

    2. The image requires the same dimension on all sides if you are uploading a different size then I am getting an error "valueError: 3. empty range for randrange() (621,224, -397)... E-g 224 x 224 size would be better and you need to add a code to resize it.

    3. The code is considering the good region as a missing region on the image.  You can check the 1st image.

    opened by rcgopi100 3
👾 Python project to help you convert any image into a pixel art.

?? Pixel Art Generator Python project to help you convert any image into a pixel art. ⚙️ Developer's Guide Things you need to get started with this co

Atul Anand 6 Dec 14, 2022
PyPixelArt - A keyboard-centered pixel editor

PyPixelArt - A keyboard-centered pixel editor The idea behind PyPixelArt is uniting: a cmdpxl inspired pixel image editor applied to pixel art. vim 's

Douglas 18 Nov 14, 2022
Pixel art as well as various sets for hand crafting

Pixel art as well as various sets for hand crafting

null 1 Nov 9, 2021
Pixel Brush Processing Unit

Pixel Brush Processing Unit The Pixel Brush Processing Unit (PBPU for short) is a simple 4-Bit CPU I designed in Logisim while I was still in school a

Pixel Brush 2 Nov 3, 2022
Python Image Morpher (PIM) is a program that can take two images and blend them to whatever extent or precision that you like

Python Image Morpher (PIM) is a program that can take two images and blend them to whatever extent or precision that you like! It is designed to emulate some of Python's OpenCV image processing from scratch without reference.

David Dowd 108 Dec 19, 2022
A sketch like(?) effect for images

lineArt A sketch like(?) effect for images How to run main.py [filename] [option {1,2}] option 1 retains colour option 2 gives gray image #results ori

null 1 Oct 28, 2021
This Github Action automatically creates a GIF from a given web page to display on your project README

This Github Action automatically creates a GIF from a given web page to display on your project README

Pablo Lecolinet 28 Dec 15, 2022
Draw a torus passing through three given points.

PyTorusThreePoints Draw a torus passing through three given points. Usage import numpy as np import pyvista as pv from torus_three_points.main import

null 2 Nov 19, 2021
Xmas-Tree-GIF-Tool - Convert any given animated gif file into an animation in GIFT CSV format

This repo is made to participate in Matt Parker's XmasTree 2021 event. Convert a

Aven Zitzelberger 2 Dec 30, 2021
Simple Python / ImageMagick script to package images into WAD3s for use as GoldSrc textures.

WADs Out For [The] Ladies Simple Python / ImageMagick script to package images into WAD3s for use as GoldSrc textures. Development mostly focused on L

null 5 Apr 9, 2022