Skip to content

daniilsjb/suspectral

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Suspectral

Suspectral

Visualization and reconstruction of hyperspectral imaging data
from RGB images based on spectral response functions.

Features

  • Support for hyperspectral images in the ENVI format. 📂
  • Sensor-based synthesis of RGB images from hypercubes. 🖼️
  • Preview of sRGB images based on the CIE XYZ 1931 CMFs. 👁️
  • Options for performing color correction on synthetic images. 🎨
  • Ability to display pixel spectra either individually or in groups. 📈
  • Export of spectral data into CSV, MATLAB, and NumPy tabular files. 📝
  • Saving image previews and spectral plots into PNG, JPG, TIFF, and BMP. 📷
  • Transformations for image preview: zooming, panning, rotations, flips. 🔄️
  • Automatic detection of the operating system's light and dark themes. 🔥

Running / Building

This repository contains two subprojects: suspectral-app and suspectral-notebook. Both projects are intended to be run separately, each in its own virtual environment, if needed.

suspectral-app

This subproject contains the software application developed using PySide6 bindings for the Qt framework. To run the software, simply follow these steps from the suspectral-app directory, assuming you have already activated its virtual environment:

  1. pip install -r requirements.txt
  2. pyside6-rcc resources/resources.qrc -o resources.py
  3. py app.py

To run automated tests using pytest, simply execute one of the following commands:

  • pytest tests (without coverage)
  • pytest tests --cov=suspectral (with coverage)

The software can be packaged into a Windows executable using PyInstaller:

  1. pyinstaller app.spec

To create an installation wizard via Inno Setup, use the provided compilation script.

suspectral-notebook

This subproject contains the Jupyter notebooks contain various experiments and demonstrations revolving around image synthesis and spectral reconstruction. To run the notebooks, simply follow these steps from the suspectral-notebook directory, assuming you have already activated its virtual environment:

  1. pip install -r requirements.txt
  2. jupyter notebook

You must download datasets from their respective authors and extract them in corresponding datasets directories:

  • ICVL. Arad, B. and Ben-Shahar, O., 2016. Sparse recovery of hyperspectral signal from natural RGB images. In Computer Vision–ECCV 2016: 14th European Conference, Amsterdam, The Netherlands, October 11–14, 2016, Proceedings, Part VII 14 (pp. 19-34). Springer International Publishing.
  • CAVE. Yasuma, F., Mitsunaga, T., Iso, D. and Nayar, S.K., 2010. Generalized assorted pixel camera: postcapture control of resolution, dynamic range, and spectrum. IEEE transactions on image processing, 19(9), pp.2241-2253.
  • KAUST. Li, Y., Fu, Q. and Heidrich, W., 2021. Multispectral illumination estimation using deep unrolling network. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 2672-2681).
  • Harvard. Chakrabarti, A. and Zickler, T., 2011, June. Statistics of real-world hyperspectral images. In CVPR 2011 (pp. 193-200). IEEE.

To convert the hyperspectral images into a format that is compatible with the software, use the hsi2envi.py script.

Note

The ICVL-MATLAB directory is intended for the downsampled images with .mat extension, whereas the ICVL-ENVI-RAW is intended for the original output of the hyperspectral camera with paired .hdr/.raw files. The directory ICVL-ENVI should be populated by manually downsampled images using the resample_icvl.py script.

To prepare the datasets for training of spectral reconstruction models, use the synthesize_cave.py, synthesize_icvl_envi.py, and synthesize_icvl_matlab.py scripts (other datasets were only used for software testing).

License

MIT, Copyright © 2025, Daniils Buts

About

Source code for a bachelor's thesis in Computer Science (Double Degree) at Transport and Telecommunication Institute (TSI), Riga, Latvia, 2025.

Topics

Resources

License

Stars

Watchers

Forks

Contributors