CropBackground GUI is an interactive tool for removing background pixels from hyperspectral or multichannel image cubes. Built with the AppBase + uihtml architecture (HTML/CSS/JS frontend, MATLAB backend).
Three cropping modes:
- Threshold: min/max intensity sliders with live preview and draggable threshold lines on the distribution chart.
- Selection: draw rectangle, polygon, or freehand regions directly on the heatmap (multi-shape, invert, clear).
- Auto-Detect: automatic particle/cell detection using Otsu or adaptive thresholding with morphological cleanup and optional watershed separation (requires Image Processing Toolbox).
Additional features:
- Spectral band selection: view mean spectrum and select wavelength ranges to use.
- Preprocessing transforms (square, log, sqrt) before any method.
- Full-resolution heatmap with zoom and pan.
- Dark mode (Ctrl+D), jet colormap with colorbar.
- Export cropped matrix and indices to workspace.
- Includes demo with real plastic sample image and synthetic NIR spectra.
Gomez-Sanchez, A. (2024). CropBackground GUI. GitHub repository. https://github.com/LovelaceSquare/lovelacesquare/tree/main/Codes/Crop%20Background%20GUI