Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V0.1.3 #3

Merged
merged 5 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ hysnr/test.py
dist/
.DS_STORE
build/
myenv
myenv
*.so*
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,18 @@ plt.scatter(wavelengths, snr, color='black', s=100, alpha=0.7)
![SNR Plot](tests/plots/demo_snr.png)


## All Methods

## Citing HyperQuest (STILL WORKING ON THIS TODO:)
| **Result** | **Method** | **Description** |
|---------------------|----------------------------|----------------------------------------------------------------------------------------------------------------|
| **SNR** | `hrdsdc()` | Homogeneous regions division and spectral de-correlation (Gao et al., 2008) |
| | `rlsd()` | Residual-scaled local standard deviation (Gao et al., 2007) |
| | `ssdc()` | Spectral and spatial de-correlation (Roger & Arnold, 1996) |
| **Co-Registration** | `sub_pixel_shift()` | Computes sub pixel co-registration between the VNIR & VSWIR imagers using skimage phase_cross_correlation |



## Citing HyperQuest (STILL WORKING ON THIS, TODO:)

If you use HyperQuest in your research, please use the following BibTeX entry.

Expand All @@ -70,4 +80,6 @@ If you use HyperQuest in your research, please use the following BibTeX entry.

- Roger, R. E., & Arnold, J. F. (1996). Reliably estimating the noise in AVIRIS hyperspectral images. International Journal of Remote Sensing, 17(10), 1951-1962.

- Scheffler, D., Hollstein, A., Diedrich, H., Segl, K., & Hostert, P. (2017). AROSICS: An automated and robust open-source image co-registration software for multi-sensor satellite data. Remote sensing, 9(7), 676.

- Tian, W., Zhao, Q., Kan, Z., Long, X., Liu, H., & Cheng, J. (2022). A new method for estimating signal-to-noise ratio in UAV hyperspectral images based on pure pixel extraction. IEEE Journal of Selected Topics in Applied Earth Observations and Remote Sensing, 16, 399-408.
2 changes: 2 additions & 0 deletions hyperquest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
from .snr import *
from .utils import *
from .mlr import *
from .coregistration import *
48 changes: 48 additions & 0 deletions hyperquest/coregistration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import numpy as np
from skimage.registration import phase_cross_correlation
from spectral import *

from .utils import *



def sub_pixel_shift(hdr_path, band_index_vnir, band_index_vswir, no_data_value=-9999, upsample_factor=5000):
'''
A wrapper function for skimage.registration's `phase_cross_correlation`



Parameters:
hdr_path (str): Path to the .hdr file..
band_index_vnir (int): Band index for VNIR camera , assuming the first band is 0.
band_index_vswir (int): Band index for VSWIR camera , assuming the first band is 0.
no_data_value (int): Assumed to be -9999.
upsample_factor (int): Upsampling factor. Images will be registered to within 1 / upsample_factor of a pixel.

Returns:
Tuple containing shift in the X direction and shift in the Y direction (in pixels)
'''

# Load image data
img_path = get_img_path_from_hdr(hdr_path)
array = np.array(envi.open(hdr_path, img_path).load(), dtype=np.float64)

# Select the desired bands (VNIR and VSWIR)
vnir_band = array[:, :, band_index_vnir]
vswir_band = array[:, :, band_index_vswir]

# Mask no data values
vnir_band = np.ma.masked_equal(vnir_band, no_data_value)
vswir_band = np.ma.masked_equal(vswir_band, no_data_value)

# Compute the shift using phase_cross_correlation
estimated_shift, error, diffphase = phase_cross_correlation(vnir_band, vswir_band,
upsample_factor=upsample_factor,
space = 'real')

return estimated_shift[1], estimated_shift[0]





Loading