This stage prepares raw hyperspectral, RGB, and depth images for segmentation, feature extraction, modeling, and visualization.
The goal of preprocessing was to turn raw image folders into clean, structured, and usable data. This included validating hyperspectral cubes, removing unusable frames, keeping images from the proper lighting window, separating control and drought plants, and preparing plant masks for feature extraction.
Load RGB, depth, and hyperspectral images from experiment folders.
Check image quality, timestamps, lighting, and valid band structure.
Remove dim, corrupted, invalid, or unusable frames.
Create plant masks and separate control and drought plants.
Save cleaned metadata and feature ready data for later analysis.
The hyperspectral preprocessing work cleaned raw TIFF image cubes before vegetation index extraction. The main purpose was to make sure only valid and usable hyperspectral images moved forward in the pipeline.
Messy filenames were parsed to extract date and sequence information so the images could be sorted and tracked.
Each hyperspectral image was checked for the expected 51 band cube structure before being included in the cleaned dataset.
NDVI was computed from selected spectral bands to help identify plant pixels and separate vegetation from the background.
NDVI thresholding was used to create plant masks, followed by cleanup steps to remove small noisy regions.
This visual shows how hyperspectral data was transformed into NDVI based plant masks, helping separate vegetation pixels from the image background before feature extraction.
Key outputs included cleaned dataset indexes, verified 51 band images, NDVI based vegetation masks, mask ratio, mean NDVI, median NDVI, and metadata CSV files.
For the Set 1 hyperspectral feature workflow, extra quality checks were used before calculating vegetation indices. This helped reduce noisy or unreliable records.
The RealSense preprocessing workflow prepared RGB images and 16 bit raw depth images for plant segmentation and feature extraction. The final RealSense pipeline used the raw depth file for depth based traits and did not use the 8 bit depth visualization for feature extraction.
Frames were filtered to the grow light window so the images had more consistent lighting conditions.
Dim or corrupted RGB frames were rejected when the mean RGB brightness was too low.
The 16 bit raw depth image was used for feature extraction because it keeps the actual depth information.
Unusable frames were removed before segmentation, feature extraction, and modeling.
The RealSense pipeline used Grounded SAM 2 for zero shot segmentation with the prompt βsoybean plant.β This allowed plant level segmentation without training a custom segmentation model.
The model detected soybean plants from the RGB image using a text prompt.
SAM 2.1 generated plant masks from the detected plant regions.
The left plant was treated as control and the right plant was treated as drought based on the detection box center.
HSV color filtering was used as a backup refinement step to remove pot regions and clean plant edges.
This visual shows the RGB frame, plant mask overlay, and segmentation mask used to separate the control and drought soybean plants before extracting features.
The final RealSense preprocessing and segmentation workflow kept 265 usable per plant frames after filtering.
Preprocessing is one of the most important steps in the project because the final features and model results depend on clean images and reliable plant masks. Removing bad frames, validating hyperspectral cubes, and separating the plants correctly helped make the rest of the pipeline more consistent.
β Back to Home