GithubHelp home page GithubHelp logo

arthur-e / unmixing Goto Github PK

View Code? Open in Web Editor NEW
104.0 9.0 24.0 5.53 MB

Interactive tools for spectral mixture analysis of multispectral raster data in Python

License: MIT License

Shell 1.09% Python 98.91%
lsma raster remote-sensing multispectral-images earth-observation spectral-mixture-analysis satellite-imagery satellite-data

unmixing's Introduction

Interactive Unmixing Tools

Overview

This is a library of interactive tools and functions for performing linear spectral mixture analysis (LSMA) and spatially adaptive spectral mixture analysis (SASMA). It supports parallel fully constrained least-squares (FCLS) mixture analysis over multiple processes, allowing for very efficient mapping of endmember abundances, both in the spatially adaptive approach and in regular LSMA. In detail, the unmixing module includes tools and functions to support:

  • Stacking raster bands from any GDAL file format, including HDF;
  • Applying a mask or a combination of masks to a raster;
  • Generating raster masks from saturated pixels or using density slicing (e.g., to mask water pixels);
  • Applying CFMask output and other quality assurance layers from the USGS;
  • Band-wise compositing of reflectance (or fraction/ abundance images);
  • Tasseled cap transformation and other indices including NDVI and RNDSI;
  • Dimensionality reduction through the Minimum Noise Fraction (MNF);
  • Radiometric rectification of a raster time series;
  • Visualizing the mixing space of a moderate resolution raster;
  • Interactive selection of pixels in the mixing space, which are then captured in a KML file;
  • Endmember induction and plotting of endmembers for linear spectral mixture analysis (LSMA);
  • Fully constrained least squares (FCLS) unmixing;
  • Spatial interpolation of endmembers for spatially adaptive spectral mixture analysis (SASMA);
  • Learning of endmember candidates for SASMA using classification and regression trees (CART);
  • Validation of unmixing through a forward model of reflectance;

For an overview and tutorial on how to use this library, check out the iPython Notebook(s) in the docs/ folder:

Installation and Setup

Because this is a scientific library, there are complex dependencies that may be difficult to install. For GNU/Linux systems, particularly Ubuntu, look at install.sh for a guide on installing the system dependencies required for the Python dependencies.

At this time, installation is intended for development purposes only. As such, unmixing should be installed in "editable" mode using pip; see <https://packaging.python.org/distributing/#working-in-development-mode>. From the unmixing directory, where setup.py is found:

$ pip install -e .

Dependencies

  • numpy
  • scipy
  • matplotlib
  • pysptools
  • GDAL
  • pykml
  • scikit-learn (For SASMA)

Use System Dependencies

Many of the core packages, particularly NumPy and SciPy, have wide adoption and use. They also take a lot of time and clock cycles to compile into a virtual environment. Consequently, it is recommended that these libraries be installed globally (system-wide).

Other packages should be installed only in the virtual environment. To use both system-wide and local packages within a virtual environment, the virtual environment must be set up with the --system-site-packages option:

sudo apt-get install python3-numpy python3-scipy python3-matplotlib python3-zmq
virtualenv -p /usr/bin/python3.5 --system-site-packages <virtualenv_path>

The local packages can be installed within the virtual environment via pip:

source /my/virtualenv/bin/activate
pip install -r REQUIREMENTS

Documentation

Python Dependencies

Some resources on the dependencies can be found:

Third-Party Tools

Documentation on related (but not required) third-party tools can be found:

Foundations

Hyperspectral Imaging (HSI) Cubes

Many of the tools in this library are designed to work with HSI cubes. While the raster arrays read in from GDAL are p x m x n arrays, HSI cubes are n x m x p arrays, where m is the row index, n is the column index, and p is the spectral band number. It is important to note that the row index n corresponds to the latitude while the column index m corresponds to the longitude. Thus, the coordinates (n, m) can be converted directly to a longitude-latitude pair.

unmixing's People

Contributors

arthur-e avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unmixing's Issues

visualize.FeatureSpace has RuntimeError with plot_feature_space() when colorbar used

from unmixing.visualize import FeatureSpace
vis_fs = FeatureSpace(path = '/home/arthur/Desktop/detroit.tiff', nodata = -9999,
                      feature_limit = None)
vis_fs.plot_feature_space(c = 2) # Anytime `c` is set
RuntimeError: No mappable was found to use for colorbar creation. First define a mappable such as an image (with imshow) or a contour set (with contourf).

visualize.FeatureSpace doesn't work well with MNF-transformed data

Though visualize.FeatureSpace can accept MNF-transformed data (by setting transform=False to indicate the data is already transformed), the resulting plots of the mixing space don't look right... I think that something is going wrong with the indexing (e.g., indexing on m,n axes instead of the p-axis).

visualize.FeatureSpace needs setters for raster data, spatial ref. info

Currently, visualize.FeatureSpace() expects to be given a path to a raster file, which it then reads in, setting its internal data structure and attributes. Need to provide setters so that:

  • An existing gdal.Dataset or np.ndarray (with gt and wkt also provided) can be used to initialize a FeatureSpace instance;
  • Either an MNF-transformed or non-transformed raster/ array can be provided and plot_spectral_profile() still works;

the work in this session https://github.com/arthur-e/unmixing/blob/master/docs/Overview_LSMA_in_Python.ipynb tells how to process hdf image i have .hdr image which is already stacked but if use that i couldnt move on to next step so i converted that .hdr image to .tiff format after that i couldnt stack the image and get the desired output. how to resolve this issue.?? If i get the mail ID i can send the datas which have so that you can verify it once. I have attached the data which i have in Re: [arthur-e/unmixing] visualize.FeatureSpace doesn't work well with MNF-transformed data (#2) in which you have mailed me. Also i can mail it again to get this issue resolved

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.