  The presence of undesired background areas associated with potential noise
and unknown spectral characteristics degrades the performance of hyperspectral
data processing. Masking out unwanted regions is key to addressing this issue.
Processing only regions of interest yields notable improvements in terms of
computational costs, required memory, and overall performance. The proposed
processing pipeline encompasses two fundamental parts: regions of interest mask
generation, followed by the application of hyperspectral data processing
techniques solely on the newly masked hyperspectral cube. The novelty of our
work lies in the methodology adopted for the preliminary image segmentation. We
employ the Segment Anything Model (SAM) to extract all objects within the
dataset, and subsequently refine the segments with a zero-shot Grounding Dino
object detector, followed by intersection and exclusion filtering steps,
without the need for fine-tuning or retraining. To illustrate the efficacy of
the masking procedure, the proposed method is deployed on three challenging
applications scenarios that demand accurate masking; shredded plastics
characterization, drill core scanning, and litter monitoring. The numerical
evaluation of the proposed masking method on the three applications is provided
along with the used hyperparameters. The scripts for the method will be
available at https://github.com/hifexplo/Masking.
