HSImage
HSImage: A Python and C++ library to allow interaction with ENVI-BIL hyperspectral images - Published in JOSS (2018)
Science Score: 95.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 4 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: joss.theoj.org, zenodo.org -
✓Committers with academic emails
1 of 3 committers (33.3%) from academic institutions -
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Repository
A Python and C++ library to allow interaction with ENVI-BIL hyperspectral images
Basic Info
- Host: GitHub
- Owner: DTChuck
- License: mit
- Language: C++
- Default Branch: master
- Size: 22.3 MB
Statistics
- Stars: 9
- Watchers: 3
- Forks: 8
- Open Issues: 0
- Releases: 2
Metadata Files
README.md
HSImage
Interface Library for ENVI-BIL Hyperspectral Images (C++/Python)
This library is designed to allow open-source experimentation with ENVI-BIL hyperspectral images. The goal of this software is to promote the study of hyperspectral images in the academic computer vision research world. This software provides both a C++ and Python interface for ease of use. An associated project has resulted in a publicly available library of images available at https://osf.io/pd49t/. These images are all compatible and intended to be used with this software interface library.
Citation and Archival information
If this software is used as part of a scientific or academic work, please cite the JOSS paper detailing this software. The DOI for this paper is below:
An archival version of this software is available through Zenodo
Installation
NOTE: This software, while it is build with only cross-platform libraries, has not been tested on Windows. It currently has been tested on MacOS 10.11.x and Ubuntu 14.04. If a user wishes to use this software on Windows, it should be possible to build and run, but there may be issues in the linking of the OpenCV libraries. Environment variable settings on Windows can be tricky, and there is no official Windows support for HSImage at this time.
This package requires: 1) Python >= 2.7 or Python >= 3.2 2) Boost 3) Numpy 4) OpenCV 3.x - C++ and Python (OpenCV 2.x is NOT supported)
The practice of using Python virtual environments is recommended. To set up a virtual environment, type the following into terminal:
bash
pip install virtualenv
virtualenv hsi_env
source hsi_env/bin/activate
Virtualenvwrapper is a convenience package built around virtualenv and is optional for this software, but is useful for managing multiple virtual environments. THIS DOES NOT NEED TO BE INSTALLED FOR HSI TO FUNCTION.
To install it and use it to create a virtual environment, type the following into terminal:
bash
pip install virtualenv virtualenvwrapper
source /usr/local/bin/virtualenvwrapper.sh
mkvirtualenv hsi_env
workon hsi_env
After these steps you will be in a Python virtual environment named hsi_env
To install Boost and Numpy type into the terminal
bash
sudo apt-get install libboost-dev
pip install numpy
The OpenCV 3.x installation is non-trivial, as the HSI package requires both the Python and C++ OpenCV libraries. If you already have OpenCV 3.x with the appropriate Python version installed, there should be no additional steps needed to install HSImage.
If you do not have OpenCV installed, a bash script on the repository will can peform the installation for you on Ubuntu. The steps in the script should be appropriate for MacOS, but it has not been tested.
bash
wget https://raw.githubusercontent.com/DTChuck/HSImage/master/install_opencv.sh
bash install_opencv.sh
After OpenCV is installed, the Python module will need to be symlinked into the virtual environment you have created.
Python 2:
bash
ln -s /usr/local/lib/python2.x/site_packages/cv2.so cv2.so
Python 3:
bash
ln -s /usr/local/lib/python3.x/site_packages/cv2.cpython-3xm.so cv2.so
where x is the minor version of Python installed on your system.
Potentially, you will need to provide the directory of the C++ OpenCV libraries to your virtualenv. This is done by modifying the LDLIBRARYPATH variable
bash
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/folder_holding_opencv_libs/
After the prerequisites are installed, simply install with pip:
pip install HSI
This will install the package to the site-packages folder in your current Python environment.
If you want to install from this repository, simply clone and install using setuptools:
python setup.py install
Testing
Cloning the repository will include the test suite which can be run using setuptools:
python setup.py pytest
This test REQUIRES external data (hyperspectral image files) to run. These files are stored on GitHub using the Git LFS protocol. Cloning the repository should automatically download the files to the appropriate folder.
Documentation ##
Full documentation is available at https://dtchuck/github.io/HSImage/
Example Usage
There is an example script in the examples folder here that shows some of the basic operations of the software. The script is repeated below, but without some of the plotting and image viewing functions for clarity. To view the full script, see the link above.
```python import cv2 as cv import numpy as np import matplotlib.pyplot as plt import HSI
load hsimage object
img = HSI.hsimage(directory + filename + hdrext,directory + filename + rawext,[directory + VISspecfile,directory + NIRspecfile])
load labelfile object
lif = HSI.labelfile(directory + filename+lif_ext)
load classified_hsimage object
climg = HSI.classifiedhsimage(directory + filename+rawext,directory + filename+hdrext,directory + filename+lif_ext)
Acquire the RGB image from the labelfile
rgb_img = lif.getRGBImage()
Choose a pixel to view
pixel = (200,300)
Get the chosen spectra
pix = img.getPixelSpectra(pixel[0],pixel[1])
Spectrum of the measured point
wavelengths = img.getWavelengths() ```
The example script here, when run will produce two images, one showing an artificial RGB image generated from the hyperspectral data and stored in the label file with a point over the selected pixel, and another showing the plots of the wavelengths, ambient intensities and spectral reflectance of the selected pixel. These images are shown below and also saved as TrueImage.png and TruePlots.png.
TrueImage.png | TruePlots.png
:-------------------------------------------------:|:---------------------------------------:
|
A few more short examples are below for additional information.
Loading a image, converting to a pixel vector array and normalizing by the ambient intensity to create spectral reflectance data.
```python img = HSI.hsimage(headerfilename,rawfilename)
pix_array = img.getPixelArray() amb = img.getAmbientIntensities() shape = img.getShape()
imagevector = np.reshape(np.array(pixarray), (shape[0] * shape[1], -1)) imagevector = imagevector / np.array(amb) ```
Loading the labelfile and retrieving the class overlay image for viewing. ```python lif = HSI.labelfile(lif_filename)
overlayimage = lif.getOverlayImage() cv2.imshow("Overlay",overlayimage) cv2.waitKey(0) ```
How to Contribute
This software is under active development. If you wish to contribute to this software, contact Ryan Brown at brownrc@vt.edu. Issues can be reported here using the GitHub issue tracker.
Owner
- Login: DTChuck
- Kind: user
- Repositories: 1
- Profile: https://github.com/DTChuck
JOSS Publication
HSImage: A Python and C++ library to allow interaction with ENVI-BIL hyperspectral images
Tags
Hyperspectral Camera ENVI Classified Labeled ImageGitHub Events
Total
Last Year
Committers
Last synced: 7 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Ryan Brown | b****c@v****u | 102 |
| Joshua Moser | j****1@g****m | 7 |
| vtmechatronics | v****s@g****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 31 last-month
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 12
- Total maintainers: 1
pypi.org: hsi
Interactivity class for hyperspectral ENVI-BIL images
- Homepage: https://osf.io/b5t3x
- Documentation: https://hsi.readthedocs.io/
- License: MIT
-
Latest release: 1.2.1
published almost 8 years ago
