Work

Hyperspectral Imaging

Image Processing
Machine Learning
Data Science

I developed python module for hyperspectral image processing, and scripts for segmentation.

Segmentation of a hyperspectral image

Overview

Code: 8gaU8/asimodule

This module provides tools and scripts for hyperspectral image analysis, preprocessing, segmentation, and visualization. It includes utilities for handling data from various hyperspectral imaging devices (e.g., Nuance, Specim, Tunable), as well as example scripts for segmentation tasks.

Data Collection

The module supports loading and processing hyperspectral images from different sources, including:

  • Nuance: A hyperspectral imaging system that captures images across multiple wavelengths.
  • Specim: A hyperspectral camera that provides images in a specific format.

Example Usage

Importing and Using the Package

from asi import preprocess
from asi.io import load_spectral_image

# Load spectral image and reference images
spectral_image, env_header = load_spectral_image('path/to/image')
whiteref, _ = load_spectral_image('path/to/white_reference')
darkref, _ = load_spectral_image('path/to/dark_reference')

# Apply white correction
corrected = preprocess.white_correction(spectral_image, whiteref, darkref)

# Or, load and correct in one step
corrected, header = preprocess.load_white_corrected(
    'path/to/image',
    'path/to/white_reference',
    'path/to/dark_reference'
)

# If you have a white reference region in the image
white_region = (slice(0, 10), slice(0, 10))  # Example region
corrected = preprocess.white_correction_with_selected_region(spectral_image, white_region)

Running an example script (segmentation)

To run a specific script (e.g., for Nuance data):

# Run the segmentation example for Nuance data
# save results to 'example_results' directory
python example-segmentation-ir.py